Jump to content

Refresh page after add to cart


Recommended Posts

I am sure this is a simple fix.

After a product is added to the cart I would like the product page to refresh so that the reduced pricing is then updated and shown accordingly.

Can anyone tell me what is the code and where to put it?

 

Thankyou,

Warren.

Link to comment
Share on other sites

edit the blockcart/ajax-cart.js

 

and add this line

 

 

location.reload();

 

after the add to cart action

 

Please could you expand?

 

Do I add it in here somewhere?

 

//for every 'add' buttons...
 $('.ajax_add_to_cart_button').unbind('click').click(function(){
  var idProduct =  $(this).attr('rel').replace('ajax_id_product_', '');
  if ($(this).attr('disabled') != 'disabled')
   ajaxCart.add(idProduct, null, false, this);
  return false;
 });

Link to comment
Share on other sites

$('.ajax_add_to_cart_button').unbind('click').click(function(){

var idProduct = $(this).attr('rel').replace('ajax_id_product_', '');

if ($(this).attr('disabled') != 'disabled')

ajaxCart.add(idProduct, null, false, this);

location.reload();

return false;

});

Link to comment
Share on other sites

Tried it too - didnt work for me either - yep got Ajax turned on.

Im trying to get the page to refresh after the cart is added to so that it then displays the new reduced pricing so

my customer knows that the price has been reduced since adding to the cart.

Link to comment
Share on other sites

  • 3 years later...

Sorry for retrieving a too old post but for everyone who's looking for a solution, have to add the location.reload(); after the

window.parent.ajaxCart.updateCartInformation(jsonData, addedFromProductPage);

 

or something else depending your Prestashop version!

Link to comment
Share on other sites

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