isotope / core

Core repository of Isotope eCommerce, an eCommerce extension for Contao Open Source CMS
https://isotopeecommerce.org
136 stars 107 forks source link

Fix Unsupported operand types exception #2500

Closed koertho closed 9 months ago

koertho commented 10 months ago

This PR fix the "Unsupported operand types" exception that appears if an product is added to cart (or cart is viewed) when the product has not price attribute.

This PR adds just a float cast to the price calculation methods in ProductCollectionItem, so the price calculation methods always return a price :)

aschempp commented 10 months ago

as discussed, it should return an empty string if there is no price on the product.

koertho commented 10 months ago

Returning an empty string would only be possible for getTotalOriginalPrice(), the other methods are used follow-up price calculation methods. Switching to empty string lead to following exception:

image

koertho commented 10 months ago

Therefore, since these three methods are price calculation methods, they also should IMHO return a price, even if the product itself has no price.

aschempp commented 9 months ago

I have applied another fix in fda57f603b5eabcf989f07cf334d8c9269fd9387