-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- Magento version 2.4.4 Commerce
Steps to reproduce
- Within the Magento Admin Navigate to
CATALOG
->Categories
- Navigate to a category with products
- Open the
Products in Category
section - Select
Special price to top
orSpecial price to bottom
order - Click
Sort
Expected result
- Sorts products by selected sort option
Actual result
error thrown during loading of category, user navigated away from category to dashboard, no changes saved
[2022-07-11T08:50:19.392580+00:00] report.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'price_index.customer_group_id' in 'where clause', query was: SELECT DISTINCT `e`.*, `at_child_id`.`child_id`, `at_child_stock`.`qty` AS `child_stock`, `at_parent_stock`.`qty` AS `parent_stock`, IF( SUM(`at_parent_stock`.`qty`), SUM(`at_parent_stock`.`qty`), `at_child_stock`.`qty`) AS `stock`, `at_position`.`position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, IF(price_index.price <> price_index.final_price, 1, 0) AS `special_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price` FROM `catalog_product_entity` AS `e`
LEFT JOIN `catalog_product_relation` AS `at_child_id` ON (at_child_id.`parent_id`=e.entity_id)
LEFT JOIN `cataloginventory_stock_item` AS `at_child_stock` ON (at_child_stock.`product_id`=e.entity_id) AND (at_child_stock.stock_id = '1')
LEFT JOIN `cataloginventory_stock_item` AS `at_parent_stock` ON (at_parent_stock.`product_id`=at_child_id.child_id) AND (at_parent_stock.stock_id = '1')
INNER JOIN `tmp_catalog_category_product_position62cbe4220d12b0_92157370` AS `at_position` ON (at_position.`product_id`=e.entity_id)
LEFT JOIN (SELECT `catalog_product_index_price`.* FROM `catalog_product_index_price` WHERE ((price_index.customer_group_id = 0))) AS `price_index` ON price_index.entity_id = e.entity_id WHERE ((price_index.customer_group_id = 0)) AND (e.created_in <= '1653778860') AND (e.updated_in > '1653778860') GROUP BY `e`.`entity_id` ORDER BY `special_price` ASC
LIMIT 20 [] []
Additional information
It seems that during the refactoring of \Magento\VisualMerchandiser\Model\Category\Products
the applyPositions
function was removed, previously this function would add a filter for entity_id
which was then used in \Magento\VisualMerchandiser\Model\Sorting\SortAbstract::addPriceData
on line 142. as SortAbstract
has been left unmodified it still expects to find a where clause which is no longer there.
The only workaround for not being able to use the sort features would be to manually position products where you want them placing special priced products at the top or bottom, the other issue with this is that the visual merchandiser does not show you the special price of a product if it has one so in order to implement this workaround you would have to open every product in the category in another tab to work out whether it has a special price or not making this workaround completely unrealistic and not feasible.
I have chosen to set this as S0 Severity, in the bigger picture of the overall application sorting products may not be considered critical functionality however in the context of the Visual merchandiser module, being able to sort products in a particular order is part of the core functionality which simply doesn't work as it stands.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.