robbie007 Posted March 18, 2013 Share Posted March 18, 2013 (edited) Hi, I want to show an out of stock button when product is out of stock. Now it removes the add to cart button when product quantity = 0. Want to make it more clear for customers to see when a product is out of stock. Want this is product.tpl and product-list.tpl Presta 1.5.2 Edited March 22, 2013 by robbie007 (see edit history) Link to comment Share on other sites More sharing options...
dagobert Posted March 22, 2013 Share Posted March 22, 2013 (edited) By default it should already show a red text "this product is out of stock". If you want further customization, you can look at line 431 of product.tpl and add your content in the first "if" segment. {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} <span class="exclusive"> <!-- YOU CAN ADD ANYTHING YOU WANT HERE --> <span></span> {l s='Add to cart'} </span> {else} <p id="add_to_cart" class="buttons_bottom_block"> <span></span> <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> </p> {/if} Edited March 22, 2013 by dagobert (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted March 22, 2013 Share Posted March 22, 2013 you probably use non-default theme, am i right? if so, compare you .tpl with piece of code that dagober pasted above Link to comment Share on other sites More sharing options...
robbie007 Posted March 22, 2013 Author Share Posted March 22, 2013 Thanks guys. Yes, it's a non-default theme. How to make this displaying an image soldout.png? Rename the span class as well please. <span class="exclusive"> <!-- YOU CAN ADD ANYTHING YOU WANT HERE --> <span></span> Link to comment Share on other sites More sharing options...
robbie007 Posted March 22, 2013 Author Share Posted March 22, 2013 Sorry, css was a bit messy. Cleared up and working!! Thank you so much! Link to comment Share on other sites More sharing options...
robbie007 Posted March 22, 2013 Author Share Posted March 22, 2013 Dagobert, do you know wich line in product-list.tpl I can get the same result? Link to comment Share on other sites More sharing options...
vekia Posted March 22, 2013 Share Posted March 22, 2013 thanks for information that it works for you know, im convinced that this topic will be very helpfull for other forum members :-) 1 Link to comment Share on other sites More sharing options...
robbie007 Posted April 9, 2013 Author Share Posted April 9, 2013 Changed line 122 in product.tpl. <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> Same trick as product.tpl Link to comment Share on other sites More sharing options...
Smijn1 Posted September 16, 2013 Share Posted September 16, 2013 I also have a custom theme installed and my add to cart button is still there when a product is out of stock, but does nothing when clicked on. I really would love the button to be gone when a product is out of stock, how can I do this? Code for add_to_cart button in product.tpl: {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} <span class="exclusive"> <span></span> {l s='Add to cart'} </span> {else} <p id="add_to_cart" class="buttons_bottom_block"> <span></span> <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> </p> {/if} Code for add_to_cart button in product_list.tpl (I think): {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {if ($product.allow_oosp || $product.quantity > 0)} {if isset($static_token)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", true)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {else} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", true)} title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {/if} {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} {/if} Thanks! Link to comment Share on other sites More sharing options...
robbie007 Posted September 16, 2013 Author Share Posted September 16, 2013 I haven't looked at your code. But do you know this is a default backoffice option? See preferences >> products >> product stock at the bottom of the page (don't have the English version). You can choose to hide button when product is out of stock. Easy! Link to comment Share on other sites More sharing options...
Smijn1 Posted September 16, 2013 Share Posted September 16, 2013 thanks for your reply. I know that it is a default option, but it only makes the button to do nothing when clicked on, it doesn't remove the button however.. Link to comment Share on other sites More sharing options...
Smijn1 Posted September 22, 2013 Share Posted September 22, 2013 does anyone have an idea? Link to comment Share on other sites More sharing options...
Vilas Posted October 6, 2014 Share Posted October 6, 2014 (edited) Hi, I want to show an out of stock button when product is out of stock. Now it removes the add to cart button when product quantity = 0. Want to make it more clear for customers to see when a product is out of stock. Want this is product.tpl and product-list.tpl Presta 1.5.2 Please tell me exactly what you did to solve this issue? I am using PS 1.5.4.1 Edited October 6, 2014 by Vilas (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 7, 2014 Share Posted October 7, 2014 you enabled option to order out of stock products? Link to comment Share on other sites More sharing options...
[email protected] Posted May 22, 2017 Share Posted May 22, 2017 Hi, I have a product that does not have quantities, but it shows the add to cart button, ¿Doesn´t prestashop disable the product? Someone can help me with this issue 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