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...
  • 1 year later...
On 8/29/2023 at 10:49 AM, matogroup said:

Hello
You can also edit the html file related to the popup from the path below and keep the required sections or hide these codes altogether.
 

[your-website]/themes/classic/modules/ps_shoppingcart/modal.tpl

 

On 7/23/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

 

Hi!

is it the same solution for Prestahop version 8.1.7?

I want to disable the popup but want to show the the cart on the right side. Some prestashop installation it "slides out". Do you understand what i mean?

See attached image. That slide out. 

 

slide.png

Link to comment
Share on other sites

Hi.

It makes more sense than a flyout window or a modal window to create a fly effect. Clicking the "Add to cart" button creates a thumbnail of the product that is added to the cart and flies up to the cart icon. Then the page scrolls up for the customer to see if the product has been added to the cart.

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