I'm using the starter kit as a base point an want to add a new property to each orderline for product availability information. This is what I've tried:
product_product.xslt I've added a new hidden field and added it to the 'AddOrderLine' list item
<input name="prodAvail" type="hidden" value="{call to my own xslt helper}" /> <input name="AddOrderLine" type="hidden" value="nodeId,quantity,prodAvail" />
Settings: I've added a new property 'productAvail' to the orderline properties in Tea Commerce > Settings > General Setting page:
cart_step01.xslt I try to pick up on the value here but it is blank
You are on the right track. You got the part to allow "no javascript" fallback. Now you need to implement the javascript part.
So if you need to add this property you have to add another javascript call after the addOrderLine method in your javascript. You should call the TeaCommerce.updateOrderLineProperty or TeaCommerce.updateOrderLineProperties
By the way - if you dont have the prodAvail as a property at your product umbraco node you shouldn't have the productAvail in the Order line property aliases. Those specify which properties to copy from the node to the order line.
The form in the product page posts to an aspx page below (obviously for the no JavaScript fallback), but which JavaScript function gets called to override that and in which js file? I'm not quite sure where I should be adding the TeaCommerce.updateOrderLineProperty function call when add to basket is clicked from product_product.xslt.
That makes sense about not including the property in the Order line property aliases.
So just to confirm I need to:
Include a hidden field (as I have done above) doing for JavaScript fallback and
Also call the TeaCommerce.updateOrderLineProperty function (using the same id as the hidden field) for JavaScript (in the file/function I'm hoping you will point me at!)
Otherwise you can make another method call and use the updateOrderLineProperty on the success call in the addOrderline method. Personally I wote for the first option. The fewer server calls the better performance.
Adding a new property to an order line
I'm using the starter kit as a base point an want to add a new property to each orderline for product availability information. This is what I've tried:
product_product.xslt
I've added a new hidden field and added it to the 'AddOrderLine' list item
Settings:
I've added a new property 'productAvail' to the orderline properties in Tea Commerce > Settings > General Setting page:
cart_step01.xslt
I try to pick up on the value here but it is blank
Have I missed something, or am I going about it the wrong way?
Hi Matt
You are on the right track. You got the part to allow "no javascript" fallback. Now you need to implement the javascript part.
So if you need to add this property you have to add another javascript call after the addOrderLine method in your javascript. You should call the TeaCommerce.updateOrderLineProperty or TeaCommerce.updateOrderLineProperties
http://rune.gronkjaer.dk/en-US/2010/11/16/tea-commerce-javascript-api/
By the way - if you dont have the prodAvail as a property at your product umbraco node you shouldn't have the productAvail in the Order line property aliases. Those specify which properties to copy from the node to the order line.
Kind regards
Anders
Thanks Anders,
The form in the product page posts to an aspx page below (obviously for the no JavaScript fallback), but which JavaScript function gets called to override that and in which js file? I'm not quite sure where I should be adding the TeaCommerce.updateOrderLineProperty function call when add to basket is clicked from product_product.xslt.
That makes sense about not including the property in the Order line property aliases.
So just to confirm I need to:
Thanks,
Matt
Hi Matt,
You should add the extra information to the orderline in the AddOrderline method in the advanced javascript file. You can either add it as properties in the addOrderline (around line 235 in the standard advanced script) settings as statet here: http://rune.gronkjaer.dk/en-US/2010/11/16/tea-commerce-javascript-api/#addOrderLine
Otherwise you can make another method call and use the updateOrderLineProperty on the success call in the addOrderline method. Personally I wote for the first option. The fewer server calls the better performance.
/Rune
is working on a reply...