Jump to content

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

Link to comment
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

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
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});
        });

 

Link to comment
Share on other sites

  • 2 weeks later...
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??

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...

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 :)

  • Like 3
Link to comment
Share on other sites

  • 5 months later...
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.

Link to comment
Share on other sites

  • 1 year later...
  • 9 months later...
On 5/17/2019 at 2: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 :)

Before I used the @PrestaSOO desision. But after upgad to 1.7.8.7 it stopped working. ((
So I took your code and all work properly - Loggin, not loggin, homepage or product page. Thank you!

Link to comment
Share on other sites

  • 1 year later...

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