Skip to content

Commit

Permalink
MC-30737: Stock sorting doesn't work with table prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
omiroshnichenko committed Jan 23, 2020
1 parent 3811867 commit c08ccac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/Magento/CatalogInventory/Model/Source/Stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getAllOptions()
public function addValueSortToCollection($collection, $dir = \Magento\Framework\Data\Collection::SORT_ORDER_DESC)
{
$collection->getSelect()->joinLeft(
['stock_item_table' => 'cataloginventory_stock_item'],
['stock_item_table' => $collection->getTable('cataloginventory_stock_item')],
"e.entity_id=stock_item_table.product_id",
[]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function testAddValueSortToCollection()
$selectMock = $this->createMock(\Magento\Framework\DB\Select::class);
$collectionMock = $this->createMock(\Magento\Eav\Model\Entity\Collection\AbstractCollection::class);
$collectionMock->expects($this->atLeastOnce())->method('getSelect')->willReturn($selectMock);
$collectionMock->expects($this->atLeastOnce())->method('getTable')->willReturn('cataloginventory_stock_item');

$selectMock->expects($this->once())
->method('joinLeft')
Expand Down

0 comments on commit c08ccac

Please sign in to comment.