pcp Posted February 24, 2016 Share Posted February 24, 2016 I have a web page on prestashop at this website want to add to cart two products at a time. attempt will detail exactly what I look for and I've tried several things but still can not get it: in the shop I offer a number of parts, I created a module in the same product page, shows a series of technical services where you can apply what you ride. Technical skills have them discharged as product prestashop, and the module in which the show get the id of the product (the idea was with this id to add to cart). The customer can buy only the parts or service parts and obviously when you just want to buy the parts by clicking on Add to cart works, but I do not know how to do is if you also select a service to add you to cart the parts mounting over that site. I tried to explain it as best I could, anyway I appreciate the help in advance and sorry for my English 1 Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 25, 2016 Share Posted February 25, 2016 If you are able to get id of the products that are needed to add to the cart, then you can do "add to cart" one after the other. Try below code. <script> $.ajax({ type: 'POST', url: baseUri + '?rand=' + new Date().getTime(), data: 'controller=cart&add=1&ajax=true&qty=1'+'&id_product=11', success: function(q) { } });</script> 1 Link to comment Share on other sites More sharing options...
pcp Posted February 25, 2016 Author Share Posted February 25, 2016 Thank you very much, is very simple and does not know how much I appreciate it. He had proven a thousand ways and I never thought of something as simple as this. As demonstrated in this case, sometimes the most effective solution is the easiest. Really thank you very much Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 26, 2016 Share Posted February 26, 2016 We are Glad, it helped you Link to comment Share on other sites More sharing options...
matracon Posted July 22, 2016 Share Posted July 22, 2016 Hi Knowband Plugins Thanks for the script but has a little problem, when you refresh the page where you place this script (without pressing the button "add to cart"), automatically adds the product to the cart. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted July 25, 2016 Share Posted July 25, 2016 Have you added the script in .ready function? Kidnly make sure it runs only when customer clicks on add to cart button. 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