Jump to content

Hide add to cart button in product list if product has attributes


Recommended Posts

Hi,

 

I need to change the product-list.tpl in the way that there will be no "More info" (about product) button, instead there will be just "Add to cart" button. But if the product has any attributes to select from, the "Add to cart button" would change to "Choose options" and it will link to detail of product.

 

I tried it with:

 

{if $product.id_product_attribute > 0}
	  <a class="button ajax_add_to_cart_button exclusive" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='Choose options'}"><span></span>{l s='Choose options'}</a>
	  {/if}
   {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)}
  <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
 {else}
  <span class="exclusive"><span></span>{l s='Add to cart'}</span><br />
 {/if}

 

But its not working..... Anyone can help me ?

 

Thanks in advance......

Link to comment
Share on other sites

Hi, thanks for the response, the thing is that i actually need to hide button View details, if there are no attributes to choose from, if yes i just want to change button from "add to cart" to Choose options (which will link to product detail)...

 

If i use the option in product references its not working,..... i m using customized theme, but its not working when i use the default one either........

Link to comment
Share on other sites

Well i m still doing it on local..... But it will be online soon, will post URL afterwards........

 

Ok so in product-list.tpl i tried:

 

{if isset($product.groups)}

{if isset($groups)}

{if ($product.id_product_attribute > 0)}

 

and some more, but no success.... any idea ?

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

  • 2 months later...

Same issue here, the preference does not work for me My "Add to cart" buttons all show even though my products have several attributes. I'm using 1.5.1.

 

In the template product.tpl this seem to be what I need to find there from what I read in other threads:

 

line 271

<form id="buy_block" {if $PS_CATALOG_MODE AND !isset($groups) AND $product->quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart')}" method="post">

 

 

Any idea anyone ? Is there any real centralized support for Prestashop btw or is it just geeks helping one antoher here an there ?

 

Thanks.

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...