Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Platform Deletes Similar Orderlines

Platform Deletes Similar Orderlines

Carolee Schuck
Reply

Hi,

A client (Hewitt) reported incomplete invoices displaying on their production website.  We can easily repro the problem on https://qa-walleye.dw-demo2.com (9.10.11) with the attached XML.

The XML includes 11 lines, all of which are valid:

  • 5 item lines, two pairs of which share the same ProductNumber, Qty, and other details but have unique OrderLineIds
  • 5 tax lines, one per item
  • 1 "tax over fees" line

The problem:

  • When two orderlines share the same ProductNumber and Qty, one of the orderlines is deleted despite it having a unique OrderLineId

Repro steps:

  1. Sign into the backend of https://qa-walleye.dw-demo2.com/Admin/access/default.aspx
  2. Go to Settings > Integration > Scheduled tasks
    1. Turn off the Import Invoices job
    2. Run the "Import Invoices - Invoice Bug Repro" job - this pulls data for a specific test case which the client reported
  3. Go to SQL Firehose and run this query:
    select * from EcomOrderLines where OrderLineOrderId = '175066' order by OrderLineId
    1. Confirm there are 5 item lines and 6 tax lines (5 item tax lines+ 1 fee tax line)
    2. Confirm that each item line has a unique OrderLineId
  4. Go to Ecommerce > Ledger > All ledgers
  5. Search for OrderId 175066
    1. Confirm the list of items includes only 3 items and 6 tax lines
  6. Return to SQL Firehose to rerun the query above
    1. Confirm there are only 3 item lines and 6 tax lines now - 2 item line records have been deleted
    2. Confirm the quantity for each line is 1 - the quantity from the deleted orderlines has not been added to the remaining orderlines

The above repro steps behaved identically on:

  1. qa-walleye after downgrading to 9.10.4
  2. https://dev-rapidrizzo34.mydwsite1.com/ (9.10.9)

Other notes:

  • The behavior was consistent over about a dozen repro attempts
    • One exception: in one instance, we viewed the ledger and found that only one line had been deleted.  SQL Firehose confirmed that.  When we viewed the ledger a second time, both lines had been deleted.
  • The behavior was consistent whether we imported via a scheduled task or from a file using the Import Invoice mapping Data Integration job.
    • We tried two Data Integration jobs - one using the EcomProvider, the other using the DynamicwebProvider

Let me know if I can provide any other details.  Thanks for your help!
Carolee


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Carolee,

 

The API is likely fighting with the data because you can't have 2 orderlines with the same ProductNumber and Quantity and expect them to be distinct. Although this is a ledger, it's using the concept of Carts and Orders. From that point of view, if you were navigating the product catalog and added 1 more quantity to the cart, which orderline would it pick?

 

To overcome that, you likely need something else to tell Dynamicweb that the orderlines are different from one another. DW's API also looks at the orderlines's UnitId and orderline custom fields to determine uniqueness (i.e. 1 case Wine is different than 1 bottle of Wine, assuming "case" and "bottle" are unitIds).

 

I can't speak into why it used to work, but sounds like you had some "bad data" before (the perceived duplicate lines) and maybe now that there has been some refactoring of the code making Ledger objects to use similar/same methods as Carts and Orders (because they share much of the same methods and data structure), the data issue has been exposed.

 

Hope that makes sense and helps you.

Nuno Aguiar

 
Carolee Schuck
Reply

Thanks, Nuno.  Your explanation makes sense... but I don't know of another database (granted my experience is limited) which determines uniqueness by any other means than primary key columns.

To answer your question: If I change the quantity on a line that would be deleted by the platform, the lines are then considered unqiue and neither is deleted.

Thanks again,

Carolee

 
Carolee Schuck
Reply

Hi Nuno,

As we discussed offline, this is an intentional combining of lines but a bug was introduced at some point because the quantities are not being combined, so we still need some help resolving the problem.

 
Carolee Schuck Dynamicweb Employee
Carolee Schuck
Reply

Hi Nuno and others,

This remains a problem.

I understand now that combining the lines is intentional, but it's not being done correctly.  The quantity of the lines should be combined, too.  Can this be logged as a bug, or is there some further exploration I need to do?

Thanks!

Carolee

 
Nicolai Pedersen
Reply

Hi Carolee

Yes, we can look into it.

One issue is correct combination of quantities.

We can also make a setting to not combine lines?

As it is now, if you define an orderline field and give them unique values, that will also keep DW from merging. Might be a workaround for now.

If you have other requests in this regard, please let us know so we can take it into consideration when looking into this.

Sorry about the inconvenience, Nicolai

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Carolee,
The issue is because the Dynamicweb Api checks for the orderlines per particular order if they are not doubled.
And the comparison is made on those fields:
ProductId
ProductVariantId
UnitId
ProductNumber
ProductName
DiscountId
RewardId
OrderId
OrderLineType
ParentLineId
OrderLineFieldValues
Bom
Date
Modified
Reference
The problem is because your deleted order lines are considered as a dupluicates since all ot their fields except OrderLineId are equal.
When the deletion happens it writes the information about that into the log in this folder:
/System/Log/Ecom/CartV2/DeletedDoubleOrderLines
Maybe you can somehow change some orderline custom field values or some other column value from the columns list above so your
imported OrderLines are then not cosidered as duplicates and will be then not deleted?
BR, Dmitrij

 
Carolee Schuck Dynamicweb Employee
Carolee Schuck
Reply

Hi Nicolai and Dmitriy,

We don't mind orderlines combining and, on other projects, have used the trick of a custom field to force lines to not combine, so I think all we need now is to have the bug addressed to make sure orderline quantity and price fields are combined when the lines combine.

Thanks, guys!

Carolee

 
Carolee Schuck Dynamicweb Employee
Carolee Schuck
Reply

Hi both,

Any update on my previous post?  

Thank you!

 
Nicolai Pedersen
Reply

Hi Carolee

The lines do not combine - duplicates are deleted. We have looked into this and there is no quickfix for this as the logic has to be completely re-written if it has to support combining lines instead  pf removing duplicates - and that would have big implications testing wise since a lot of solutions will potentially be affected, integrated solutions in particular. There are a lot of things to consider if digging into this - discounts, BOMs, giftcards and a swarm of other things that can go wrong. 

The only option right now is to decorate a custom field with something so that your duplicates are not handled as such. Or if they are duplicates, get them merged before sending them in.

I understand that this is not the solution you are looking for.

BR Nicolai

 
Carolee Schuck Dynamicweb Employee
Carolee Schuck
Reply

Thanks, Nicolai - I missed that in earlier posts.  We found a solution for Hewitt and are good to go!

 

You must be logged in to post in the forum