pimcore / ecommerce-framework-bundle

Ecommerce Framework community bundle provides e-commerce functionality such as product listing and filtering, pricing, carts and checkouts for Pimcore.
https://pimcore.com/docs/platform/Ecommerce_Framework/
Other
8 stars 28 forks source link

[Bug]: IndexService DefaultMysql #168

Closed AlternateIf closed 4 months ago

AlternateIf commented 4 months ago

Expected behavior

The same behaviour as in Pimcore 10. Without adding a custom order by no exception should be thrown

Actual behavior

Upon loading the data a bad query gets generated which results in an exception.

The problem seems to be that the order by cols are now quoted/escaped (see https://github.com/pimcore/ecommerce-framework-bundle/blob/1.x/src/IndexService/ProductList/DefaultMysql.php#L621) whereas in pimcore 10 they were not quoted (https://github.com/pimcore/pimcore/blob/v10.6.9/bundles/EcommerceFrameworkBundle/IndexService/ProductList/DefaultMysql.php#L708)

This leads to queries like SELECT SQL_CALC_FOUND_ROWS DISTINCT virtualProductId as id, priceSystemName FROM ecommerceframework_productindex_terracefinder_at_new a WHERE active = 1 AND virtualProductActive = 1 AND inProductList = 1 AND 1 AND (type = 'variant') AND (ok=1) AND (virtualProductId != id) GROUP BY virtualProductId, priceSystemName ORDER BY min(`name`) asc,min(`a.id`) ASC LIMIT 32

Now, since the order by query part is escaped and cols might include identifiers/alias (https://github.com/pimcore/ecommerce-framework-bundle/blob/1.x/src/IndexService/ProductList/DefaultMysql.php#L600) the query fails

Steps to reproduce