Skip to content

Commit 99770c2

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-95829' into EPAM-PR-23
2 parents 97de3c9 + cb69dcc commit 99770c2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

app/code/Magento/Catalog/Model/Category/Product/PositionResolver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function getPositions(int $categoryId): array
4343
$categoryId
4444
)->order(
4545
'ccp.position ' . \Magento\Framework\DB\Select::SQL_ASC
46+
)->order(
47+
'ccp.product_id ' . \Magento\Framework\DB\Select::SQL_DESC
4648
);
4749

4850
return array_flip($connection->fetchCol($select));

app/code/Magento/Catalog/Test/Unit/Model/Category/Product/PositionResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testGetPositions()
107107
$this->select->expects($this->once())
108108
->method('where')
109109
->willReturnSelf();
110-
$this->select->expects($this->once())
110+
$this->select->expects($this->exactly(2))
111111
->method('order')
112112
->willReturnSelf();
113113
$this->select->expects($this->once())

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ protected function _saveProductCategories(array $categoriesData)
14341434
$delProductId[] = $productId;
14351435

14361436
foreach (array_keys($categories) as $categoryId) {
1437-
$categoriesIn[] = ['product_id' => $productId, 'category_id' => $categoryId, 'position' => 1];
1437+
$categoriesIn[] = ['product_id' => $productId, 'category_id' => $categoryId, 'position' => 0];
14381438
}
14391439
}
14401440
if (Import::BEHAVIOR_APPEND != $this->getBehavior()) {

0 commit comments

Comments
 (0)