Hi All, I have used updateLinemethod in cart page,...
# suitecommerce
g
Hi All, I have used updateLinemethod in cart page,but it is showing line.sync is not a function Anyone aware of this
s
may i see your code and error plz ?
g
Yeah sure.
var liveModel = LiveOrderModel.getInstance(); console.log('liveModel',liveModel); var OptionsArray=[]; var obj= { cartOptionId:'custcol9', value:{ internalid:'2' } }; OptionsArray.push(obj); var lineoPtion; var line=liveModel.get('lines').get('item6876set1679'); console.log('line',line); line.set('quantity',2); lineoPtion=line.attributes.options.models; lineoPtion=OptionsArray; liveModel.updateLine(line);
I have written the code like this,I am trying to set option values when we are in cart,but it is showing error
s
from your code what i got to know that you are getting error cause the variable 'line' is not in proper format the way it should be,as required by the updateLine(). so use product.model to shape it accordingly then use createFromProduct() of liveorder.line.model to get the new line then update it
And also try to set the options in itemoption model with internalid and label...not only internalid
g
Thank you for information and Do you have reference code for that...?
s
nope sorry.