Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

A way of adding stock quantity to items


Broadsword

Recommended Posts

Posted

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!)

Posted

You can add it yourself with:

 

tep_get_products_stock($listing['products_id']);

 

 

 

Matti

Posted
You can add it yourself with:

 

tep_get_products_stock($listing['products_id']);

Matti

 

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?

Posted

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

Posted

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

Posted
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

 

 

Thats great. Appreciate the help. Cheers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...