Developer forum

Forum » Integration » Stock location cache

Stock location cache

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

On a 9.18 solution I am importing stock into EcomStockUnit. That all works OK except that the backend doesn't show the correct numbers after import. It seems to be cache as I can get the correct numbers to show up when I:

1. Run the import job
2. Find the relevant product in the backend and open the Stock matrix
3. Confirm the correct numbers are there for each variant. Open a single variant's stock details screen and hit Save and close
4. Close the Stock screen and then hit Save and Close for the Product screen also.

It looks like I have to click Save and Close for both the stock level and the product to get the correct stock.

I tried clearing all caches under Settings I could think of (all the Stock ones and the Product ones) but stock won't be correct until I go through the steps above.

Is data cached in another location / cache that I can't see or clear from the backend?

Imar

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
can you check if you don't have enabled the option ""Disable cache clearing"" in the provider?
I can get it working with inserting the data into the EcomStockUnit table using sql and calling the "StockUnitService" -> refresh from the Settings.
The call for the clearing this service cache is included into the DW/Sql/Ecom providers but only when the rows were imported, so maybe no new rows inserted/updated/deleted?
BR, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yeah, I have that unchecked. But it's also not clearing when I refresh the EcomStockUnit cache directly from the backend.

I sent you an animation by email that shows the following:

1. Stock on the frontend is zero
2. Stock in the database is 7
3. Stock on the product in the backend is 7
4. Refreshing EcomStockUnit doesn't change the stock
5. Going in to the stock entry, hitting Save and close for the Stock and then for the Product does clear the cache, and the next reload of the frontend then shows the correct value.

Am I missing something? Is there another cache?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Imar,
still can not reproduce the issue, tried on the local copied website and also on your current site. Here are mine steps:

1) load the page with a product on the frontend and check the qty for the first variant 'VARGRP3868_S10_100' is 7
2) run sql query in backend: 
update EcomStockUnit set StockUnitQuantity = 8 where StockUnitProductId='prod4721' and StockUnitVariantId = 'VARGRP3868_S10_100'
3) clear service cache: Cache->ServiceCashes->StockUnitService -> Refresh

4) refresh the page from 1 and now 8 is shown instead of 7
5) run the query:
update EcomStockUnit set StockUnitQuantity = 7 where StockUnitProductId='prod4721' and StockUnitVariantId = 'VARGRP3868_S10_100'
6) clear StockUnitService
7) refresh the page from 1 and now 7 is shown as it was initially
Maybe it is some browser cache? How do you setup the stock in the database: sql or data integration import job?
BR, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitrij,

Were you ever able to find out more about this after I sent you the repro steps?

Thanks!

Imar

 

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

Hi Imar,
The problem is now solved. It was connected with the field "ProductUnitCounter" from the "EcomProducts" table.
So if this field has a value of zero then the Stock is not shown on the frontend.
When you import the new rows into the EcomStockUnit table then the field ProductUnitCounter for the EcomProducts needs to be updated as well.
You can just update all the needed products with one single sql query that will set the ProductUnitCounter=1 and clear the ProductService cache after and check if the problem is fixed.

It is fixed in DW10 and we will merge it to DW9 too.

BR, Dmitrij

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks for that! That indeed fixed the issue. Interestingly enough, it’s something we discussed earlier in June last year: https://doc.dynamicweb.com/forum/ecommerce-standard-features/ecommerce-standard-features/unitcount-on-a-product

The fix never made it to DW 9 unfortunately. I manually fixed it then with the same query as you show below, and updated integration jobs to hardcode the counter value to 1. But it turned out that the customer is using other integration jobs (PIM import and export) to bring over products from their old site and these jobs / source files don’t have a value for ProductUnitCounter, causing it to default to 0 and causing stock not to be shown until you save the product.

Thank you for your investigation, again!

 

You must be logged in to post in the forum