Tuesday, July 12, 2011

Multiple fulfillment center | Remove the default override

When designing certain eCommerce applications, some businesses have multiple fulfillment centers to choose from and this choice is some times provided to the customers.

Commerce by default overrides the FFMCENTER_ID (fulfillment center) information with the default STORE.FFMCENTER_ID, during order item add functionality.

If you want this value to be not overridden and manually given into the order tunnel commands.
In the ORDERITEMS.PREPAREFLAGS. 3rd bit needs to set.

By default, the prepared flags value is 2048 (100000000000) Binary. Setting the 3rd bit to 1 becomes
(100000000100) =2048+4=2052

int currentPrepFlag =orderItems[i].getPrepareFlagsInEJBType().intValue();
currentPrepFlag |=OrderConstants.PREPAREFLAGS_FULFILLMENT_CENTER_OVERRIDE;
orderItems[i].setPrice(String.valueOf(finalprice));
orderItems[i].setPrepareFlags(new Integer(currentPrepFlag ));
orderItems[i].commitCopyHelper();


No comments:

Post a Comment