Broadsword Posted September 16, 2005 Posted September 16, 2005 Is there a contribution or a another way of adding the actual stock quantity to an item listing - therefore advising the customer how many of a particular item are in stock? I would like to add this so the customer can then see how many are in stock and then add to their basket the required quantity. I have found this in Contributions - http://www.oscommerce.com/community/contri...ons,2147/page,7 - but this just allows the customer to change the quantity they want on the product page rather than on the basket page. Cheers in advance (yet again!)
Guest Posted September 16, 2005 Posted September 16, 2005 You can add it yourself with: tep_get_products_stock($listing['products_id']); Matti
Broadsword Posted September 16, 2005 Author Posted September 16, 2005 You can add it yourself with: tep_get_products_stock($listing['products_id']); Matti <{POST_SNAPBACK}> Thanks for the quick reply! Sorry to appear dim (im new to all this PHP malarkey) but which file do i add the code to?
Guest Posted September 16, 2005 Posted September 16, 2005 OK!..... you will need to do a little more. The file is /includes/modules/product_listing.php The simplest way is to append it to something in the listing, eg. weight: ? ? ? ? ?case 'PRODUCT_LIST_WEIGHT': ? ? ? ? ? ?$lc_align = 'right'; ? ? ? ? ? ?$lc_text = ' ' . $listing['products_weight'] . ' Stock: ' . tep_get_products_stock($listing['products_id']); ? ? ? ? ? ?break; You must have weight enabled in admin>>configuration>>product listing Matti
Guest Posted September 16, 2005 Posted September 16, 2005 This is a little sexier :P case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $prod_quantity = tep_get_products_stock($listing['products_id']); if ($prod_quantity > 0) { $stock = 'Stock: ' . $prod_quantity; } else { $stock = 'Sold Out!'; } $lc_text = ' ' . $listing['products_weight'] . ' ' . $stock; break; Matti
Broadsword Posted September 16, 2005 Author Posted September 16, 2005 This is a little sexier :P case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $prod_quantity = tep_get_products_stock($listing['products_id']); if ($prod_quantity > 0) { $stock = 'Stock: ' . $prod_quantity; } else { $stock = 'Sold Out!'; } $lc_text = ' ' . $listing['products_weight'] . ' ' . $stock; break; Matti <{POST_SNAPBACK}> Thats great. Appreciate the help. Cheers.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.