Aarsvaars Posted July 25, 2011 Posted July 25, 2011 Hi all, I was wondering if it is possible to only show a stock status image (green for in stock, red for not in stock) instead of the amount of products in stock. I have been searching the forum but I only encountered outdated topics regarding the 2.2 version. Gr, Aarsvaars
Aarsvaars Posted July 26, 2011 Author Posted July 26, 2011 Bump! Can anyone answer my question? I also have to correct the title: it should be "Stock status in product listing" as there is no product_listing.php.
OSC-Sevilla Posted July 26, 2011 Posted July 26, 2011 You can Modiify this: If there is stock it shows the stock value - if there is no stock it shows "OUT OF STOCK" - for an image simply call an image instead of text.. // QUANTITY AVAILABLE if($product_info['products_quantity']>0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] > 0) ? ' (' . $product_info['products_quantity'] . ')' : ''); } elseif ($product_info['products_quantity']<=0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] <=0) ? ' (' . TEXT_OUT_OF_STOCK_LEVEL . ')' : ''); } ?>
Aarsvaars Posted July 26, 2011 Author Posted July 26, 2011 Thanks for the reply! Can you tell me which file to modify?
Aarsvaars Posted July 26, 2011 Author Posted July 26, 2011 Okay, and what should I do when I want to display the text/images in the product overview table within all categories instead of a stock count?
OSC-Sevilla Posted July 26, 2011 Posted July 26, 2011 // QUANTITY AVAILABLE if($product_info['products_quantity']>0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] > 0) ? ' (<img src="images/YOURIMAGE-1.jpg" width="XXX" height="XXX" />)' : ''); } elseif ($product_info['products_quantity']<=0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] <=0) ? ' (<img src="images/YOURIMAGE-2.jpg" width="XXX" height="XXX" />)' : ''); } ?>
Aarsvaars Posted July 26, 2011 Author Posted July 26, 2011 I am sorry, but I think you dont get it. I mean the overview of all products within a category. An example: http://www.rimacomputers.nl/index.php?cPath=24. In that table the column named "Aantal" would echo the images.
Aarsvaars Posted July 26, 2011 Author Posted July 26, 2011 Did some digging and I figured out the adjustments need to be in the file includes/modules/product_listing.php. Also I think that it has to do with the following lines: <span><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></span> Around line 164
Aarsvaars Posted July 27, 2011 Author Posted July 27, 2011 Bump! Is this adjustment possible or not? If not, please say so, so that I don't keep my hope up.
archangel_mike Posted August 16, 2011 Posted August 16, 2011 Hi Guys gfasal's solution sounds wonderful, but can I get some clarification please? In OSCommerce V2.3.1 In the file catalog/product_info.php There should be the code mentioned // QUANTITY AVAILABLE if($product_info['products_quantity']>0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] > 0) ? ' (' . $product_info['products_quantity'] . ')' : ''); } elseif ($product_info['products_quantity']<=0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] <=0) ? ' (' . TEXT_OUT_OF_STOCK_LEVEL . ')' : ''); } ?> & in this code we change ' (' . $product_info['products_quantity'] . ')' to ' (<img src="images/YOURIMAGE-1.jpg" width="XXX" height="XXX" />)' OR Do I need to insert that code somewhere in catalog/product_info.php? & if so, whereabouts exactly? Thanks Mike
OSC-Sevilla Posted September 24, 2011 Posted September 24, 2011 <?php // QUANTITY AVAILABLE if($product_info['products_quantity']>0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] > 0) ? ' (' . $product_info['products_quantity'] . ')' : ''); } elseif ($product_info['products_quantity']<=0 ) { echo TEXT_PRODUCT_STOCK_LEVEL . (($product_info['products_quantity'] <=0) ? ' (' . TEXT_OUT_OF_STOCK_LEVEL . ')' : ''); } ?> THIS CODE IS FOR OSC 2.3.1 - WORKS FINE - SIMPLY PASTE IN PRODUCTS_INFO.PHP PAGE, YOU MIGHT SAY WHERE EXACTLY... - ITS TOTALLY UP TO YOU - MAY I SUGGEST BELOW THE PRICE. CANNOT GIVE YOU A LINE NUMBER BUT MAKE A BACKUP OF YOUR PRODUCTS_INFO.PHP FILE AND THEN PASTE THIS CODE A COUPLE OF TIMES IN THE APPROX. AREA ON THE PAGE WHERE YOU WANT IT. - AS LONG AS YOU CAN SEE IT WORKING , REOVE ANY EXTRA PASTES AND PLACE IT ACCORDINGLY. WORKS PERFECTLY - example http://www.verdegia.com/BANO/product_info.php?products_id=419
Elseworlds Posted September 25, 2011 Posted September 25, 2011 Works like a charm... thanks for the tip. I have an extended question that you might be able to give me an answer, what if I would like to add a watermark to the image that says "Sold-out" only in case there are no more articles in stock? The code to choose when to show this is the same as the one you post just in the image part, but is there a way to do this on the image without having a second image everytime? Thanks for the input
OSC-Sevilla Posted September 26, 2011 Posted September 26, 2011 I will assume that you would like the product image (in the image box/fancy box) to show a water mark - It should be straight forward but I honestly havnt had time to look at it. give me a few days and i will come back to you with some code as its a good idea!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.