Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Showing Quantity in Stock in Product Info


adam71o

Recommended Posts

This should be simple, were I proficient enough at php.

 

using this code in product_info.php:

<?php 
 $prod_quantity = tep_get_products_stock($products_id); 
 switch ($prod_quantity) { 
     case 0: 
     print '<img src="images/stock_soldout.gif" border="0">'; 
     break; 
     case 1: 
     print '<img src="images/stock_limitedstock.gif" border="0">'; 
     break; 
     case 2: 
     print '<img src="images/stock_limitedstock.gif" border="0">'; 
     break; 
     case 3: 
     print '<img src="images/stock_limitedstock.gif" border="0">'; 
     break; 
     case 4: 
     print '<img src="images/stock_limitedstock.gif" border="0">'; 
     break; 
     default: 
     print '<img src="images/stock_instock.gif" border="0">'; 
 } 
 ?>

 

...my store always shows the out-of-stock image (images/stock_soldout.gif).

 

I believe the problem is in this line:

  $prod_quantity = tep_get_products_stock($products_id);

... in that $prod_quantity is not receiving the correct value. Does anyone know how to correctly assign the current product's stock to $prod_quantity ?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...