Developer forum

Forum » Development » Merging Product OrderLines

Merging Product OrderLines

Umar Farooq
Reply

Hi,

we have two parameters license (integer) and  subscription (integer)  and by summing them we get Quantity. While adding the product to cart dw create new product orderline if the quantity is different and if the Quantity is same then its merged into 1 orderline. Is this intended behaviour? are there any parameters on which DW makes a decision to merge or create new product orderline for same product?     

 

Best Regards,

Umar


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Umar,

Dynamicweb will try and combine orderlines that are the same. By "the same", I mean products have the same ID and is the same variant and has the same unit. In addition, it also checks for custom orderline fields. If all those values are the same, the orderlines are combined.

If you want to work around this, you can create a custom orderline field that you add a unique value to. That way Dynamicweb won't combine those lines.

- Jeppe

 
Nicolai Pedersen
Reply

Hi Umar

I am not sure I understand your question. If license and subscription are orderline fields (or Quantity is also a custom orderline field), then yes, seperate lines will be created if one of the fields are different. That is intended behavior.

If you add a product to the cart with cartcmd=add for the same productid and does this 2 or more times with different quantities, they will just be merged.

BR Nicolai

 
Umar Farooq
Reply

Hi Jeppe and Nicolai,

Thanks for clearification. It does make sense now and Yes, We do have Custom Orderline fields for licenses and its values can be different while adding product to cart. I think this can be handled through a line added notification subscriber and increase the quantity on existing Orderline and delete added one. Don't know what complications it can give but if you guys has any better solution then please let me hear

BR Umar

 

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Umar,

When Dynamicweb combines the orderlines, it doesn't change any other value than the Quantity field. If you need your custom fields increased as well, you need to do that manually. A notification subscriber would be ideal for that.

I'm not exactly sure what you're trying to achieve, but in most cases, a notification subscriber is the right way to go.

- Jeppe

 

You must be logged in to post in the forum