EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Avoid API Exceptions for empty product template ids #193

Closed aadmathijssen closed 2 years ago

aadmathijssen commented 2 years ago

When retrieving the the related/upsell relations of a product for which the corresponding crosssell/upsell template id is empty, an \Emico\Tweakwise\Exception\ApiException is triggered with the following message:

Featured products without template ID was requested.

This exception is caught later on and is written as an error to the system.log.

However, imho this scenario is not an actual error.

Also, this might give rise to lots of error messages, which pollutes the system.log (and services that process errors from these logs like Sentry and Elasticsearch).

This PR fixes these issues by adding an extra check to the Related and Upsell plugins before trying to perform a request to Tweakwise.

bramstroker commented 2 years ago

Thanks for the PR. LGTM @Hnto could you also have a look?

Hnto commented 2 years ago

@aadmathijssen Thanks for the PR and the improvement. Approved.