Jump to content

how to change text in product cart button when product qty <= 0 ?


Recommended Posts

hello,

 

I would like to know if someone could help me change the text of the cart button in the product page when the product quantity is less or equal to zero? I would like to change the text of the cart button from "add to cart" to "click to backorder" when qty <= 0.

Ordering is allowed when the product is out of stock. I am running prestashop 1.4.8. I want to make sure that my customers know that the product is out of stock by clicking on a modified version of the "add to cart" button ("add to cart" text changed to "click to backorder").

There is a way of doing it for the product list and it works, but I wonder if this is also possible in the product page.

A prestashop forum user tried to find a solution, but it did not seem to work for me or others --> see http://www.prestashop.com/forums/topic/122963-backorder-displayed/

Attached are screen shot of what I am trying to achieve. Thank you for your help.post-378918-0-09269200-1392004931_thumb.jpeg

Edited by lweinlan (see edit history)
Link to comment
Share on other sites

Thank you Vekia. Your solution does work. When doing the text changes in translation from "add to cart"  to "click to backorder", it changes the text for all products.

I am looking for something more "dynamic", meaning that when the stock falls below or is equal to zero for a specific product (not all of them), the text in the button for this specific product would dynamically change to "click to backorder" without manually changing the text in the back office translations.

This "dynamic" way exists for the product-list and it works fine on my website. I am looking for the same solution for each individual product.

 

In the post http://www.prestashop.com/forums/topic/122963-backorder-displayed/ user Shokinro proposed a code modification, but it did not work for me or for other people who tried it. The Shokinro code was:

 

you can add following code beside the "add to cart" button in /themes/YourTheme/product.tpl file

 

Code before adding the new code

<span class="exclusive">{l s='Add to cart'}</span>

code after adding the new code:

<span class="exclusive">{l s='Add to cart'}
{if $product->quantity <= 0}{l s='backorder'}{/if}
</span>

 

 

I would really appreciate if you could help us. Thank you so much.

Edited by lweinlan (see edit history)
Link to comment
Share on other sites

  • 8 months later...

I manage to solve this like this in product.tpl (PS 1.6)

<button type="submit" name="Submit" class="exclusive">
									<span>{if $content_only && (isset($product->customization_required) && $product->customization_required)}{l s='Customize'}{elseif $product->quantity <= 0}{l s='Backorder'}{else}{l s='Add to cart'} {/if} </span>
								</button>

Now i need to figure out for product with atributes partialiy stock.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hello,

Ho can I do this with prestashop 1.6 ?

I am using filezilla but I don't find this field to change

 

 

Code before adding the new code

<span class="exclusive">{l s='Add to cart'}</span>

code after adding the new code:

<span class="exclusive">{l s='Add to cart'}
{if $
product->quantity <= 0}{l s='backorder'}{/ifi

 

 

Please help me

Thanks 

Marco

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...