.. at least, that's what I assume is what is the problem...
Let's say I have a product that has 1 sku, but two different 'unit' codes, and therefore also two different prices. One for a single unit and one for a case.
The webstore doesn't recognize that, so I have a different sku there for the time being. Upon order submit, I want to simply change the sku and make sure that the units is set to 'case'... price should stay the same (since the price for this temporary sku is the same as the case price for the real sku).
I hope that made sense so far.
But then....
My user event script (beforesubmit) checks to see if that item is in the items list. If it is, then:
if (itemId == 100 ){
nlapiSetLineItemValue('item', 'item', line, 1);
nlapiSetLineItemValue('item', 'units', line, 5); }
So: If the fake item (100) is in there, change it to the real item (1) and change the 'units' to '5' (which is the case).
What it does for REAL is: Ok, it DOES change the 'item' to 1 (great).. but it also picks the single unit price instead of the case (hm....), then it sets the 'units' to the case value (great). But that's all it does.. it does NOT fix the price to what it should be.
When I go in to the order afterwards and add an item, it fixes the other item (with the right units, but wrong price) automatically....
So my question is now:
1. Why does it change everything when I set the item sku, but NOT when I set the units?
2. How can I fix this?
I've tried to switch the two, so that it would perhaps recalculate when I set the sku.. but no. Didn't work.
I've tried to set the price level afterwards.. but no, didn't work either.
IMHO this should work as a beforesubmit script... am I wrong?