Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

display stock #


Recommended Posts

I'm looking for a way to display the actual number in stock (i.e. "5 in stock") for each product on both the "lets see what we have here" category display and the product_info.php page.


So far the only contributions I've found allow you to show "In Stock" or "Out of Stock" on those pages and/or to show the stock number available on the cart page IF they client tries to order more than you have in stock.




php geek wannabe

"The difference between genius and stupidity is that genius has its limits." -Einstein


My Contributions

In-Stock Quantity Display

Link to comment
Share on other sites

  • 3 weeks later...

Find this in product_info.php

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>


incert this just below it at around line 110 in your product_info.php file

If ($product_info['products_quantity']==0){
? ?echo "<br><font color=\"#C70832\"><strong>*** Sorry, This item is Out of Stock ***</stong></font><br><br>";
elseIf ($product_info['products_quantity']==1){
? ?echo "<br><font color=\"#C70832\"><strong>*** This Item is either Unique <br>or there is only ONE left in Stock ***</stong></font><br><br>";

echo "<BR> We have " . tep_get_products_stock($product_info['products_id']) . " Items in Stock at this time<BR><BR>";

i found this code above in the contrib sections..and moded it with the code from this forum to have a check for 0 items (out of stock), 1 item (unique or one), and how meny are in stock.

at one point ill make a admin section to alow for not only wording in other languages. but so u can ajust whats displayed too (on/off etc) look fo rit in the config


hope it helps someone leave feedback.


aka Pern

Link to comment
Share on other sites


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

  • Create New...