Developer forum

Forum » Integration » Caching of SalesDiscounts when import

Caching of SalesDiscounts when import

Andriy Kozachuk
Reply

Hello,

I am importing SalesDiscounts using SQL provider in Data Integration.

I am facing a caching problem: imported values are not available in the end-user front-end (system caches old discount values) until I make a website restart in the IIS.

Is it possible to clear discount cache without website restart?

All my discounts have type "Product discount" and are available for exactly 1 product, Sales discount value is "Percentage".

Some observations: if I change SalesDiscount percentage directly in the EcomSalesDiscount table of the database - I still see the old value in the front-end UI. If I do it in the back-end (Management center -> Ecommerce -> Orders -> Sales discounts) - new percentage is applied immediatelly.

DynamicWeb version is 8.8.1.6


Replies

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

Hi Andriy,
There is no Sales discounts cache clearing implemented. We will fix this in future versions.
For now as a workaround you could implement your own class that could susbsribe to the data integration "JobFinished" NotificationSubscriber and
inside the "OnNotify" method you should get any existing discount and save it again, this will clear the discounts cache:

var discounts = Dynamicweb.eCommerce.Orders.SalesDiscounts.getSalesDiscounts(eCommerce.International.Language.getLanguages().FirstOrDefault(l =>l.IsDefault));

if(discounts.Count() > 0)
{
discounts[0].Save();
}

Regards, Dmitrij

Votes for this answer: 1
 
Andriy Kozachuk
Reply

Thank you, I will go with this workaroud.

 

You must be logged in to post in the forum