Jump to content

{solved} When product is out of stock show (sold out) button instead of removing Add to cart button?


Recommended Posts

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 by robbie007 (see edit history)
Link to comment
Share on other sites

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 by dagobert (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...

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

  • 1 year later...

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 by Vilas (see edit history)
Link to comment
Share on other sites

  • 2 years later...

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...