Developer forum

Forum » Development » Data inserted into SQL is not updated in Administration

Data inserted into SQL is not updated in Administration

Peter Bille Larsen
Reply

Hi DWs

We have fabricated a custom module which make a discount code and insert this into the discount module (not the voucher module in DW8, the standard ecom discount module in DW7).

 

The problem is that the administration is not updated correctly, after the SQL insert, the discount code is not represented in the module, so the customer can not use the code, even though that the data is in the SQL.

 

Is there any way or any advice on how to refresh the data on that module, so that what is made in the SQL is show in the admin? At the moment we have to go into the module and fiddle manually with a test-discount and save it, and then all the data from the SQL insert is shown.

 

Support says that this problem is seen earlier? so has any one a quick fix I can send as a suggestion to the developers?

 

thanks
Peter

 


Replies

 
Morten Bengtson
Reply

Hi Peter,

 

Most content in eCommerce is cached in memory and usually there is a ClearCache method that you can call to clear the cache for a specific type of content, but for some reason this is marked as private on SalesDiscounts:

Dynamicweb.eCommerce.Orders.SalesDiscounts.SalesDiscount.ClearCache()

If Dynamicweb could just make this method public static (like it is on other classes) it would be a lot easier to clear the cache after importing data.

 

The best way to avoid problems like this is to use the API for saving content and not use SQL directly, but I understand why you do that because the API is not great for importing stuff.

 

Here are a few workarounds that you can try...

  • Request a page with refresh=ecommerce in the querystring.
  • Call the SalesDiscount.ClearCache instance method by using reflection.
  • Schedule the application pool to recycle after import (settings on application pool).

 

/Morten

 

 
Peter Bille Larsen
Reply

Hi Morten

Thanks for the awesome answer. Just one question. 

What kind of a page is that refresh=ecommerce, is that something I should build, or is it build in already?

//Thanks
Peter
 

 
Morten Bengtson
Reply

Hi Peter,

 

The refresh=ecommerce is a built in mechanism that can be used for clearing the cache, so you don't need to build it yourself.

 

The requested page could be any page that is using cached content from eCommerce (product catalog). It does not have to be a page that displays discounts. 

 

If you have your product catalog set up on page 123, the URL to request would be /Default.aspx?ID=123&refresh=ecommerce

 

/Morten

 

 

You must be logged in to post in the forum