Developer forum

Forum » Integration » Order Line discount totals being set to 0

Order Line discount totals being set to 0

Chris Søgaard
Chris Søgaard
Reply

Hi DW

We have a weird problem with order line discount on a solution running DW 9.14.1 and using BC14 Plug-In unit version 1.2.0.23 and live integration (live integration version 7.0.3).

When calculating orders/carts that includes order line discount it seems that the total price for the specific order line discount is always set to 0. This gives us some problems when rendering in the frontend because it seems like the order line does not have any discount.

After the order has been calculated in BC all "Total" columns on the order line with discount type is set to 0. This is a snap from the current database:

And this results in this view in the backend where there's no total price on the order line with discount type:

The funny thing here is that I have tried to hook onto the notification subscriber "OnAfterSendingOrderToErp" and the order object here seem to have the values set correctly on the properties "Price" and "UnitPrice", so the problem does not seem to be in the Plug-In unit, and the XML also seem to reflect the correct values. So this is probably an issue that occurs after the order has been calculated at the ERP.

I have tried updating the values in the database and recalculating the cart once again, but then the values are 0 once again, so it seems like there's something under the hood, that explicitly sets these values to 0 in this specific case.

BR Chris


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi Chris,

What does the request/response from the Live Integration log say (\Files\System\Log\LiveIntegration\) ?

/snedker

 
Chris Søgaard
Chris Søgaard
Reply

Hi Morten

This is the request (removed customer specific data from order data), using the same cart but increasing quantity:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tables source="LiveIntegration" submitType="LiveOrderOrCart" referenceName="OrdersPut">
    <table tableName="EcomOrders">
        <item table="EcomOrders">
            <column columnName="OrderCustomerAccessUserExternalId">CDK-004130</column>
            <column columnName="OrderCustomerName"></column>
            <column columnName="OrderCustomerAddress2"></column> 
            <column columnName="OrderCustomerState"></column>
            <column columnName="OrderCustomerCountryCode"></column>
            <column columnName="OrderCustomerFax"></column>
            <column columnName="OrderCustomerComment"></column>
            <column columnName="OrderCustomerFirstName"></column>
            <column columnName="OrderCustomerSurname"></column>
            <column columnName="OrderCustomerRefId"></column>
            <column columnName="OrderDeliveryEmail"></column>
            <column columnName="OrderDeliveryPhone"></column>
            <column columnName="OrderDeliveryFax"></column>
            <column columnName="CreateOrder">False</column>
            <column columnName="OrderId">ORDER421</column>
            <column columnName="OrderAutoId">42</column>
            <column columnName="OrderIntegrationOrderId"></column>
            <column columnName="OrderCurrencyCode">DKK</column>
            <column columnName="OrderDate">2022-09-30T12:10:43</column>
            <column columnName="OrderPaymentMethodName" isInformationalOnly="True">Standard payment</column>
            <column columnName="OrderPaymentMethodId">PAY5</column>
            <column columnName="OrderPaymentMethodCode">Invoice</column>
            <column columnName="OrderPaymentMethodTermsCode"></column>
            <column columnName="OrderShippingDate"></column>
            <column columnName="OrderReference"></column>
            <column columnName="OrderShippingMethodName" isInformationalOnly="True">BC Customers</column>
            <column columnName="OrderShippingMethodId">SHIP7</column>
            <column columnName="OrderShippingFee">0</column>
            <column columnName="OrderShippingFeeWithoutVat">0</column>
            <column columnName="OrderShippingItemType">ItemCharge</column>
            <column columnName="OrderShippingItemKey">DW-SHIP</column>
            <column columnName="OrderShippingCode">BCShipping</column>
            <column columnName="OrderShippingAgentCode"></column>
            <column columnName="OrderShippingAgentServiceCode"></column>
            <column columnName="OrderPriceTotal">0</column>
            <column columnName="OrderCaptureAmount">0</column>
            <column columnName="OrderVoucherCode"></column>
            <column columnName="OrderTransactionId"></column>
            <column columnName="OrderStateId">OS1</column>
            <column columnName="OrderStateName" isInformationalOnly="True"></column>
            <column columnName="ErpControlsDiscount">True</column>
            <column columnName="VatCountryCode">DK</column>
            <column columnName="VatPostingGroup"></column>
            <column columnName="OrderShippingAgent" isCustomField="True"></column>
        </item>
    </table>
    <table tableName="EcomOrderLines">
        <item table="EcomOrderLines">
            <column columnName="OrderLineId">OL12694</column>
            <column columnName="OrderLineOrderId">ORDER421</column>
            <column columnName="OrderLineParentLineId"></column>
            <column columnName="OrderLineProductId">0784102000</column>
            <column columnName="OrderLineProductVariantId">0784102000</column>
            <column columnName="OrderLineProductNumber">0784102000</column>
            <column columnName="OrderLineProductName">Rørstuds 12L x 1/4" 19TPI BSP med PEFLEX tætningsring - Stål</column>
            <column columnName="OrderLineProductIdentifier">0784102000.0784102000.LANG2</column>
            <column columnName="OrderLineQuantity">6</column>
            <column columnName="OrderLineUnitId"></column>
            <column columnName="OrderLinePriceWithoutVat">103.62</column>
            <column columnName="OrderLineUnitPriceWithoutVat">17.27</column>
            <column columnName="NetPrice">0</column>
            <column columnName="OrderLineType">0</column>
            <column columnName="OrderLineTypeName">Product</column>
            <column columnName="OrderLineBom">False</column>
            <column columnName="OrderLineBomItemId"></column>
            <column columnName="OrderLineGiftCardCode"></column>
            <column columnName="OrderLineIsGiftCardDiscount" isCustomField="True">False</column>
            <column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection /&gt;</column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineId">OL12699</column>
            <column columnName="OrderLineOrderId">ORDER421</column>
            <column columnName="OrderLineParentLineId"></column>
            <column columnName="OrderLineProductId">0003152100</column>
            <column columnName="OrderLineProductVariantId">0003152100</column>
            <column columnName="OrderLineProductNumber">0003152100</column>
            <column columnName="OrderLineProductName">Omløber møtrik 08LL - Stål</column>
            <column columnName="OrderLineProductIdentifier">0003152100.0003152100.LANG2</column>
            <column columnName="OrderLineQuantity">8</column>
            <column columnName="OrderLineUnitId"></column>
            <column columnName="OrderLinePriceWithoutVat">17.61</column>
            <column columnName="OrderLineUnitPriceWithoutVat">2.2</column>
            <column columnName="NetPrice">0</column>
            <column columnName="OrderLineType">0</column>
            <column columnName="OrderLineTypeName">Product</column>
            <column columnName="OrderLineBom">False</column>
            <column columnName="OrderLineBomItemId"></column>
            <column columnName="OrderLineGiftCardCode"></column>
            <column columnName="OrderLineIsGiftCardDiscount" isCustomField="True">False</column>
            <column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection /&gt;</column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineId">OL12706</column>
            <column columnName="OrderLineOrderId">ORDER421</column>
            <column columnName="OrderLineParentLineId">OL12694</column>
            <column columnName="OrderLineProductId"></column>
            <column columnName="OrderLineProductVariantId"></column>
            <column columnName="OrderLineProductNumber"></column>
            <column columnName="OrderLineProductName">Discount</column>
            <column columnName="OrderLineProductIdentifier">..</column>
            <column columnName="OrderLineQuantity">1</column>
            <column columnName="OrderLineUnitId"></column>
            <column columnName="OrderLinePriceWithoutVat">-119.25</column>
            <column columnName="OrderLineUnitPriceWithoutVat">-119.25</column>
            <column columnName="NetPrice"></column>
            <column columnName="OrderLineType">3</column>
            <column columnName="OrderLineTypeName">ProductDiscount</column>
            <column columnName="OrderLineBom">False</column>
            <column columnName="OrderLineBomItemId"></column>
            <column columnName="OrderLineGiftCardCode"></column>
            <column columnName="OrderLineIsGiftCardDiscount" isCustomField="True">False</column>
            <column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection /&gt;</column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineId">OL12707</column>
            <column columnName="OrderLineOrderId">ORDER421</column>
            <column columnName="OrderLineParentLineId">OL12699</column>
            <column columnName="OrderLineProductId"></column>
            <column columnName="OrderLineProductVariantId"></column>
            <column columnName="OrderLineProductNumber"></column>
            <column columnName="OrderLineProductName">Discount</column>
            <column columnName="OrderLineProductIdentifier">..</column>
            <column columnName="OrderLineQuantity">1</column>
            <column columnName="OrderLineUnitId"></column>
            <column columnName="OrderLinePriceWithoutVat">-24.31</column>
            <column columnName="OrderLineUnitPriceWithoutVat">-24.31</column>
            <column columnName="NetPrice"></column>
            <column columnName="OrderLineType">3</column>
            <column columnName="OrderLineTypeName">ProductDiscount</column>
            <column columnName="OrderLineBom">False</column>
            <column columnName="OrderLineBomItemId"></column>
            <column columnName="OrderLineGiftCardCode"></column>
            <column columnName="OrderLineIsGiftCardDiscount" isCustomField="True">False</column>
            <column columnName="OrderLineFieldValues">&lt;OrderLineFieldValueCollection /&gt;</column>
        </item>
    </table>
    <table tableName="EcomOrderLineFields" />
</tables>

And this is the response, which does include totals for order line with discount types:

<?xml version="1.0" encoding="utf-8"?>
<tables version="1.2.0.23_NAV14.17.44663">
    <table tableName="EcomOrderLines">
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[0784102000]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[0784102000]]></column>
            <column columnName="OrderLineId"><![CDATA[10000]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[6]]></column>
            <column columnName="OrderLineType"><![CDATA[0]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[246.72]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[41.12]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[308.40]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[51.40]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[61.68]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[10.28]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25.00]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25.00]]></column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[0784102000]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[0784102000]]></column>
            <column columnName="OrderLineParentLineId"><![CDATA[10000]]></column>
            <column columnName="OrderLineType"><![CDATA[3]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[1]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[143.10]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[143.10]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[178.88]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[178.88]]></column>
            <column columnName="OrderLineDiscountPercentage"><![CDATA[58.00]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[35.78]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[35.78]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25.00]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25.00]]></column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[0003152100]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[0003152100]]></column>
            <column columnName="OrderLineId"><![CDATA[20000]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[8]]></column>
            <column columnName="OrderLineType"><![CDATA[0]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[41.92]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[5.24]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[52.40]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[6.55]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[10.48]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[1.31]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25.00]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25.00]]></column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[0003152100]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[0003152100]]></column>
            <column columnName="OrderLineParentLineId"><![CDATA[20000]]></column>
            <column columnName="OrderLineType"><![CDATA[3]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[1]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[24.31]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[24.31]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[30.39]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[30.39]]></column>
            <column columnName="OrderLineDiscountPercentage"><![CDATA[58.00]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[6.08]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[6.08]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25.00]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25.00]]></column>
        </item>
    </table>
    <table tableName="EcomOrders">
        <item table="EcomOrders">
            <column columnName="OrderShippingMethodName"><![CDATA[BC Customers]]></column>
            <column columnName="OrderShippingMethodId"><![CDATA[SHIP7]]></column>
            <column columnName="OrderShippingFee"><![CDATA[0]]></column>
            <column columnName="OrderCreated"><![CDATA[TRUE]]></column>
            <column columnName="OrderId"><![CDATA[]]></column>
            <column columnName="OrderCurrencyCode"><![CDATA[]]></column>
            <column columnName="OrderDate"><![CDATA[]]></column>
            <column columnName="OrderPaymentMethodName"><![CDATA[]]></column>
            <column columnName="OrderCustomerName"><![CDATA[]]></column>
            <column columnName="OrderCustomerAddress2"><![CDATA[]]></column>
            <column columnName="OrderCustomerEmail"><![CDATA[]]></column>
            <column columnName="OrderCustomerFax"><![CDATA[]]></column>
            <column columnName="OrderCustomerPhone"><![CDATA[]]></column>
            <column columnName="OrderDeliveryAddress2"><![CDATA[]]></column>
            <column columnName="OrderDeliveryEmail"><![CDATA[]]></column>
            <column columnName="OrderDeliveryFax"><![CDATA[]]></column>
            <column columnName="OrderDeliveryPhone"><![CDATA[]]></column>
            <column columnName="OrderPriceWithVat"><![CDATA[151.54]]></column>
            <column columnName="OrderPriceWithoutVat"><![CDATA[121.23]]></column>
            <column columnName="OrderPriceVat"><![CDATA[30.31]]></column>
            <column columnName="OrderSalesDiscount"><![CDATA[167.41]]></column>
        </item>
    </table>
</tables>
 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply

Hi Chris,

If you pass me a URL for the solution I will try with a review of settings. If this is okay, can you send me user/password for the user you are using in your example (or another test-user alternatively), so I can test it myself? You may send it to msn@dynamicweb.dk

/Snedker

 
Chris Søgaard
Chris Søgaard
Reply

Hi Morten

Thank you, I have sent you some information.

BR Chris

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Chris

The problem #10576 on ERP discounts handling in LiveIntegration version 7

has been fixed in Dynamicweb 9.14.4

Get this from the download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Kind Regards
Care Support
Kristian Kirkholt

Votes for this answer: 1

 

You must be logged in to post in the forum