-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed
Description
Preconditions
- Magento 2.2.4
- PHP 7.1
Steps to reproduce
- Have a category with several products
- Print the query for retrieving category products.
- Use the following code in the Magento_Catalog/templates/product.list.phtml to display the query used:
<?php
$_productCollection = $block->getLoadedProductCollection();
print $_productCollection->getSelect();
Expected result
- ORDER BY should reference the same column only once. In this example it should reference:
ORDER BY
`cat_index`.`position` asc,
`e`.`entity_id` asc
Actual result
Query for retrieving products in a category is the following:
SELECT 1 AS `status`, `e`.`entity_id`,`cat_index`.`position` AS `cat_index_position`, `e`.`attribute_set_id`, `e`.`type_id`, `e`.`created_at`, `e`.`updated_at`, `e`.`sku`, `stock_status_index`.`stock_status` AS `is_salable`, `e`.`name`, `e`.`price`, `e`.`image`, `e`.`small_image`, `e`.`tax_class_id`, `e`.`url_key`, `e`.`thumbnail`, `e`.`short_description`, `e`.`special_price`, `e`.`special_from_date`, `e`.`special_to_date`, `e`.`news_from_date`, `e`.`news_to_date`, `e`.`required_options`, `e`.`price_type`, `e`.`weight_type`, `e`.`price_view`, `e`.`image_label`, `e`.`small_image_label`, `e`.`thumbnail_label`, `e`.`links_purchased_separately`, `e`.`msrp_display_actual_price_type`, `e`.`msrp`, `e`.`links_exist`, `e`.`on_home`, `e`.`old_brand`, `e`.`old_brand_value`, `e`.`brand`, `e`.`brand_value`, `e`.`productstatus`, `e`.`productstatus_value`, `e`.`motief`, `e`.`orderable`, `e`.`bss_weight`, `e`.`gift_type`, `e`.`gift_type_value`, `e`.`gift_value`, `e`.`gift_to`, `e`.`gift_from`, `e`.`gift_price_type`, `e`.`gift_price_type_value`, `e`.`gift_template_ids`, `e`.`gift_dropdown`, `e`.`gift_price`, `e`.`stijl_mode`, `e`.`mouwlengte`, `e`.`mouwlengte_value`, `e`.`halslijn`, `e`.`halslijn_value`, `e`.`kledingkleur_specifiek`, `e`.`swatch_image`, `e`.`sale`, `e`.`tt_product_id`, `e`.`new_arrival`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_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`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`
FROM `catalog_product_flat_3` AS `e`
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=3 AND cat_index.visibility IN(2, 4) AND cat_index.category_id='1689'
INNER JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
WHERE (stock_status_index.stock_status = 1)
ORDER BY
`cat_index_position` asc,
`cat_index`.`position` asc,
`e`.`entity_id` asc,
`e`.`entity_id` DESC,
`cat_index_position` asc,
`cat_index`.`position` asc,
`e`.`entity_id` asc
e.entity_idis 3 times present in the query.- Reference to column
cat_index_positionandcat_index.positionare the same (in the from part cat_index_position is defined ascat_index.position)
Metadata
Metadata
Assignees
Labels
Component: CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passed