Developer forum

Forum » Ecommerce - Standard features » Facet count dont update after product delete

Facet count dont update after product delete

Kasper Legarth
Reply

Hi.

We are building a webshop for a customer selling new and used machinery. The used machinery gets handled by BC, so when a PM mark a machine in BC, it triggers an integration and then the product gets deleted in PIM and then also the Ecommerce. It makes an update to the index.

But the frontend doesn't seem to have been updated. In this test case we have "sold" our last Dumper. But the facets still says 1. And when filtered the list does not show "Sorry, no products available. 

If i then run a full build (happens every night) the list gets updated.

How do i correctly update my facets when a product gets deleted?


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Kasper,

 

Do you happen to have different indexes for PIM and the webshop? That would have explained it (the PIM index rebuilds, but not the webshop one).

 

Best Regards,

Nuno 

 
Kasper Legarth
Reply

Hi Nuno.

I wish it was just that. Sadly it is the same index. 
If i change the product list from if (productList.TotalProductsCount > 0) to if(productList.products.Any()) the list recognizes the update. But that don't fixes the problem with the facets.

 

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Kasper,

 

Sounds like some caching. Is this a Swift site? Does it happen in an incognito window? If the facets are coming in lazy loaded, could you have a CDN caching it?

 

Best Regards,

Nuno

 
Kasper Legarth
Reply

Hi Nuno.

It is indeed the facets list from an early swift. - It make no difference in incognito 🤷

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Kasper,

 

I'd need a URL to take a look. What you experience still sounds like cache.

 

Best Regards,

Nuno

 
Kasper Legarth
Reply

Hi Nuno.
 

An example could be this: https://scantruck.dev.gotcha.dk/maskiner/brugte-maskiner/se-alle-brugte-maskiner?PageSize=24&Brand=ATLAS

If i where to delete this product from PIM. The facets would still list Atlas as an option. 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> If i then run a full build (happens every night) the list gets updated.

Then it sounds like an issue with patching the index for the product you delete. When you delete the product, and then look at the index, does it say it was just updated and that it processed one product?

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

That makes a lot of sense Imar. I did not remember about the patching of the index.

 

In this case, it requires someone at DW to reproduce/investigate it, and eventually fix it.

 
Kasper Legarth
Reply

Before i delete a product:

After i delete a product:
So it does something. So the products is no longer in the productList.products. But the productList.TotalProductsCount does not get updated. Thefacet options does not update either. 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Could be a core-product issue. I can reproduce this on Swift. On my local copy I have two e-mountain bikes with a brake type of hydraulic_disc. When I delete one of them, the count stays at two, but the query counts say there are still two:

I tried it with the Active/Passive balancer and the LastUpdated balancer, but it's the same issue. 

 
Kasper Legarth
Reply

Hi Imar.
So if i understand you correctly, there is no other fix than running a full build?
Our customer is talking about adding spare parts to their PIM and webshop. We are talking 100.000+ products. I would like to avoid running a full build just because a product gets deleted or edited. 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I'm not sure if this is a bug, or by design. If it's a bug, then you should report it so can get fixed. And otherwise, yes, there may not be another solution that running a full build. The good news is that with100K+ products you're less likely to notice the counts are off by one :-)

Also, when adding that many products, wouldn't you use integration which then executes a build anyway?

Imar

 

 
Kasper Legarth
Reply

Hi Imar 

Indeed it is an integration, but the full build is only run once every night. And there is no problem. But when a salesperson sells a product outside of the webshop, he deletes it in BC and an integration sends the single product to be deleted, and we only run an update of the index. 

The 100.000 spare parts is a new product group. So we would still have the machinery category where the count is noticeable. 

I'm going to try and contact care. 

Thank you for your time :) 

 

You must be logged in to post in the forum