SMFShop > Modifications

SMFShop Inventory Post Modification

(1/24) > >>

inkstains:
THIS HAS ONLY BEEN TESTED ON A CLEAN INSTALL OF SMF 1.1.3 AND SMFShop 3.0

WARNING IF YOU INSTALL THIS MOD AND EVER GO TO REMOVE/UPGRADE YOUR INSTALL OF SMFShop YOU MAY ENCOUNTER ERRORS IF THIS MOD IS NOT UNINSTALLED FIRST. YOU'VE BEEN WARNED


IF YOU ARE USING AN EARLIER VERSION PLEASE UNINSTALL AND INSTALL THIS NEW VERSION

Updated and rolled into one package, from admin you can now select whether to enable/disable the IPM (on disable all original postbit settings will be restored) select where you would like the IPM displayed, Signature or Postbit, as well as selecting how many items you would like displayed.

Because this is a work in progress and as much a learning process for myself as modification project I'm going to just keep updating as it develops. but if you do decide to use this on a forum please be sure to check back for any updates, as i'm sure as time goes on i will realise things could have been done differently and better.

Goals for the next build

Introduce an inventory display sorting system to allow for a wider range of conditions (price, category etc)

Finally add the split and display trade items as well and expand on the current tooltips

Expand the admin section

And possibly something to do with members profile page depends



Special Note: Thank you to feeble for helping with the while loop i feel stupid now haha Daniel for telling me about seperating operations and visual output and Basil Beard for giving me a kick in the right direction when i thought **** this **** **** *** of a mod. cheers fellas. now that emmy esque speech is over with onto the pics


Signature


Postbit


Admin




 >:D

feeble:
very nice

i like the like design as well

inkstains:
cheers glad ya liking it

feeble:
Just taken a look through your package

I know its early days, so I'll only suggest one thing at the moment
change

--- Code: ---//BEGIN SMFShop Inventory Signature MOD
echo '<fieldset><legend><a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a></legend>';

//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__);

//item image and tooltip descriptions
$varia = mysql_fetch_assoc($result);
if ($varia == 0){echo "<img src='{$boardurl}/Sources/shop/item_images/blank.gif'>&nbsp;&nbsp;";}

elseif ($varia > 0){
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
$varia = mysql_fetch_assoc($result);
if ($varia > 0) {
echo "<img src='{$boardurl}/Sources/shop/item_images/{$varia['image']}'title='{$varia['desc']}'>&nbsp;&nbsp;";
}
}

echo'</fieldset>';
//END SMFShop Inventory Signature MOD

--- End code ---
to

--- 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/{$row['image']}'title='{$row['desc']}'>&nbsp;&nbsp;";
}
echo '</fieldset>';
}
//END SMFShop Inventory Signature MOD
--- End code ---

inkstains:
yeh that's what i was thinking that's just a loop isn't it? i just wasn't sure how to do it that looks dope though.

one thing when a user has no items it will show the blank.gif image the only reason i say is if the fieldset doesn't haven't something inside of it it loses the borders and just has the view inventory link which doesn't look very good imo. do you know how i would get it so if the members inventory is 0 it will still display the blank.gif image?

could i do it like this?



--- 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>';}}
}
elseif(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/{$row['image']}'title='{$row['desc']}'>&nbsp;&nbsp;";
}
echo '</fieldset>';}
--- End code ---

i haven't tested that but it looks sorta right, i'm still learning so don't know a heap yet. cheers for the cleaner code though feeble i'll update the packages soon.

EDIT: actually the way you had it makes it not display the section at all which is probably a better way to go hmmm i'm not sure i kinda like it there even if they have no items

Navigation

[0] Message Index

[#] Next page

Go to full version