Skip to content

Commit c1beef0

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into 2.4-develop-pr44
2 parents b91c499 + 632a7c6 commit c1beef0

File tree

53 files changed

+998
-98
lines changed

Some content is hidden

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

53 files changed

+998
-98
lines changed

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function build(AggregationInterface $aggregation, ?int $storeId): array
7272
);
7373
}
7474

75-
return [$result];
75+
return [self::PRICE_BUCKET => $result];
7676
}
7777

7878
/**

app/code/Magento/CatalogGraphQl/Model/Resolver/Aggregations.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver;
99

10+
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\LayerBuilder;
11+
use Magento\Directory\Model\PriceCurrency;
12+
use Magento\Framework\App\ObjectManager;
1013
use Magento\Framework\GraphQl\Config\Element\Field;
1114
use Magento\Framework\GraphQl\Query\ResolverInterface;
1215
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
13-
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\LayerBuilder;
1416
use Magento\Store\Api\Data\StoreInterface;
1517

1618
/**
@@ -28,16 +30,24 @@ class Aggregations implements ResolverInterface
2830
*/
2931
private $layerBuilder;
3032

33+
/**
34+
* @var PriceCurrency
35+
*/
36+
private $priceCurrency;
37+
3138
/**
3239
* @param \Magento\CatalogGraphQl\Model\Resolver\Layer\DataProvider\Filters $filtersDataProvider
3340
* @param LayerBuilder $layerBuilder
41+
* @param PriceCurrency $priceCurrency
3442
*/
3543
public function __construct(
3644
\Magento\CatalogGraphQl\Model\Resolver\Layer\DataProvider\Filters $filtersDataProvider,
37-
LayerBuilder $layerBuilder
45+
LayerBuilder $layerBuilder,
46+
PriceCurrency $priceCurrency = null
3847
) {
3948
$this->filtersDataProvider = $filtersDataProvider;
4049
$this->layerBuilder = $layerBuilder;
50+
$this->priceCurrency = $priceCurrency ?: ObjectManager::getInstance()->get(PriceCurrency::class);
4151
}
4252

4353
/**
@@ -60,7 +70,18 @@ public function resolve(
6070
/** @var StoreInterface $store */
6171
$store = $context->getExtensionAttributes()->getStore();
6272
$storeId = (int)$store->getId();
63-
return $this->layerBuilder->build($aggregations, $storeId);
73+
$results = $this->layerBuilder->build($aggregations, $storeId);
74+
if (isset($results['price_bucket'])) {
75+
foreach ($results['price_bucket']['options'] as &$value) {
76+
list($from, $to) = explode('-', $value['label']);
77+
$newLabel = $this->priceCurrency->convertAndRound($from)
78+
. '-'
79+
. $this->priceCurrency->convertAndRound($to);
80+
$value['label'] = $newLabel;
81+
$value['value'] = str_replace('-', '_', $newLabel);
82+
}
83+
}
84+
return $results;
6485
} else {
6586
return [];
6687
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Category/DataProvider/Breadcrumbs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver\Category\DataProvider;
99

10+
use Magento\Catalog\Api\Data\CategoryInterface;
1011
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
1112

1213
/**
@@ -46,6 +47,7 @@ public function getData(string $categoryPath): array
4647
$collection = $this->collectionFactory->create();
4748
$collection->addAttributeToSelect(['name', 'url_key', 'url_path']);
4849
$collection->addAttributeToFilter('entity_id', $parentCategoryIds);
50+
$collection->addAttributeToFilter(CategoryInterface::KEY_IS_ACTIVE, 1);
4951

5052
foreach ($collection as $category) {
5153
$breadcrumbsData[] = [

app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Image.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
namespace Magento\CatalogGraphQl\Model\Resolver\Category;
99

10+
use Magento\Catalog\Model\Category;
11+
use Magento\Catalog\Model\Category\FileInfo;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\Filesystem\DirectoryList;
1014
use Magento\Framework\GraphQl\Config\Element\Field;
15+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1116
use Magento\Framework\GraphQl\Query\ResolverInterface;
1217
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
13-
use Magento\Framework\Exception\LocalizedException;
18+
use Magento\Framework\UrlInterface;
1419
use Magento\Store\Api\Data\StoreInterface;
15-
use Magento\Framework\Filesystem\DirectoryList;
16-
use Magento\Catalog\Model\Category\FileInfo;
17-
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1820

1921
/**
2022
* Resolve category image to a fully qualified URL
@@ -52,15 +54,15 @@ public function resolve(
5254
if (!isset($value['model'])) {
5355
throw new LocalizedException(__('"model" value should be specified'));
5456
}
55-
/** @var \Magento\Catalog\Model\Category $category */
57+
/** @var Category $category */
5658
$category = $value['model'];
5759
$imagePath = $category->getData('image');
5860
if (empty($imagePath)) {
5961
return null;
6062
}
6163
/** @var StoreInterface $store */
6264
$store = $context->getExtensionAttributes()->getStore();
63-
$baseUrl = $store->getBaseUrl();
65+
$baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB);
6466

6567
$filenameWithMedia = $this->fileInfo->isBeginsWithMediaDirectoryPath($imagePath)
6668
? $imagePath : $this->formatFileNameWithMediaCategoryFolder($imagePath);

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/ProductSearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function getList(
113113
$searchResults = $this->searchResultsFactory->create();
114114
$searchResults->setSearchCriteria($searchCriteriaForCollection);
115115
$searchResults->setItems($collection->getItems());
116-
$searchResults->setTotalCount($searchResult->getTotalCount());
116+
$searchResults->setTotalCount($collection->getSize());
117117
return $searchResults;
118118
}
119119

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public function __construct(
5151
*/
5252
public function apply(Filter $filter, AbstractDb $collection)
5353
{
54+
$conditionType = $filter->getConditionType();
55+
if ($conditionType !== 'eq') {
56+
return true;
57+
}
58+
5459
$categoryIds = $filter->getValue();
5560
if (!is_array($categoryIds)) {
5661
$categoryIds = [$categoryIds];

app/code/Magento/CatalogGraphQl/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"magento/module-eav": "*",
88
"magento/module-catalog": "*",
99
"magento/module-catalog-inventory": "*",
10+
"magento/module-directory": "*",
1011
"magento/module-search": "*",
1112
"magento/module-store": "*",
1213
"magento/module-eav-graph-ql": "*",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCmsPageFillOutBasicFieldsActionGroup">
12+
<annotations>
13+
<description>Fills out the Page details (Page Title, Content and URL Key) on the Admin Page creation/edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="title" type="string" defaultValue="{{_defaultCmsPage.title}}"/>
17+
<argument name="contentHeading" type="string" defaultValue="{{_defaultCmsPage.content_heading}}"/>
18+
<argument name="content" type="string" defaultValue="{{_defaultCmsPage.content}}"/>
19+
<argument name="urlKey" type="string" defaultValue="{{_defaultCmsPage.identifier}}"/>
20+
</arguments>
21+
22+
<fillField selector="{{CmsNewPagePageBasicFieldsSection.pageTitle}}" userInput="{{title}}" stepKey="fillTitle"/>
23+
<conditionalClick selector="{{CmsNewPagePageContentSection.header}}" dependentSelector="{{CmsNewPagePageContentSection.contentHeading}}" visible="false" stepKey="expandContentTabIfCollapsed"/>
24+
<fillField selector="{{CmsNewPagePageContentSection.contentHeading}}" userInput="{{contentHeading}}" stepKey="fillContentHeading"/>
25+
<scrollTo selector="{{CmsNewPagePageContentSection.content}}" stepKey="scrollToPageContent"/>
26+
<fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="{{content}}" stepKey="fillContent"/>
27+
<conditionalClick selector="{{CmsNewPagePageSeoSection.header}}" dependentSelector="{{CmsNewPagePageSeoSection.urlKey}}" visible="false" stepKey="clickExpandSearchEngineOptimisationIfCollapsed"/>
28+
<fillField selector="{{CmsNewPagePageSeoSection.urlKey}}" userInput="{{urlKey}}" stepKey="fillUrlKey"/>
29+
</actionGroup>
30+
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDisableWYSIWYGActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<description>Runs bin/magento command to disable WYSIWYG</description>
1414
</annotations>
1515

16-
<magentoCLI stepKey="disableWYSIWYG" command="config:set cms/wysiwyg/enabled disabled"/>
16+
<magentoCLI command="config:set {{WysiwygDisabledByDefault.path}} {{WysiwygDisabledByDefault.value}}" stepKey="disableWYSIWYG"/>
1717
</actionGroup>
1818
</actionGroups>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminEnableWYSIWYGActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<description>Runs bin/magento command to enable WYSIWYG</description>
1414
</annotations>
1515

16-
<magentoCLI stepKey="enableWYSIWYG" command="config:set cms/wysiwyg/enabled enabled"/>
16+
<magentoCLI command="config:set {{WysiwygEnabledByDefault.path}} {{WysiwygEnabledByDefault.value}}" stepKey="enableWYSIWYG"/>
1717
</actionGroup>
1818
</actionGroups>

0 commit comments

Comments
 (0)