Developer forum

Forum » Integration » Line discount specified on each order line

Line discount specified on each order line

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

We are using the Business Central integration plugin do handle discounts in the shopping basket.
The discounts are calculated correctly, but our client would like the line discounts to be specified on each line, instaead of as a total at the bottom.

Is this possible through configuration, or does it have to be extended?


Replies

 
Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Martin,
it is not clear what discounts do you mean exactly. Is it Dynamicweb that calculates the discounts or BC calculates the discounts?
Kind regards, Dmitrij

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Sorry, thought I was clear. It is BC that calculates the discounts.
All the discounts are correct, but they are accumulated, and added to a single discount at the bottom with the totals.
Our client would like them to be specified on each line.
 

 
Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Martin,
it is designed so Product discounts are applied on each order line and are returned from ERP with OrderLineParentLineId not empty and OrderLinType=3.
The total order or Invoice discounts are applied per order, so just one discount order line is generated for that with no OrderLineParentLineId and OrderLineType=1.
Could you check your xml responses from ERP if it works the same? Maybe something else is then makes the lines grouping.
What extension version are you using?
Note that invoice discount may appear differently, so BC can spread this kind of a discount amoung other order lines, while Dynamicweb has special OrderDiscount order line for that.
Kind regards, Dmitrij

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

It looks like this might be related to us having two live integrations conencted to the same solution.
We have separated them both by renaming in LiveSalesDiscountProvider.cs and created two discounts in ecommerce admin like stated here:
https://doc.dynamicweb.com/documentation-9/integration/integration-framework-2/live-integration#sideNavTitle1-3-1

It is now showing separate discount lines, but they are all comming at the bottom, after all regular order lines.

We also have different product number and product id. The product id is prefixed, in order to separate the two integrations.
Might be something related to this. Think the discount and product lines is not matched together.

 
Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Martin,
having different product id and number might be an issue. So when there ERP sends xml with discount order line there is some value in the
column [@columnName='OrderLineProductNumber']" field and it is then used in the Live integration to find the parent order line by checking the orderline.ProductId value.
So it looks like in your case it doesn't find the parent order line and that is why shows in the bottom.
Try to check the live integration requests and responses xmls.
Kind regards, Dmitrij

Votes for this answer: 1
 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

You are correct Dmitriy, the live integration was comparing product number against id.
Maybe there should have been a check related to this? If the "Use product number in order calculation" is ticked off it should also compare against number not id?

I changed it here, from ProductId to ProductNumber in order for it to work.

 
Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Martin,
thx for sharing this, yes, this makes sense, we will look to fix that.
Kind regards, Dmitrij

 
Dan Kristensen Hørlyck Dynamicweb Employee
Dan Kristensen Hørlyck
Reply

Great job Martin. Thanks for helping us out.

 

You must be logged in to post in the forum