SMFShop > Modifications

SMFShop Inventory Post Modification

<< < (2/24) > >>

feeble:
yes that would work fine
but just change

--- Code: ---elseif(mysql_num_rows($result) > 0){
--- End code ---
to

--- Code: ---else{
--- End code ---
as it will always be true

Also a small note,
the changes that I suggested, actually, if inventory is 0, the "View Inventory" field will not be displayed, so either solution should be fine.
basically it depends on how you want it to look.

inkstains:
yeh i just noticed that with the view inventory not being shown. not sure about which way to go. cheers for all the help feeble.

feeble:
no worries
there are a few other things that I would like to suggest, but they can wait for another time

but for the most part, its a very nice add on to SMFShop, so I'm sure it'll get used plenty

inkstains:
yeh cool any time

this is the code i'ma go with i'm gonna keep the blank fieldset just for consistency if anyone wants it the other way they can just make the change themselves  :)


--- Code: ---//BEGIN SMFShop Inventory Signature MOD
//get the inventory
$result = db_query("
SELECT it.desc, it.image, inv.id
FROM {$db_prefix}shop_inventory AS inv, {$db_prefix}shop_items AS it
WHERE inv.ownerid = {$message['member']['id']} AND inv.itemid = it.id
LIMIT 10", __FILE__, __LINE__);
if(mysql_num_rows($result) == 0){
echo '<fieldset><legend><a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a></legend>';
while ($row = mysql_fetch_assoc($result)){
echo "<img src='{$boardurl}/Sources/shop/item_images/blank.gif'>&nbsp;&nbsp;";
}
echo '</fieldset>';
}
else{
echo '<fieldset><legend><a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a></legend>';
while ($row = mysql_fetch_assoc($result)){
echo "<img src='{$boardurl}/Sources/shop/item_images/{$row['image']}'title='{$row['desc']}'>&nbsp;&nbsp;";
}
echo '</fieldset>';
}
//END SMFShop Inventory Signature MOD
--- End code ---


EDIT: I was thinking about putting all the shop items when it's in the left pane inside the fieldset just to make it all look a bit tidier but i dunno how much daniel would like that so i'll prob leave that for the moment. but i def want to add in some code so it only shows up once per page of a thread for each user but that can wait until i learn a little more php


EDIT: PACKAGES UPDATED IN FIRST POST

feeble:
Apologies made a small mistake
change

--- Code: --- if(mysql_num_rows($result) == 0){
echo '<fieldset><legend><a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a></legend>';
while ($row = mysql_fetch_assoc($result)){
echo "<img src='{$boardurl}/Sources/shop/item_images/blank.gif'>&nbsp;&nbsp;";
}
echo '</fieldset>';
}
--- End code ---
to

--- Code: --- if(mysql_num_rows($result) == 0){
echo '<fieldset><legend><a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a></legend>
<img src="{$boardurl}/Sources/shop/item_images/blank.gif">&nbsp;&nbsp;
</fieldset>';
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version