Skip to content

Commit e33e5a4

Browse files
committed
Merge remote-tracking branch 'origin/PB-1160' into PB-1159
2 parents a276835 + 2b61160 commit e33e5a4

File tree

62 files changed

+2334
-2920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2334
-2920
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\PageBuilder\Model\Catalog\Sorting\Category;
9+
10+
use Magento\Catalog\Model\ResourceModel\Product\Collection;
11+
use Magento\Framework\DB\Select;
12+
use Magento\Framework\Phrase;
13+
use Magento\PageBuilder\Model\Catalog\Sorting\OptionInterface;
14+
use Magento\Store\Model\Store;
15+
16+
/**
17+
* Sort catalog products by their positions in the category
18+
*/
19+
class Position implements OptionInterface
20+
{
21+
/**
22+
* @var string
23+
*/
24+
private $label;
25+
26+
/**
27+
* @var string
28+
*/
29+
private $sortDirection;
30+
31+
/**
32+
* @var string
33+
*/
34+
private $secondarySortDirection;
35+
36+
/**
37+
* @param string $label
38+
* @param string $sortDirection
39+
* @param string|null $secondarySortDirection
40+
*/
41+
public function __construct(
42+
string $label,
43+
string $sortDirection = Select::SQL_ASC,
44+
?string $secondarySortDirection = null
45+
) {
46+
$this->label = $label;
47+
$this->sortDirection = $sortDirection;
48+
$this->secondarySortDirection = $secondarySortDirection ?? $sortDirection;
49+
}
50+
51+
/**
52+
* @inheritDoc
53+
*/
54+
public function sort(Collection $collection): Collection
55+
{
56+
$collection->getSelect()->reset(Select::ORDER);
57+
$filters = $collection->getLimitationFilters();
58+
if ($collection->getStoreId() === Store::DEFAULT_STORE_ID && isset($filters['category_id'])) {
59+
$collection->getSelect()->order("cat_index_position $this->sortDirection");
60+
} else {
61+
$collection->addAttributeToSort('position', $this->sortDirection);
62+
}
63+
if ($this->secondarySortDirection) {
64+
$collection->addAttributeToSort('entity_id', $this->secondarySortDirection);
65+
}
66+
return $collection;
67+
}
68+
69+
/**
70+
* @inheritdoc
71+
*/
72+
public function getLabel(): Phrase
73+
{
74+
return __($this->label);
75+
}
76+
}

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminCMSPageDisablePageBuilderTest/AdminAddImageToCMSPageTinyMCE3Test.xml

-23
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminCMSPageDisablePageBuilderTest/AdminSwitchWYSIWYGOptionsTest.xml

-18
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerCollageCenterAppearanceTest/BannerCollageCenterTinyMCE3InlineEditTest.xml

-54
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerCollageLeftAppearanceTest/BannerCollageLeftTinyMCE3InlineEditTest.xml

-52
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerCollageRightAppearanceTest/BannerCollageRightTinyMCE3InlineEditTest.xml

-54
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerPosterAppearanceTest/BannerPosterTinyMCE3InlineEditTest.xml

-43
This file was deleted.

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBannerPosterAppearanceTest/BannerPosterVideoBackgroundNoFallbackImageDisabledLoopAndPlayWhenVisibleAndLazyLoad.xml

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
<!-- Validate Edit Panel After Save -->
111111
<actionGroup ref="openPageBuilderEditPanel" stepKey="openEditPanelAfterSave">
112112
<argument name="contentType" value="PageBuilderBannerContentType"/>
113+
<argument name="offsetXCoordinate" value="null"/>
114+
<argument name="offsetYCoordinate" value="null"/>
113115
</actionGroup>
114116
<actionGroup ref="seeInFieldSlideOutProperty" stepKey="validateBackgroundColorEmptyAfterSave">
115117
<argument name="property" value="PageBuilderBackgroundColor_Default"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderSlideItemAppearanceCollageCenterTest/SlideItemCollageCenterTinyMCE3InlineEditTest.xml

-46
This file was deleted.

0 commit comments

Comments
 (0)