Jump to content

How to add cart button in productscategory


Andrii

Recommended Posts

Hi. I use standart module "Additional products in v1.2.1" in prestashop 1.3

I need to add cart button, which add product to cart with AJAX

I copy from product-list.tpl

{if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
	 <span class="add_to_cart_button"> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&id_product={$product.id_product|intval}&token={$static_token}"></a></span>
    {else}
	  <span class="exclusive">{l s='Add to cart' mod='filtersearch'}</span>
    {/if}

 

and change ->

{if ($categoryProduct.allow_oosp OR $categoryProduct.quantity > 0) && $categoryProduct.customizable != 2}
   <span class="add_to_cart_button"> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$categoryProduct.id_product|intval}" href="{$base_dir}cart.php?add&id_product={$categoryProduct.id_product|intval}&token={$static_token}">to cart</a></span>
  {else}
   <span class="exclusive">{l s='Add to cart' mod='filtersearch'}</span>
  {/if}

And it's work when i press "to cart" and reload the page without AJAX.

What i must to do to have AJAX button?

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