ArsalanAnsari Posted February 9, 2015 Share Posted February 9, 2015 Hi , I don't need to page scroll back to top when i press add to cart button i need that page to stay where it is. How can i do this. thank Link to comment Share on other sites More sharing options...
helldog2004 Posted February 9, 2015 Share Posted February 9, 2015 Can we see a link of the website? There is no scroll back to top button on my PS website. Link to comment Share on other sites More sharing options...
ArsalanAnsari Posted February 9, 2015 Author Share Posted February 9, 2015 Can we see a link of the website? There is no scroll back to top button on my PS website. not button. If product on bottom of the category page and when i press "Add to cart" button then product added to the cart but page scroll to top of the page which i don't need. Link to comment Share on other sites More sharing options...
helldog2004 Posted February 9, 2015 Share Posted February 9, 2015 Try the following: Go to /themes/themename/js/modules/blocklayered and open up blocklayered.js. Find the following code: if(slideUp) $.scrollTo('.product_list', 400); updateProductUrl(); and change it to /* if(slideUp) $.scrollTo('.product_list', 400); updateProductUrl(); */ Let me know if this works Link to comment Share on other sites More sharing options...
ArsalanAnsari Posted February 9, 2015 Author Share Posted February 9, 2015 Try the following: Go to /themes/themename/js/modules/blocklayered and open up blocklayered.js. Find the following code: if(slideUp) $.scrollTo('.product_list', 400); updateProductUrl(); and change it to /* if(slideUp) $.scrollTo('.product_list', 400); updateProductUrl(); */ Let me know if this works r u sure in blocklayered.js? Link to comment Share on other sites More sharing options...
helldog2004 Posted February 9, 2015 Share Posted February 9, 2015 No I am not sure, but you are only commenting out a small piece of code. It is worth trying it out. If it does not work, you can undo the uncommenting and save it again. Link to comment Share on other sites More sharing options...
ArsalanAnsari Posted February 9, 2015 Author Share Posted February 9, 2015 No I am not sure, but you are only commenting out a small piece of code. It is worth trying it out. If it does not work, you can undo the uncommenting and save it again. thanks for the code but its not working as it shouldn't. Link to comment Share on other sites More sharing options...
razaro Posted February 9, 2015 Share Posted February 9, 2015 Like helldog2004 said, link to your website could help but I think file is ajax-cart.js. It could be in your theme folder js/modules/blockcart/ or in root modules/blockcart. You can check latest version at https://github.com/PrestaShop/blockcart/blob/master/ajax-cart.js and look at line 214 // add picture to cart. Try to comment out all lines until 262 ajaxCart.updateCartInformation(jsonData, addedFromProductPage); That should not be commented out/deleted. Note this is just example as your code could be different. Link to comment Share on other sites More sharing options...
helldog2004 Posted February 9, 2015 Share Posted February 9, 2015 Okay last resort! open template file of the products like product.tpl, product-list.tpl and the featured template. Search for something like this: <a onclick="$('html, body').animate({scrollTop: 0 }, 600);" class="your_class" Just remove animate and it should be fixed. Link to comment Share on other sites More sharing options...
ArsalanAnsari Posted February 9, 2015 Author Share Posted February 9, 2015 Like helldog2004 said, link to your website could help but I think file is ajax-cart.js. It could be in your theme folder js/modules/blockcart/ or in root modules/blockcart. You can check latest version at https://github.com/PrestaShop/blockcart/blob/master/ajax-cart.js and look at line 214 // add picture to cart. Try to comment out all lines until 262 ajaxCart.updateCartInformation(jsonData, addedFromProductPage); That should not be commented out/deleted. Note this is just example as your code could be different. I tried with both files but no luck. Link to comment Share on other sites More sharing options...
helldog2004 Posted February 9, 2015 Share Posted February 9, 2015 Find this in ajax-cart.js $('body,html').animate({ scrollTop: This is causing the scroll to top after adding product to cart. Link to comment Share on other sites More sharing options...
ArsalanAnsari Posted February 10, 2015 Author Share Posted February 10, 2015 Find this in ajax-cart.js $('body,html').animate({ scrollTop: This is causing the scroll to top after adding product to cart. thanks buddy. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now