Jump to content

Change Add to Cart button for products with attributes


Recommended Posts

Hellow everyone,

 

I searched over and over the internet and all forums and I don't find anything usefull for me.

I suppose this is where I need to edit the condition of Add to cart button, but I managed to make it show

view button just for out of stock products.

My intention is to do that for products with multiple attribute in order to avoid selecting the default combinations.

 

 

 

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
    {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
        {capture}add=1&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}{/capture}
<a class="ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity > 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}"><div><i class="icon-glyph icon-small icon_btn icon-mar-lr2"></i><span>{l s='Add to cart'}</span></div></a>
    {else}
                           <a class="view_button btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}" rel="nofollow"><div><i class="icon-eye-2 icon-small icon_btn icon-mar-lr2"></i><span>{l s='View'}</span></div></a>
    {/if}
    {/if}
Link to comment
Share on other sites

×
×
  • Create New...