Adding 'is_saleable' attribute to sort of product collection causes exception and adding 'is_salable' has no effect #7768
Labels
bug report
Component: Catalog
Fixed in 2.2.x
The issue has been fixed in 2.2 release line
Issue: Clear Description
Gate 2 Passed. Manual verification of the issue description passed
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Issue: Format is valid
Gate 1 Passed. Automatic verification of issue format passed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Reproduced on 2.1.x
The issue has been reproduced on latest 2.1 release
Reproduced on 2.2.x
The issue has been reproduced on latest 2.2 release
Reproduced on 2.3.x
The issue has been reproduced on latest 2.3 release
In Magento\Catalog\Model\ResourceModel\Product\Collection, addAttributeToSort() has the following lines:
But the generated SQL query selects stock_status_index.stock_status as 'is_salable', not 'is_saleable'. So adding 'is_saleable' causes an SQL exception and since 'is_salable' is not a product attribute, it silently fails to be added to the SQL statement.
Preconditions
Steps to reproduce
Expected result
Actual result
Workaround
Modify the collection instead with
$collection->getSelect()->order('is_salable');
The text was updated successfully, but these errors were encountered: