Post by Dutch Pride Code » Thu Mar 05, 2020 10:09 pm

How do I disable scroll to top on all pages when users add a product to cart?

Already removed the below code (three times) from common.js in the catalog theme folder as suggested by other topics on the forum.

Code: Select all

$('html, body').animate({ scrollTop: 0 }, 'slow');
This works on category pages but the page still scrolls on the home page when adding something from the "recommended products" module.

Anyone knows what to do about this?

OC 3.0.3.2
PHP 7.2.10
Default theme
Last edited by Dutch Pride Code on Thu Mar 05, 2020 10:42 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Sun Jan 26, 2020 9:46 pm

Post by Johnathan » Thu Mar 05, 2020 10:24 pm

There's at least one more instance of that code in this file, triggered by adding the product to the cart on the product page:

/catalog/view/theme/default/template/product/product.twig

Beyond that, you should check the other template files for that same line of code. The Featured module doesn't have it, but if you have some other third-party "recommended products" module, it may have its own code controlling that. You'd need to edit its files to fix that, so if you can't find those, contact the developer for support.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Dutch Pride Code » Thu Mar 05, 2020 10:42 pm

Thanks a lot, I found it and it works ;D
If I happen to encounter another scroll-top I know where to find it now.

User avatar
Active Member

Posts

Joined
Sun Jan 26, 2020 9:46 pm
Who is online

Users browsing this forum: No registered users and 27 guests