Dan1 Posted October 28, 2012 Share Posted October 28, 2012 (edited) I'd like to change the product page so when a product is in stock, the text "Availability: Product is available" is not displayed. But when a product is out of stock "Availability: Out of stock" is displayed, as well as when one attribute is out of stock the text "Availability: Out of stock with those attributes but is available with others" is also displayed. I know the code for this is in product.tpl. <!-- availability --> <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}> {if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if} </span> </p> but I don't know how to manipulate it. Commenting out the whole thing removes availability text for the out of stock items, this I don't want. Changing the line <span id="availability_label">{l s='Availability:'}</span> To <span id="availability_label"{if $product->quantity > 0} style="display: none;"{/if}> had the result I want in Firefox and Chrome, but broke up the page in IE8. Suggestions please? Edited October 28, 2012 by Dan1 (see edit history) Link to comment Share on other sites More sharing options...
Dan1 Posted October 28, 2012 Author Share Posted October 28, 2012 Bump ....................................... Link to comment Share on other sites More sharing options...
sebkos Posted October 29, 2012 Share Posted October 29, 2012 Hi, you need to add $('#availability_statut:visible').hide(); into product.js (in theme directory) around line 206 Link to comment Share on other sites More sharing options...
Dan1 Posted October 29, 2012 Author Share Posted October 29, 2012 (edited) Thanks. I changed this code: //availability value management if (availableNowValue != '') { //update the availability statut of the product $('#availability_value').removeClass('warning_inline'); $('#availability_value').text(availableNowValue); $('#availability_statut:hidden').show(); } To: //availability value management if (availableNowValue != '') { //update the availability statut of the product $('#availability_value').removeClass('warning_inline'); $('#availability_value').text(availableNowValue); $('#availability_statut:visible').hide(); } The result was on product pages with attributes availability would display momentarily then disappear. On product pages without attributes availability continues to be displayed. Other suggestions? Edited October 29, 2012 by Dan1 (see edit history) Link to comment Share on other sites More sharing options...
sebkos Posted October 29, 2012 Share Posted October 29, 2012 Don't change code but add $('#availability_statut:visible').hide(); at the end of function listed below function updateDisplay() { if (!selectedCombination['unavailable'] && quantityAvailable > 0 && productAvailableForOrder == 1) { some code some code... ... $('#availability_statut:visible').hide(); } Link to comment Share on other sites More sharing options...
Dan1 Posted October 29, 2012 Author Share Posted October 29, 2012 (edited) Thank you. I did as instructed, see code below. The result was the same as before. On product pages with attributes availability would display momentarily then disappear. On product pages without attributes availability continues to be displayed. //update display of the availability of the product AND the prices of the product function updateDisplay() { if (!selectedCombination['unavailable'] && quantityAvailable > 0 && productAvailableForOrder == 1) { //show the choice of quantities $('#quantity_wanted_p:hidden').show('slow'); //show the "add to cart" button ONLY if it was hidden $('#add_to_cart:hidden').fadeIn(600); //hide the hook out of stock $('#oosHook').hide(); //availability value management if (availableNowValue != '') { //update the availability statut of the product $('#availability_value').removeClass('warning_inline'); $('#availability_value').text(availableNowValue); $('#availability_statut:hidden').show(); } else { //hide the availability value $('#availability_statut:visible').hide(); } //'last quantities' message management if (!allowBuyWhenOutOfStock) { if (quantityAvailable <= maxQuantityToAllowDisplayOfLastQuantityMessage) $('#last_quantities').show('slow'); else $('#last_quantities').hide('slow'); } if (quantitiesDisplayAllowed) { $('#pQuantityAvailable:hidden').show('slow'); $('#quantityAvailable').text(quantityAvailable); if (quantityAvailable < 2) // we have 1 or less product in stock and need to show "item" instead of "items" { $('#quantityAvailableTxt').show(); $('#quantityAvailableTxtMultiple').hide(); } else { $('#quantityAvailableTxt').hide(); $('#quantityAvailableTxtMultiple').show(); } } $('#availability_statut:visible').hide(); } Edited October 29, 2012 by Dan1 (see edit history) Link to comment Share on other sites More sharing options...
sebkos Posted October 29, 2012 Share Posted October 29, 2012 You're right, I found one more thing in product.tpl file <!-- availability --> <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> delete !$product->available_now to see code listed below and let me know if it works <!-- availability --> <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR $product->quantity > 0 OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> Link to comment Share on other sites More sharing options...
Dan1 Posted October 30, 2012 Author Share Posted October 30, 2012 The combination of the product.js and product.tpl file edits worked. Thank you very much sebkos. If possible one more thing. When displaying "Availability: Out of stock" and "Availability: Out of stock with those attributes but is available with others" how to make it so "Availability:" is not displayed. In other words only "Out of stock" and "Out of stock with those attributes but is available with others". Link to comment Share on other sites More sharing options...
sebkos Posted October 30, 2012 Share Posted October 30, 2012 comment this line out in product.tpl <span id="availability_label">{l s='Availability:'}</span> Link to comment Share on other sites More sharing options...
garyjj127 Posted May 5, 2015 Share Posted May 5, 2015 I know this is an old post, but is there any way to also remove the "Out Of Stock" availability display as well? I currently have the availability showing in the drop down box, but also sell products that don't have attributes, like bags, so I'd like to keep the "In Stock" message for those items. Currently this solution works perfectly with in stock items, but for some reason the "Out Of Stock, Delivery 10 Days" message still appears on out of stock attributes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now