I have manage to modify the demo shop to my needs and now i want to add a feature where the user can click a checkbox that says "include screws" and that is a product that is related to the current product, and all that works like a charm thx to sørens nice guide.
the problem orcures when i add items via $.uCommerce.addToBasket(); method suddenly the basket total amount and subtotals are not correctly updated, if i only add one product it works, but if i add 2 only the last product added is the one reflected in total amount in the basked, even thoug the orderlines are correct, and when i move to shipping details the order amounts are corrected. and are reflected as they should be.
if i investegate the request made from ajax i can see that it calls the add method with all the right data but the getBasket method gets called after the add method only grabs the last product in total amount but has both orderlines.
It looks like you do not execute the basket pipeline correctly. This should be done every time you modify the basket. And that may be why you experiance that the basket is showed correctly at the next page (the basket pipeline is executed when the page changes if i remember correctly).
Can you verify that this is the problem? Otherwise please try to append some code that shows what you're trying to achieve.
Adding multiple products to the basket via api
Hey uCommerce experts
I have manage to modify the demo shop to my needs and now i want to add a feature where the user can click a checkbox that says "include screws" and that is a product that is related to the current product, and all that works like a charm thx to sørens nice guide.
the problem orcures when i add items via $.uCommerce.addToBasket(); method suddenly the basket total amount and subtotals are not correctly updated, if i only add one product it works, but if i add 2 only the last product added is the one reflected in total amount in the basked, even thoug the orderlines are correct, and when i move to shipping details the order amounts are corrected. and are reflected as they should be.
if i investegate the request made from ajax i can see that it calls the add method with all the right data but the getBasket method gets called after the add method only grabs the last product in total amount but has both orderlines.
Hello Peter,
It looks like you do not execute the basket pipeline correctly. This should be done every time you modify the basket. And that may be why you experiance that the basket is showed correctly at the next page (the basket pipeline is executed when the page changes if i remember correctly).
Can you verify that this is the problem? Otherwise please try to append some code that shows what you're trying to achieve.
Best regards
Morten
is working on a reply...