dynamicweb / DynamicWeb

Make feature requests for Dynamicweb in Issues section of this repository
https://doc.dynamicweb.dev/documentation/fundamentals/support/feature-requests.html
GNU General Public License v3.0
1 stars 0 forks source link

Improved handling of duplicates #126

Open dwlhs opened 1 month ago

dwlhs commented 1 month ago

Hi 😊

On a solution we noticed that some imported discounts weren’t effective in the frontend . The import adds the product ids of the products that are associated with the individual discounts, and the discounts weren’t calculated. In the backend, there were no products displayed in the “Select products” field either, however, there was data correctly formatted in the database. Further investigation revealed that there were duplicate product ids in the data, which apparently caused DW to give up attempting to resolve the list of products associated to the discount. Nothing was logged in Insights or anything either to back up the investigation.

After removing the duplicates, we were able to import the discount successfully using the Ecom provider.

So the suggestion is to improve this, either by the discount engine being more roboust towards this, the discounts UI being able to show a warning or just some information in Insights to ease the investigation.

Thanks :)

Br. Lars

dwlhs commented 1 month ago

Hi :)

Adding a bit more detail as per request.

When adding products through the UI, naturally, only unique Ids can be added:

image

Information about the products associated to the discount is stored as a chunk of test in a field in the database:

[some][p:10095,][p:6110881195M,][p:6110880097M,]

image

So, when importing this, the source data must have this format prepared, and if there are duplicate numbers like the following:

[some][p:10095,][p:6110881195M,]**[p:6110880097M,][p:6110880097M,]**

The "Select products" field will be empty:

image

The discount is not applied in the frontend either, so my guess is that when initializing the cache, the product id's are added to a collection inside a try/catch, and we don't check if the key already exists, so the process aborts upon failure.

I don't think there is much to do about faulty import data, but there was nothing indicating faulty data in neither the discount nor in Insights, so troubleshooting was a bit tricky. So this issue is a suggestion to either:

Enjoy:)

Br. Lars