Skip to content

Commit 0a1b87b

Browse files
committed
MC-15250: Explicit product sorting in PageBuilder Products Content type
1 parent e9f0bdd commit 0a1b87b

File tree

8 files changed

+12
-43
lines changed

8 files changed

+12
-43
lines changed

app/code/Magento/PageBuilder/Model/Catalog/Sorting.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Sorting
1717
* @var array
1818
*/
1919
protected $sortClasses = [
20-
'default' => Sorting\DefaultSorting::class
20+
'date_newest_top' => Sorting\Date\NewestTop::class
2121
];
2222

2323
/**
@@ -72,7 +72,7 @@ public function getSortingInstance($sortOption): Sorting\SortInterface
7272
if (isset($this->sortInstances[$sortOption])) {
7373
return $this->sortInstances[$sortOption];
7474
}
75-
return $this->sortInstances['default'];
75+
return $this->sortInstances['date_newest_top'];
7676
}
7777

7878
/**
@@ -87,7 +87,7 @@ public function applySorting(
8787
\Magento\Catalog\Model\ResourceModel\Product\Collection $collection
8888
): \Magento\Catalog\Model\ResourceModel\Product\Collection {
8989
$sortBuilder = $this->getSortingInstance($option);
90-
$_collection = $sortBuilder->sort($collection->setCurPage(0));
90+
$_collection = $sortBuilder->sort($collection);
9191

9292
if ($_collection->isLoaded()) {
9393
$_collection->clear();

app/code/Magento/PageBuilder/Model/Catalog/Sorting/DefaultSorting.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

app/code/Magento/PageBuilder/Model/Catalog/Sorting/Price/HighToLow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ protected function getSortDirection()
2828
*/
2929
public function getLabel(): string
3030
{
31-
return __('Price: High to low');
31+
return __('Price: high to low');
3232
}
3333
}

app/code/Magento/PageBuilder/Model/Catalog/Sorting/Price/LowToHigh.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ protected function getSortDirection()
2828
*/
2929
public function getLabel(): string
3030
{
31-
return __('Price: Low to high');
31+
return __('Price: low to high');
3232
}
3333
}

app/code/Magento/PageBuilder/Model/Catalog/Sorting/Sku/Ascending.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ protected function getSortDirection()
3636
*/
3737
public function getLabel(): string
3838
{
39-
return __('SKU: Ascending');
39+
return __('SKU: ascending');
4040
}
4141
}

app/code/Magento/PageBuilder/Model/Catalog/Sorting/Sku/Descending.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ protected function getSortDirection()
3636
*/
3737
public function getLabel(): string
3838
{
39-
return __('SKU: Descending');
39+
return __('SKU: descending');
4040
}
4141
}

app/code/Magento/PageBuilder/Model/Catalog/Sorting/StockAbstract.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function sort(
3232

3333
$baseSet = clone $collection;
3434
$finalSet = clone $collection;
35+
$collection->setCurPage(0);
3536

3637
$collection->joinField(
3738
'child_id',

app/code/Magento/PageBuilder/i18n/en_US.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,9 @@ OK,OK
295295
"Oldest products first","Oldest products first"
296296
"Name: A - Z","Name: A - Z"
297297
"Name: Z - A","Name: Z - A"
298-
"Price: High to low","Price: High to low"
299-
"Price: Low to high","Price: Low to high"
300-
"SKU: Ascending","SKU: Ascending"
301-
"SKU: Descending","SKU: Descending"
298+
"Price: high to low","Price: high to low"
299+
"Price: low to high","Price: low to high"
300+
"SKU: ascending","SKU: ascending"
301+
"SKU: descending","SKU: descending"
302302
"Stock: low stock first","Stock: low stock first"
303303
"Stock: high stock first","Stock: high stock first"

0 commit comments

Comments
 (0)