Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Order lines NOT combining

Order lines NOT combining

Carolee Schuck Dynamicweb Employee
Carolee Schuck


A client recently pointed out several order lines that are identical except for OrderLineId (very wide screenshot attached) in the database for

Here is one example:

  • select * from ecomorderlines where orderlineorderid = '176609' and orderlineproductnumber = 'lwwl'
  • select * from ecomorders where orderid = '176609'

You can see the data being imported with this request (XML response attached):

  • <GetEcomData Qty="1000" PrimaryKeyFilter="176609" CustomIdentifier="PROD" ReimportTable="false" ><tables><Invoices type="all"/></tables></GetEcomData>

Am I overlooking the reason these aren't being combined?

  • OrderLineId"><![CDATA[INV_176609_0000160000-INV
  • OrderLineId"><![CDATA[INV_176609_0000260000-INV




Nicolai Pedersen

The CanBeMerged method will return false if orderlineid is not the same... So I guess that is why.

Carolee Schuck Dynamicweb Employee
Carolee Schuck

Hi Nicolai,

I thought the later responses on all pointed to OrderLineId NOT being a field that indicates uniqueness when it comes to the decision of combining lines.

In particular, Dmitriy noted that "The problem is because your deleted order lines are considered as a dupluicates since all ot their fields except OrderLineId are equal."

Nicolai Pedersen

Hi Carolee

I might be confused and mess things up! Sorry.

There are 2 different scenarios. Carts and Orders.

When you add to cart, and you add a product that is already there, Dynamicweb creates a new orderline and ask the existing cart if that can be merged. Part of that is looking at the orderlineid. If the orderlineid matches or is empty (which is the case for brand new orderlines that are not yet persisted to db), and the content of the orderline is mergable (fields are the same etc), the orderlines are merged. This check happens in OrderlineService.CanBeMerged

When orders are loaded from database, the orderline loading will remove duplicates when they load because Dynamicweb sees that as an error. This process will not take a look at the orderlineid. This check is handled by Orderline.Equals.

So I might mess things up here.

But as I see it, if you do not add a product to cart, a Merge will never happen. Mergin is only part of cart commands.

If you never load from database, the delete will never happen.

So - I need to understand your flow a little more in depth and what you see, you did not expect. Where does all these extra lines come from - and do you want them to not be there or to be there - that is also a bit unclear for me... Are these orders loaded in live customer center and enver persisted, is it part of cart calculations or do you export them from ERP to DW and then later load them etc.

Sorry about the confusion!

BR Nicolai

Carolee Schuck Dynamicweb Employee
Carolee Schuck

Cleeeeeeearly my fault for missing a bunch of details!

This bug (I think it's a bug...) is occurring on batch-imported invoices, so it's not cart-related.

Bug 1 (from recent thread)

As I understand from our recent thread, the import process (or something related) will combine EcomOrderLines records if the data in a certain dozen-or-so fields is identical between the two (or more) lines.  The merge DOES happen as expected in some cases, although we've found that the quantity and prices do not likewise combine.  In other words, if the ERP invoices me for 1 each of ProductA on OrderLineId X plus 1 each of ProductA on OrderLineId Y, it will appear in DW that I was invoiced for a total of 1 ea of ProductA (instead of 2) for the price of 1 each.

Bug 2 (this thread)

This new possible bug comes from a client reporting that identical imported orderlines (which differ only in their OrderLineId) are NOT combining upon import from ERP as we told him should be expected.  

The flow for these invoices is:

  • Import from ERP to DW (source: XML; destination: EcomProvider)
  • Save to database
  • Display to signed in user when requested

With this background, does my original post make more sense?  Let me know if I missed filling in any details.



You must be logged in to post in the forum