I have products adding the the cart and adjusting the quantity in each orderline in the cart working fine but I have to refresh the page to see the updated results how do I get this do happen automatically so the results are show straight away
You will have to use the success function for addOrderLine in the javascript API. This blog post should give you a great idea of the way to use the javascript API and its features. It also gives example of the owerwriteQuantity method and the event subscribeToOnCartUpdated
HI thank I have had a look through the link which has helped but when i got to the invokeXSLT code as I have written the code in a razor script I wondered if there was a similar command i need to use for this or what code I need to write to get this to work with my razor script
//If there is a cart on the page we can update that
58
if(cart[0]) {
59
//Fetch the new cart html with invokeXSLT and update the UI
We don't have an invokeRazor - so you will have to do it a little more basic here and make the UI update using the data you get back using the javascript api. You always get the order and can use all the data to update your UI.
Cheers I have most of it working now except for the orderline totalprice in the cart when changing the quantity level as i'm calling from the order class not the orderline class how can i get to the orderline properties from the order
He he - thats because its an array of orderLines - so you have to loop them. Try use firebug and type TeaCommerce.getOrder() and click the object in the console. Then you can see that JSON structure in a more structured way
Is there a way to pass the orderlineId to teh subscribeToOnCartUpdated method so I can work out which orderline to update or should i just update them all
The subscribeToOnCartUpdateddoesnt tell you was has changed - but if you have a success function for addOrderLine you will get what orderlines was added and also the id so you can update using that.
refresh the page
I have products adding the the cart and adjusting the quantity in each orderline in the cart working fine but I have to refresh the page to see the updated results how do I get this do happen automatically so the results are show straight away
Hi Phil
You will have to use the success function for addOrderLine in the javascript API. This blog post should give you a great idea of the way to use the javascript API and its features. It also gives example of the owerwriteQuantity method and the event subscribeToOnCartUpdated
http://rune.gronkjaer.dk/en-US/2010/11/24/tea-commerce-javascript-xslt-examples/
Kind regards
Anders
HI thank I have had a look through the link which has helped but when i got to the invokeXSLT code as I have written the code in a razor script I wondered if there was a similar command i need to use for this or what code I need to write to get this to work with my razor script
//If there is a cart on the page we can update that
58
if
(cart[0]) {
59
//Fetch the new cart html with invokeXSLT and update the UI
60
var
cartJqHtml = jQuery(TeaCommerce.invokeXSLT(
'cartStep01.xslt'
, _nodeId,
false
,
null
,
null
));
61
cart.after(cartJqHtml);
62
cart.remove();
63
}
We don't have an invokeRazor - so you will have to do it a little more basic here and make the UI update using the data you get back using the javascript api. You always get the order and can use all the data to update your UI.
Kind regards
Anders
Cheers I have most of it working now except for the orderline totalprice in the cart when changing the quantity level as i'm calling from the order class not the orderline class how can i get to the orderline properties from the order
Tried order.OrderLines in your javascript?
i have tried order.orderlines.TotalPriceFormatted but it doesn't work
He he - thats because its an array of orderLines - so you have to loop them. Try use firebug and type TeaCommerce.getOrder() and click the object in the console. Then you can see that JSON structure in a more structured way
Kind regards
Anders
Is there a way to pass the orderlineId to teh subscribeToOnCartUpdated method so I can work out which orderline to update or should i just update them all
The subscribeToOnCartUpdateddoesnt tell you was has changed - but if you have a success function for addOrderLine you will get what orderlines was added and also the id so you can update using that.
Kind regards
Anders
is working on a reply...