Jump to content

Disabling Ajax add to cart on Product page


Recommended Posts

Hi all

 

I need to disable the ajax animation on the product page. When the user clicks on Add to cart, I want them to be taken to the cart page directly. No animation needed.

 

The current link code for the add to cart "button" is:

 

   <a class="exclusive" href="javascript:document.getElementById('add2cartbtn').click();">{l s='Add to cart'}</a>

 

 

Obviously, I will need to replace the javascript part by something else.

 

Can anyone help?

 

thanx

Link to comment
Share on other sites

You don't need to replace any code or javascript.

 

Modules>Front office features>Cart block - configure and disable AJAX mode.

 

Preferences>Products - Re-direction after adding product to cart set to cart summary.

 

Now when Add to Cart is clicked your customer will be taken to the cart page directly.

  • Like 2
Link to comment
Share on other sites

You don't need to replace any code or javascript.

 

Modules>Front office features>Cart block - configure and disable AJAX mode.

 

Preferences>Products - Re-direction after adding product to cart set to cart summary.

 

Now when Add to Cart is clicked your customer will be taken to the cart page directly.

 

hi Dave, and thank you for your help

 

however, my settings are already as you described

 

but the animation still works on the product page...

Link to comment
Share on other sites

When I replace the code I gave above for the add to cart button, with the code show below, I get redirected to the shopping cart page without any animation, however the variation (combination) I select is not replicated. The default variation of the product is added to the cart

 

 

<a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$product->id|intval}&token={$static_token}&add" rel="ajax_id_product_{$product->id|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>

Link to comment
Share on other sites

  • 1 year later...

hello,

 

I have the same problem, my settings are correct:

 

Modules>Front office features>Cart block> disabled AJAX mode and disabled AJAX in block top cart module.

 

Preferences>Products - Re-direction after adding product to cart set to cart summary.

 

But the redirection doesn't work, I use prestashop 1.4 with the theme Blackwhite.

 

I have the block top cart module in the hook Top, when I remove this module from this hook, the redirection works but I need the block top cart in that hook. I think the problem is that the ajax effect isn't being disabled although the settings are correct.

 

Any ideas? how can I solve this?

Link to comment
Share on other sites

  • 4 weeks later...

Disabling ajax cart will only works for product pages, did not work for product list pages. In product list when you add to cart, it turns to a fresh cart summary page, but no product added, it says "cart is empty". There should be add some coding at the product-list.tpl for add to cart form.

 

The following is add to cart form in product-list.tpl

{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='Shop now'}</a>
  {/if}	 
 {else}
   <span class="exclusive"><span></span>{l s='Add to cart'}</span><br />
  {/if}

 

How to make it directly check out at product list pages?

Link to comment
Share on other sites

  • 4 years later...
×
×
  • Create New...