Jos Medinger Posted March 25, 2004 Share Posted March 25, 2004 Hi there Does anyone in the forums know whether it is possible to have the store simply NOT display an item that is out of stock? At the moment, we're running the QTpro module to allow setting of stock levels on attributes. When an item reaches 0 stock, the auto message is displayed to the user however ideally, the user would simply not see this size / option in the first place... I have found a contribution (No Stock, No Checkout) which prevents a user from adding an out of stock item to their cart however this only does half what I need. Ideally, a fix would simply remove a zero stock item from the attribute list... Any ideas anyone? Many Thanks Jos Medinger =============== Simple yet Creative Get Online Web Design : getonlinedesign.com =============== Link to comment Share on other sites More sharing options...
coffman Posted March 29, 2004 Share Posted March 29, 2004 I have played around with doing this, but other things were more important. I believe I can at least get you in the right place. The code I am going to give is a hack at best. You will need to make changes to product_info.php. Use at your own risk.... In product_info.php find the following while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); Add: pa.options_id, pa.options_values_id, pa.options_values_price To the query that follows.. Now you need to do a stock query of the attributes immediatly following that: $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'"); $attributes_stock = tep_db_fetch_array($attribute_stock_query); $option_stock = $attributes_stock['products_stock_quantity']; Then use something like the following to conditionally display the stock info, I believe this will follow the previous code snippet. You will need to comment out the existing code that builds the menu options... if ($option_stock > 0) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); } You may also need the following to ensure that items that have options with no value or inventory attached are displayed.. if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } I never added this to my store as I wanted customers to see all the things we normally carry. I believe I will instead create a function that will place a link near the options pull down to allow customers to query for stock. This will display a separate page show all the items and if they are instock.. Again, I did play around with the above code several months ago. I think this is all you will need. Hope this was of some help.. -MichaelC Link to comment Share on other sites More sharing options...
Scotty Posted April 3, 2004 Share Posted April 3, 2004 I have played around with doing this, but other things were more important. I believe I can at least get you in the right place. The code I am going to give is a hack at best. You will need to make changes to product_info.php. Use at your own risk.... Hi Michael, Thanks for trying to help. But would you mind looking up your old notes and post a clearer instruction on how to modify the code, as what you have provided is pretty vague and no matter how I tried it, it generated error on the product descriptin page. A step-by-step instruction will help lots of people on this link to make a better use of this contribution. TIA, Scotty Link to comment Share on other sites More sharing options...
wwwbrockwellscouk Posted April 8, 2004 Share Posted April 8, 2004 I would also like not to show stock items that are out of stock, as it is very unlikely that I will have that item in stock for a very long time. I've been trying to find a way to set the products_status in products db table to 0, at the checkout_success page. But my newbie skills leave me adrift. Matt Brockwells Booksellers Billingborough, Lincolnshire UK Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.