Developer forum

Forum » Integration » Custom price provider and bulk prices

Custom price provider and bulk prices

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I am building an integration against a custom end point. I've configured LI and can see it makes successful requests; the response then contains multiple prices for different quantities. When I output the prices from product.Prices I can see all the quantity breaks. However, when I add a product to the cart with a specific quantity, the price is not respected. Here's what LI sends:

<GetEcomData ExternalUserId="aaa" AccessUserCustomerNumber="aaa" VatCountryCode="GB" VatPostingGroup="">
  <tables>
    <Products type="filter">
      <Product>
        <ProductId>10089</ProductId>
        <ProductVariantId></ProductVariantId>
        <ProductNumber>10089</ProductNumber>
        <ProductUnitId></ProductUnitId>
        <ProductIdentifier>10089..ENU</ProductIdentifier>
        <CurrencyCode></CurrencyCode>
        <Quantity>7</Quantity>
      </Product>
    </Products>
  </tables>
</GetEcomData>

The response then looks as follows:

<tables>
  <table tableName="EcomProducts">
    <item table="EcomProducts">
      <column columnName="ProductId"><![CDATA[10089]]></column>
      <column columnName="ProductVariantId"><![CDATA[]]></column>
      <column columnName="ProductIdentifier"><![CDATA[10089..ENU]]></column>
      <column columnName="ProductNumber"><![CDATA[10089]]></column>
      <column columnName="ProductName"><![CDATA[ATHEN Skuffemodul]]></column>
      <column columnName="ProductPrice"><![CDATA[1800]]></column>
      <column columnName="ProductStock"><![CDATA[254]]></column>
      <column columnName="ProductCurrencyCode"><![CDATA[EUR]]></column>
      <column columnName="ProductDefaultUnitId"><![CDATA[]]></column>
    </item>
  </table>
  <table tableName="EcomPrices">
    <item table="EcomPrices">
      <column columnName="PriceProductId"><![CDATA[10089]]></column>
      <column columnName="PriceUserCustomerNumber"><![CDATA[]]></column>
      <column columnName="PriceProductUnitId"><![CDATA[]]></column>
      <column columnName="PriceQuantity"><![CDATA[6]]></column>
      <column columnName="PriceAmount"><![CDATA[1200]]></column>
      <column columnName="ProductIdentifier"><![CDATA[10089..ENU]]></column>
      <column columnName="ProductNumber"><![CDATA[10089]]></column>
    </item>
    <item table="EcomPrices">
      <column columnName="PriceProductId"><![CDATA[10089]]></column>
      <column columnName="PriceUserCustomerNumber"><![CDATA[]]></column>
      <column columnName="PriceProductUnitId"><![CDATA[]]></column>
      <column columnName="PriceQuantity"><![CDATA[10]]></column>
      <column columnName="PriceAmount"><![CDATA[1100]]></column>
      <column columnName="ProductIdentifier"><![CDATA[10089..ENU]]></column>
      <column columnName="ProductNumber"><![CDATA[10089]]></column>
    </item>
  </table>
</tables>

When I add 6 to the cart, I'd expect the total price to be 7200, but yet I get 10800 (6 x 1800 of the base price).

Should I maybe update the price in EcomProducts to match the quantity specified in the request? Or do I need to do something else to make it work?

Thanks!

Imar

 

 

 



 

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
could you also implement the Dynamicweb.Ecommerce.Prices.IPriceInfoProvider interface in your custom price provider?
And then have implemented the methods that should return the correct price based on quantity:
public PriceInfo FindPriceInfo(PriceContext context, PriceProductSelection selection)
IEnumerable<KeyValuePair<PriceQuantityInfo, PriceInfo>> IPriceInfoProvider.FindQuantityPriceInfos(PriceContext context, Product product)

If that will not help then there is ability to have a custom cart calculation provider by inheriting from: Dynamicweb.Ecommerce.Cart.CartCalculationProvider.

BR, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitriy,

>> could you also implement the Dynamicweb.Ecommerce.Prices.IPriceInfoProvider interface in your custom price provider?

I could, but should I? Currently, I don't have any custom provider at all. I am trying to make it work with the standard LI package and just responses from a custom ERP. I.e:

DynamicWeb LI => Connector Service => Custom connector => ERP

My goal is to have the custom connector connect to the ERP, fetch data and then return XML in a format that LI standard supports. So, I am trying to mimic the behavior of the various ERP code units.

>> If that will not help then there is ability to have a custom cart calculation provider by inheriting from: Dynamicweb.Ecommerce.Cart.CartCalculationProvider.
Same thing there: do I have to implement that or could I rely on the standard functionality?

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Guess I caused the confusion myself with this subject:

>> Custom price provider and bulk prices

That should have  read: Custom connector and bulk prices

Imar

 

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

Hi Imar,
in that case there are two possible approaches. In our default ERP implementation for the F&O/NAV/BC it returns the correct price based on the request <Quantity> value, so it takes its value into account and calculates the lowest possible price for that and sends it back in the EcomProducts/ProductPrice tag, so in your case the response for the <ProductPrice> needs to be 1200, not 1800.

The other way could be for the ERP implementation don't send any value in the <ProductPrice> tag, so leave it empty, then include the default price for Quantity=1 in the EcomPrices list, then the Live Integration PriceProvider should pickup the correct price based on the orderline Quantity.
I would recommend to follow the first approach as it is working like that today.
BR, Dmitrij

Votes for this answer: 1

 

You must be logged in to post in the forum