ken.yong Posted December 22, 2005 Share Posted December 22, 2005 Hi, I have modified my What's New Page, adding in MORE INFO buttons in displaying products. I would like to have OUT OF STOCK button displayed when the inventory level is zero. I have the code written out, however: if ($products_new['products_quantity'] > 0) { echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_more_info.gif', IMAGE_BUTTON_MORE_INFO) . '</a>'; } else { echo tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK) . '</a> ';; } The problem is my New Products page does not recognize $products_new['products_quantity']. I have tried $listing['products_quantity'], $products_quantity, $products_quantity['total'] to no avail. It would be greatly appreciated if someone can give me some directions in what to use in the above code. Thank you very much! Link to comment Share on other sites More sharing options...
ken.yong Posted December 28, 2005 Author Share Posted December 28, 2005 Hi, I continue to play the code around to no avail. Now I have another module that "include" the product_listing.php file and I discovered that $listing['products_quantity'] works only when a customer clicks on the Category infobox. It does not work when the other module uses the product_listing.php file. Can someone help me please? Link to comment Share on other sites More sharing options...
ken.yong Posted December 28, 2005 Author Share Posted December 28, 2005 Finally figured out... Hope this helps who have problems in displaying or managing zero quantity inventory in ALL pages. Please see contributions from - http://www.oscommerce.com/community/contributions,2382/ Download v1.1 multilingual by Constantin Sursilov Look for codes for products_new.php when displaying out of stock products. Specifically, 1) $stock_level = tep_get_products_stock($products_new['products_id']); 2) if ((STOCK_CHECK == "true")&&($stock_level < 1) ) { Add and modify the above codes to your needs. Also, modify $variables for pages other than products_new.php, e.g. $products_new['products_id'] to $listing['products_id'] if you want to apply the codes to products_listing.php. I saw another post posted in 2002 asking similar question, where $variable $products_new['products_price'] works when $products_new['products_quantity'] does not. All credits go to Constantin Sursilov. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.