Developer forum

Forum » Integration » Live Prices based on unit with linediscount

Live Prices based on unit with linediscount

Marie Louise Veigert
Reply

Hi,

We have a customer, whom have products which have different settings based on:

1) Unit (KG, PS, KRT etc)

2) Discount or not -> In this case linediscount

We are calling the prices with liveintegration.
The settings are as follows. For the record, the prices and discounts show correct in the cart:


It seems like it doesnt take into account which unit is on the product or called. 
Do we have some documentation on how to set this correct up? 

We are in a DynamicWeb 9.15.7 and using an older Swift.

BR
Marie Louise


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Marie,

it is a bit unclear what is your problem. Does it mean that it works fine for the product with unit when it is added to the cart (correct prices)?
And it doesn't show you the price with discount per unit on the product detail/product list page?
Can you supply a sample request xml that you sent and which does not work?
Here is a request for importing units.
BR, Dmitrij

 
Marie Louise Veigert
Reply

Hi,

I have an example here. (Product number removed for the post here)

Request:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<GetEcomData ExternalUserId="1111" AccessUserCustomerNumber="1111" VatCountryCode="DK" VatPostingGroup="">
  <tables>
    <Products type="filter" unitPrices="true">
      <Product>
        <ProductId>111xxx</ProductId>
        <ProductVariantId></ProductVariantId>
        <ProductNumber>xxxx</ProductNumber>
        <ProductUnitId>Unit_PS</ProductUnitId>
        <ProductIdentifier>1111xxx..DAN</ProductIdentifier>
        <CurrencyCode>DKK</CurrencyCode>
        <Quantity>1</Quantity>      
      </Product>
    </Products>
  </tables>
</GetEcomData>

 Response:

<?xml version="1.0" encoding="utf-8"?>
<tables version="1.2.0.18_NAV10.0.23563">
    <table tableName="EcomProducts">
        <item table="EcomProducts">
            <column columnName="ProductId"><![CDATA[111xxx]]></column>
            <column columnName="ProductVariantId"><![CDATA[]]></column>
            <column columnName="ProductIdentifier"><![CDATA[111xxx..DAN]]></column>
            <column columnName="ProductNumber"><![CDATA[111xxx]]></column>
            <column columnName="ProductName"><![CDATA[Artnok Original 1kg]]></column>
            <column columnName="ProductCurrencyCode"><![CDATA[DKK]]></column>
            <column columnName="ProductDefaultUnitId"><![CDATA[Unit_PS]]></column>
        </item>
    </table>
    <table tableName="EcomPrices">
        <column columnName="PriceAmount"><![CDATA[91.7]]></column>
        <column columnName="PriceAmountWithVat"><![CDATA[114.625]]></column>
        <item table="EcomPrices">
            <column columnName="PriceProductId"><![CDATA[111xxx]]></column>
            <column columnName="PriceUserCustomerNumber"><![CDATA[1111]]></column>
            <column columnName="PriceProductUnitId"><![CDATA[Unit_1/1 PL]]></column>
            <column columnName="PriceQuantity"><![CDATA[288]]></column>
            <column columnName="PriceAmount"><![CDATA[37,728]]></column>
            <column columnName="PriceAmountWithVat"><![CDATA[47,160]]></column>
        </item>
        <item table="EcomPrices">
            <column columnName="PriceProductId"><![CDATA[111xxx]]></column>
            <column columnName="PriceUserCustomerNumber"><![CDATA[1111]]></column>
            <column columnName="PriceProductUnitId"><![CDATA[Unit_KG]]></column>
            <column columnName="PriceQuantity"><![CDATA[1]]></column>
            <column columnName="PriceAmount"><![CDATA[131]]></column>
            <column columnName="PriceAmountWithVat"><![CDATA[163.75]]></column>
        </item>
        <item table="EcomPrices">
            <column columnName="PriceProductId"><![CDATA[111xxx]]></column>
            <column columnName="PriceUserCustomerNumber"><![CDATA[1111]]></column>
            <column columnName="PriceProductUnitId"><![CDATA[Unit_KRT]]></column>
            <column columnName="PriceQuantity"><![CDATA[6]]></column>
            <column columnName="PriceAmount"><![CDATA[786]]></column>
            <column columnName="PriceAmountWithVat"><![CDATA[982.5]]></column>
        </item>
        <item table="EcomPrices">
            <column columnName="PriceProductId"><![CDATA[111xxx]]></column>
            <column columnName="PriceUserCustomerNumber"><![CDATA[1111]]></column>
            <column columnName="PriceProductUnitId"><![CDATA[Unit_PS]]></column>
            <column columnName="PriceQuantity"><![CDATA[1]]></column>
            <column columnName="PriceAmount"><![CDATA[91.7]]></column>
            <column columnName="PriceAmountWithVat"><![CDATA[114.625]]></column>
        </item>
    </table>
</tables>

The result should be something with the following, which are in the cart (productNumber removed again):

   <table tableName="EcomOrderLines">
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[111xxx]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[]]></column>
            <column columnName="OrderLineId"><![CDATA[10000]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[1]]></column>
            <column columnName="OrderLineType"><![CDATA[0]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[131]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[131.00]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[163.75]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[163.75]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[32.75]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[32.75]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25]]></column>
            <column columnName="OrderLineGrossUnitPriceWithoutVat"><![CDATA[131]]></column>
        </item>
        <item table="EcomOrderLines">
            <column columnName="OrderLineProductNumber"><![CDATA[111xxx]]></column>
            <column columnName="OrderLineProductVariantId"><![CDATA[]]></column>
            <column columnName="OrderLineParentLineId"><![CDATA[10000]]></column>
            <column columnName="OrderLineType"><![CDATA[3]]></column>
            <column columnName="OrderLineQuantity"><![CDATA[1]]></column>
            <column columnName="OrderLinePriceWithoutVat"><![CDATA[39.30]]></column>
            <column columnName="OrderLineUnitPriceWithoutVat"><![CDATA[39.30]]></column>
            <column columnName="OrderLinePriceWithVat"><![CDATA[49.13]]></column>
            <column columnName="OrderLineUnitPriceWithVat"><![CDATA[49.13]]></column>
            <column columnName="OrderLineDiscountPercentage"><![CDATA[30]]></column>
            <column columnName="OrderLinePriceVat"><![CDATA[9.83]]></column>
            <column columnName="OrderLineUnitPriceVat"><![CDATA[9.83]]></column>
            <column columnName="OrderLinePriceVatPercent"><![CDATA[25]]></column>
            <column columnName="OrderLineUnitPriceVatPercent"><![CDATA[25]]></column>
        </item>
    </table>

Looks like Im not getting the discount on the productpage step.

BR
Marie Louise

 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Marie,
this bug was fixed in the D365BC extension but it wasn't merged down to NAV codeunits. Which version of NAV are you using?
BR, Dmitrij

 
Marie Louise Veigert
Reply

Hi again,

1.2.0.18_NAV2017

 

BR, Marie Louise

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Marie,
can you try to install the newer version 1.2.0.20 and check if it works?
BR, Dmitrij

 
Marie Louise Veigert
Reply

The codeunit have been modified a lot, but they have now tried to update the price part of it.

How should the response xml look like for DW to be able to show the discount etc?

BR
Marie Louise

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Marie,
the response xml has not changed, it will respect the unitId passed in the GetProductInfo request, so it will calculate the lowest price in the same way as in the Cart calculation.
BR, Dmitrij

 
Marie Louise Veigert
Reply

Okay because it looks like I still get the wrong price from NAV. The one before discount.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Marie,
have you used our standard codeunit 1.2.0.20 without any custom changes/merges on your NAV server side?
Does it work in the cart calculate/create order requests?
BR, Dmittrij

 

You must be logged in to post in the forum