Developer forum

Forum » Ecommerce - Standard features » Percentage product discount

Percentage product discount

Gaëtan Di Caro
Reply

Hello,

I need to import product discounts from an ERP into my solutions. They're very simple, i.e a certain percentage on a certain product for a certain period.

Before trying to import them I tried creating an order discount to check the database structure so I can import into it correctly. However, I simply can't get the discount to work. It doesn't show up at all in my template tags.

It may be of notice that the products don't have a base price : all the prices are imported separately (but I wouldn't think it affects the discount).

 

Did I miss something ? How do I get it to work ?

 

Thanks.

2017-10-23_08_56_57-Program_Manager.png 2017-10-23_08_57_07-Lene_Bjerre.png

Replies

 
Gaëtan Di Caro
Reply

Here are the price of the product, and the discount I can see is part of the product.

2017-10-23_10_18_08-Lene_Bjerre.png 2017-10-23_10_18_24-Lene_Bjerre.png
 
Gaëtan Di Caro
Reply

Ok somehow I got it to work but I think my issue has something to do with caching... If I delete the discount from the database (empty the tables EcomDiscount and EcomDiscountTranslation, which is what would happen on integration), the discount still appears in the backend and is still applied in the frontend. How do I force an update ?

Edit : it seems that the discounts are updated when I do something in the "Order Discounts" in the backend. How can I have the same thing fire after my integration ?

 
Gaëtan Di Caro
Reply

I notice that this cache is also updated if I restart the IIS server,. Nothing happens if I build the product index though.

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

Hi Gaƫtan,
you could write the notification subscriber to the Dynamicweb.DataIntegration.Integration.Notifications.Integration.JobFinished notification
and in the Notify method you just call:
Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.ClearCache()
Or
Dynamicweb.Ecommerce.Orders.Discounts.Discount.ClearCache() (this one is obsoleted in the most recent version of Ecom package)
Regards, Dmitrij

Votes for this answer: 1
 
Gaëtan Di Caro
Reply

Nice, thanks. Could be nice to have those cache clearing options directly in the data integration.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

TFS# 41169 created for that.

 
Gaëtan Di Caro
Reply

Thanks. We have a lot of push from customers to integrate in DW the discounts that they set up in their ERP. Anything that makes it easier is welcome.

 

You must be logged in to post in the forum