This what is included in my method TeaCommerce.updateUniqueOrderLineProperties(452, formObjDate); I have followed this TeaCommerce.updateUniqueOrderLineProperties(orderLineId, propertyList, settings)
I have also tried this TeaCommerce.updateUniqueOrderLineProperties(TeaCommerce.getOrder().OrderLines[i].NodeId, TeaCommerce.getOrder().OrderLines[i].Id, formObjDate, false);
And i am receiving this error, what i am doing wrong...?
1. Don't call getOrder that many times. It will make a server call and fetch the order from the server. It's fast, but not that fast. 2. Write the "Baker" property into your html as an attribute on your orderline tr. Just like the order line id is. 3. Actually you don't need to call get order at all! Instead get the order lines directly from the DOM. Something ilke this:
var orderLines = jQuery('#cartContent .orderLine'), dateBaker = jQuery('#datepickerBaker').val(), date = jQuery('#datepickerOther).val(); orderLines.each(function(){ var orderLine = jQuery(this), orderLineId = orderLine.attr('orderlineid'), isBaker = orderLine.attr('baker') == "Baker";
if (isBaker) {
var formObjDate = { "DeliveryDate": dateBaker, "DeliveryTime": dateBaker }; }
else {
var formObjDate = { "DeliveryDate": date, "DeliveryTime": date }; }
Don't know if this is precise, but you will need to do something like that. Please use firebugs console to check what is actually sent to the server. That way you can see if it does what you want to.
I have made a little change instead of adding datepicker on step 4 i have added on step 3 "levering" instead, so when i try to call this jQuery('#cartContent .orderLine') the length is 0...
how can i access OrderLine from step 3...
By the way thx for all that good service you are providing... :)
you have wrote TeaCommerce.updateUniqueOrderLineProperties(orderLineId, 'date'); isn't it TeaCommerce.updateUniqueOrderLineProperties(orderLineId, formObjDate);
Aah. Sorry. Now when I look closer I see the problem.
updateUniqueOrderLineProperties will only work on unique orderlines, which yours is not! You need to use updateOrderLineProperties and pass along the nodeId instead.
Error when updating OrderLineProperties
Hi Rune & Anders,
i have followed your instruction but i am receiving an annoying error, and my date would not be added.. below is my code
var orderline = TeaCommerce.getOrder();
for (var i = 0; i < TeaCommerce.getOrder().OrderLines.length; i++) {
if (TeaCommerce.getOrder().OrderLines[0].Properties[3].Value == "Baker") {
var formObjDate = {
"DeliveryDate": jQuery('#datepickerBaker').val(),
"DeliveryTime": jQuery('#datepickerBaker').val()
};
}
else {
var formObjDate = {
"DeliveryDate": jQuery('#datepickerOther').val(),
"DeliveryTime": jQuery('#datepickerOther').val()
};
}
TeaCommerce.updateUniqueOrderLineProperties(TeaCommerce.getOrder().OrderLines[i].Id, formObjDate);
}
window.location.href = jQuery(this).attr('link');
return false;
This what is included in my method TeaCommerce.updateUniqueOrderLineProperties(452, formObjDate);
I have followed this TeaCommerce.updateUniqueOrderLineProperties(orderLineId, propertyList, settings)
I have also tried this TeaCommerce.updateUniqueOrderLineProperties(TeaCommerce.getOrder().OrderLines[i].NodeId, TeaCommerce.getOrder().OrderLines[i].Id, formObjDate, false);
And i am receiving this error, what i am doing wrong...?
Hi Rehan,
Well there's a bunch of stuff wrong there :)
1. Don't call getOrder that many times. It will make a server call and fetch the order from the server. It's fast, but not that fast.
2. Write the "Baker" property into your html as an attribute on your orderline tr. Just like the order line id is.
3. Actually you don't need to call get order at all! Instead get the order lines directly from the DOM. Something ilke this:
var orderLines = jQuery('#cartContent .orderLine'),
dateBaker = jQuery('#datepickerBaker').val(),
date = jQuery('#datepickerOther).val();
orderLines.each(function(){
var orderLine = jQuery(this),
orderLineId = orderLine.attr('orderlineid'),
isBaker = orderLine.attr('baker') == "Baker";
if (isBaker) {
var formObjDate = {
"DeliveryDate": dateBaker,
"DeliveryTime": dateBaker
};
}
else {
var formObjDate = {
"DeliveryDate": date,
"DeliveryTime": date
};
}
TeaCommerce.updateUniqueOrderLineProperties(orderLineId, 'date');
});
Don't know if this is precise, but you will need to do something like that. Please use firebugs console to check what is actually sent to the server. That way you can see if it does what you want to.
/Rune
but i am only calling getOrder just once...
I have made a little change instead of adding datepicker on step 4 i have added on step 3 "levering" instead, so when i try to call this jQuery('#cartContent .orderLine') the length is 0...
how can i access OrderLine from step 3...
By the way thx for all that good service you are providing... :)
Ok. Then you will have to use getOrder and loop the order lines there instead. :)
/Rune
but i am still receiving the error... :(
you have wrote TeaCommerce.updateUniqueOrderLineProperties(orderLineId, 'date'); isn't it TeaCommerce.updateUniqueOrderLineProperties(orderLineId, formObjDate);
Aah. Sorry. Now when I look closer I see the problem.
updateUniqueOrderLineProperties will only work on unique orderlines, which yours is not! You need to use updateOrderLineProperties and pass along the nodeId instead.
/Rune
perfect it work... you are genius... :)
Not genious to not throw you on a wild goose chase. But I'm glad we got it working.
/Rune
is working on a reply...