Jump to content
fashionmart

Disable Ajax Cart Popup in Prestashop 1.7

Recommended Posts

Hi,

 

I want to disable the Ajax cart popup that shows up after a customer clicks "Add to cart" and instead redirect them to the cart summary page.

 

I have seen many posts instructing to disable Ajax add to cart in the Cart Block module, but this only works for 1.6. I have not seen this module or setting in Prestashop 1.7. Has anybody seen this setting in 1.7?

 

Thanks

Share this post


Link to post
Share on other sites

it's a 'shopping cart' module and it has option to enable or disable "ajax cart"

mV3PYFc.png

 

"ajax cart" option - when disabled - does not show the "add to cart" confirmation popup

  • Like 2

Share this post


Link to post
Share on other sites

Hi Vekia,

 

Thank you for your quick response. Yes, that works great to disable the Ajax popup. But then, also, how do you redirect the customer to the Cart summary page after they click "add to cart"?

 

In 1.6 the option was under Preferences > Product, "Redirect after adding product to cart" but there is no option like that in 1.7, or maybe I'm overlooking it. Would I have to add code manually?

 

Thanks

Share this post


Link to post
Share on other sites

in this case you have to re-enable the ajax cart :P You have to alter the js file of the module.

it is because whole add to cart process is handled by core file of themes, it will be hard to change it. So it is better to edit ps_shoppingcart.js file

 

here is the tutorial that i wrote exclusively for this topic:

disable ajax cart popup modal window

Share this post


Link to post
Share on other sites

I know that I'm a little bit out of topic, but somebody knows which file I have to modify If I want to change the content of the pop up?

 

PS 1.7

 

 

Share this post


Link to post
Share on other sites
On 23/7/2017 at 8:31 AM, vekia said:

in this case you have to re-enable the ajax cart :P You have to alter the js file of the module.

it is because whole add to cart process is handled by core file of themes, it will be hard to change it. So it is better to edit ps_shoppingcart.js file

 

here is the tutorial that i wrote exclusively for this topic:

disable ajax cart popup modal window

I've tried it as you explain in the tutorial. But the redirection leads to the homepage, not the cart page.

Is the variable "prestashop.urls.pages.cart" correct?

  $.post(refreshURL, requestData).then(function (resp) {
          $('.blockcart').replaceWith($(resp.preview).find('.blockcart'));
          if (resp.modal) {
            //showModal(resp.modal);
            window.location.replace(prestashop.urls.pages.cart);
          }
        }).fail(function (resp) {
          prestashop.emit('handleError', {eventType: 'updateShoppingCart', resp: resp});
        });

 

Share this post


Link to post
Share on other sites
Op 23-7-2017 om 8:31 AM, vekia zei:

in this case you have to re-enable the ajax cart :P You have to alter the js file of the module.

it is because whole add to cart process is handled by core file of themes, it will be hard to change it. So it is better to edit ps_shoppingcart.js file

 

here is the tutorial that i wrote exclusively for this topic:

disable ajax cart popup modal window

 

Have you already found a solution to the problem of redirected to the home page when logged in??

Share this post


Link to post
Share on other sites

Instead of this:

window.location.replace(prestashop.urls.pages.cart);

because it'll work only when you're not logged in. If you're logged in then it'll redirect you to the homepage.

Change to this : window.location.replace('/en/cart?action=show'); 

if you have only one language. or default language English then remove /en.

 

Hope it help :)

Share this post


Link to post
Share on other sites
On 5/17/2019 at 1:45 PM, Himanshubishtt said:

Instead of this:

window.location.replace(prestashop.urls.pages.cart);

because it'll work only when you're not logged in. If you're logged in then it'll redirect you to the homepage.

Change to this : window.location.replace('/en/cart?action=show'); 

if you have only one language. or default language English then remove /en.

 

Hope it help :)

Thank you for your help! This code you write about works correctly for logged in users and store guests.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More