Jump to content

homepage featured / product list - add to cart


Lloyd966

Recommended Posts

Hi,

 

On the product list page, the Add to Cart button should not be displayed for those items that have one or more attributes, as the popup that appears when you click the Add to Cart button, does not allow for the selection of the attribute associated with the product. (As a side note the quick view button for a product with an attribute, its popup does allow for the attribute selection).

 

Below is the code lines 158 to 169 in product-list.tpl that handles the displaying of the Add to Cart button

 

 

{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($product.id_product_attribute) && $product.id_product_attribute}&ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&token={$static_token}{/if}{/capture}

       <a class="button 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-attribute="{$product.id_product_attribute|intval}" 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}">

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

       </a>

      {else}

       <span class="button ajax_add_to_cart_button btn btn-default disabled">

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

       </span>

      {/if}

     {/if}

 

 

As you can see from the first line of the code it does test, but for some reason the code is not working. The same problem occurs on the homepage.

 

Any help to fix this would be greatly appreciated. 

 

Thank you

 

 

Lloyd

 

 

 

Link to comment
Share on other sites

SOLVED -PLEASE REMOVE THIS TOPIC

 

ok i got rid of the add t cart like i wanted to doing this 

 

preferences > products

 

there is a field named: "Display the "add to cart" button when a product has attributes"

rb0LWaJ.png

Display or hide the "add to cart" button on category pages for products that have attributes forcing customers to see product 

 

Set this to NO

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