Skip to content

Commit 070749d

Browse files
authored
Merge branch '2.4-develop' into ASI-1764
2 parents d1abc9d + 18da36b commit 070749d

File tree

82 files changed

+2002
-273
lines changed

Some content is hidden

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

82 files changed

+2002
-273
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ Summary,Summary
176176
"We'll send your order confirmation here.","We'll send your order confirmation here."
177177
Payment,Payment
178178
"Not yet calculated","Not yet calculated"
179-
"We received your order!","We received your order!"
179+
"The order was not successful!","The order was not successful!"
180180
"Thank you for your purchase!","Thank you for your purchase!"
181181
"Password", "Password"
182182
"Something went wrong while saving the page. Please refresh the page and try again.","Something went wrong while saving the page. Please refresh the page and try again."
183183
"Item in Cart","Item in Cart"
184184
"Items in Cart","Items in Cart"
185185
"Close","Close"
186186
"Show Cross-sell Items in the Shopping Cart","Show Cross-sell Items in the Shopping Cart"
187-
"You added %1 to your <a href=""%2"">shopping cart</a>.","You added %1 to your <a href=""%2"">shopping cart</a>."
187+
"You added %1 to your <a href=""%2"">shopping cart</a>.","You added %1 to your <a href=""%2"">shopping cart</a>."

app/code/Magento/Checkout/view/frontend/layout/checkout_onepage_failure.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<body>
1010
<referenceBlock name="page.main.title">
1111
<action method="setPageTitle">
12-
<argument translate="true" name="title" xsi:type="string">We received your order!</argument>
12+
<argument translate="true" name="title" xsi:type="string">The order was not successful!</argument>
1313
</action>
1414
</referenceBlock>
1515
<referenceContainer name="content">

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertCategoryGridPageDetailsActionGroup.xml

+3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
<description>Assert category grid page basic columns values for default category</description>
1313
</annotations>
1414

15+
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.image('1','image')}}" stepKey="assertImageColumn"/>
1516
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.path('1')}}" stepKey="assertPathColumn"/>
1617
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.name('1', 'Default Category')}}" stepKey="assertNameColumn"/>
1718
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.displayMode('1', 'PRODUCTS')}}" stepKey="assertDisplayModeColumn"/>
1819
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.products('1', '0')}}" stepKey="assertProductsColumn"/>
20+
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.inMenu('1', 'Yes')}}" stepKey="assertInMenuColumn"/>
21+
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.enabled('1', 'Yes')}}" stepKey="assertEnabledColumn"/>
1922
</actionGroup>
2023
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertAdminMediaGalleryAssetFilterPlaceHolderActionGroup">
11+
<annotations>
12+
<description>Assert asset filter placeholder value</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="filterPlaceholder" type="string"/>
16+
</arguments>
17+
18+
<seeElement selector="{{AdminMediaGalleryCatalogUiCategoryGridSection.activeFilterPlaceholder(filterPlaceholder)}}" stepKey="assertFilterPLaceHolder" />
19+
</actionGroup>
20+
</actionGroups>

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Section/AdminMediaGalleryCatalogUiCategoryGridSection.xml

+4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminMediaGalleryCatalogUiCategoryGridSection">
12+
<element name="activeFilterPlaceholder" type="text" selector="//div[@class='admin__current-filters-list-wrap']//li//span[contains(text(), '{{filterPlaceholder}}')]" parameterized="true"/>
13+
<element name="image" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Image')]/preceding-sibling::th) +1]//img[contains(@src, '{{imageName}}')]" parameterized="true"/>
1214
<element name="path" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Path')]/preceding-sibling::th)]" parameterized="true"/>
1315
<element name="name" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Name')]/preceding-sibling::th) +1 ]//*[text()='{{categoryName}}']" parameterized="true"/>
1416
<element name="displayMode" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Display Mode')]/preceding-sibling::th) +1 ]//*[text()='{{productsText}}']" parameterized="true"/>
1517
<element name="products" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Products')]/preceding-sibling::th) +1 ]//*[text()='{{productsQty}}']" parameterized="true"/>
1618
<element name="edit" type="button" selector="//tr[td//text()[contains(., '{{categoryName}}')]]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Action')]/preceding-sibling::th) +1 ]//*[text()='{{actionButton}}']" parameterized="true"/>
19+
<element name="inMenu" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'In Menu')]/preceding-sibling::th) +1 ]//*[text()='{{inMenuValue}}']" parameterized="true"/>
20+
<element name="enabled" type="text" selector="//tr[{{row}}]//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., 'Enabled')]/preceding-sibling::th) +1 ]//*[text()='{{enabledValue}}']" parameterized="true"/>
1721
</section>
1822
</sections>

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml

+9-1
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,20 @@
6262
<actionGroup ref="AdminMediaGalleryAssertImageInGridActionGroup" stepKey="assertImageInGrid">
6363
<argument name="title" value="ImageMetadata.title"/>
6464
</actionGroup>
65+
66+
<wait time="10" stepKey="waitForBookmarkToSaveView"/>
67+
<reloadPage stepKey="reloadPage"/>
68+
<waitForPageLoad stepKey="waitForGridReloaded"/>
69+
<actionGroup ref="AdminAssertMediaGalleryFilterPlaceholderActionGroup" stepKey="assertFilterApplied">
70+
<argument name="filterPlaceholder" value="$$product.name$$"/>
71+
</actionGroup>
72+
6573
<actionGroup ref="AdminEnhancedMediaGalleryEnableMassActionModeActionGroup" stepKey="enableMassActionToDeleteImages"/>
6674
<actionGroup ref="AdminEnhancedMediaGallerySelectImageForMassActionActionGroup" stepKey="selectFirstImageToDelete">
6775
<argument name="imageName" value="{{ImageMetadata.title}}"/>
6876
</actionGroup>
6977
<actionGroup ref="AdminEnhancedMediaGalleryClickDeleteImagesButtonActionGroup" stepKey="clikDeleteSelectedButton"/>
7078
<actionGroup ref="AdminEnhancedMediaGalleryConfirmDeleteImagesActionGroup" stepKey="deleteImages"/>
71-
79+
7280
</test>
7381
</tests>

app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
<actionGroup ref="AdminEnhancedMediaGalleryClickEntityUsedInActionGroup" stepKey="clickUsedInCategories">
5555
<argument name="entityName" value="Categories"/>
5656
</actionGroup>
57+
<actionGroup ref="AssertAdminMediaGalleryAssetFilterPlaceHolderActionGroup" stepKey="assertFilterApplied">
58+
<argument name="filterPlaceholder" value="{{UpdatedImageDetails.title}}"/>
59+
</actionGroup>
5760
<actionGroup ref="AdminMediaGalleryAssertCategoryNameInCategoryGridActionGroup" stepKey="assertCategoryInGrid">
5861
<argument name="categoryName" value="$$category.name$$"/>
5962
</actionGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;
7+
8+
use Magento\Ui\Component\Listing\Columns\Column;
9+
10+
/**
11+
* Class InMenu column for Category grid
12+
*/
13+
class InMenu extends Column
14+
{
15+
/**
16+
* Prepare data source.
17+
*
18+
* @param array $dataSource
19+
* @return array
20+
*/
21+
public function prepareDataSource(array $dataSource)
22+
{
23+
if (isset($dataSource['data']['items'])) {
24+
$fieldName = $this->getData('name');
25+
foreach ($dataSource['data']['items'] as & $item) {
26+
if (isset($item[$fieldName]) && $item[$fieldName] == 1) {
27+
$item[$fieldName] = 'Yes';
28+
} else {
29+
$item[$fieldName] = 'No';
30+
}
31+
}
32+
}
33+
34+
return $dataSource;
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;
7+
8+
use Magento\Ui\Component\Listing\Columns\Column;
9+
10+
/**
11+
* Class IsActive column for Category grid
12+
*/
13+
class IsActive extends Column
14+
{
15+
/**
16+
* Prepare data source.
17+
*
18+
* @param array $dataSource
19+
* @return array
20+
*/
21+
public function prepareDataSource(array $dataSource)
22+
{
23+
if (isset($dataSource['data']['items'])) {
24+
$fieldName = $this->getData('name');
25+
foreach ($dataSource['data']['items'] as & $item) {
26+
if (isset($item[$fieldName]) && $item[$fieldName] == 1) {
27+
$item[$fieldName] = 'Yes';
28+
} else {
29+
$item[$fieldName] = 'No';
30+
}
31+
}
32+
}
33+
34+
return $dataSource;
35+
}
36+
}

app/code/Magento/MediaGalleryCatalogUi/Ui/Component/Listing/Columns/Thumbnail.php

+55-15
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66
namespace Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns;
77

8-
use Magento\Catalog\Helper\Image;
9-
use Magento\Framework\DataObject;
8+
use Magento\Catalog\Model\Category\Image;
9+
use Magento\Catalog\Model\CategoryRepository;
10+
use Magento\Framework\View\Asset\Repository as AssetRepository;
1011
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1112
use Magento\Framework\View\Element\UiComponentFactory;
1213
use Magento\Store\Model\Store;
@@ -27,48 +28,87 @@ class Thumbnail extends Column
2728
/**
2829
* @var Image
2930
*/
30-
private $imageHelper;
31+
private $categoryImage;
3132

3233
/**
34+
* @var CategoryRepository
35+
*/
36+
private $categoryRepository;
37+
38+
/**
39+
* @var AssetRepository
40+
*/
41+
private $assetRepository;
42+
43+
/**
44+
* @var string[]
45+
*/
46+
private $defaultPlaceholder;
47+
48+
/**
49+
* Thumbnail constructor.
3350
* @param ContextInterface $context
3451
* @param UiComponentFactory $uiComponentFactory
3552
* @param StoreManagerInterface $storeManager
36-
* @param Image $image
53+
* @param Image $categoryImage
54+
* @param CategoryRepository $categoryRepository
55+
* @param AssetRepository $assetRepository
56+
* @param array $defaultPlaceholder
3757
* @param array $components
3858
* @param array $data
3959
*/
4060
public function __construct(
4161
ContextInterface $context,
4262
UiComponentFactory $uiComponentFactory,
4363
StoreManagerInterface $storeManager,
44-
Image $image,
64+
Image $categoryImage,
65+
CategoryRepository $categoryRepository,
66+
AssetRepository $assetRepository,
67+
array $defaultPlaceholder = [],
4568
array $components = [],
4669
array $data = []
4770
) {
4871
parent::__construct($context, $uiComponentFactory, $components, $data);
49-
$this->imageHelper = $image;
5072
$this->storeManager = $storeManager;
73+
$this->categoryImage = $categoryImage;
74+
$this->categoryRepository = $categoryRepository;
75+
$this->assetRepository = $assetRepository;
76+
$this->defaultPlaceholder = $defaultPlaceholder;
5177
}
5278

5379
/**
5480
* Prepare Data Source
5581
*
5682
* @param array $dataSource
5783
* @return array
84+
* @throws \Magento\Framework\Exception\LocalizedException
85+
* @throws \Magento\Framework\Exception\NoSuchEntityException
5886
*/
5987
public function prepareDataSource(array $dataSource)
6088
{
61-
if (isset($dataSource['data']['items'])) {
62-
$fieldName = $this->getData('name');
63-
foreach ($dataSource['data']['items'] as & $item) {
64-
if (isset($item[$fieldName])) {
65-
$item[$fieldName . '_src'] = $this->getUrl($item[$fieldName]);
66-
} else {
67-
$category = new DataObject($item);
68-
$imageHelper = $this->imageHelper->init($category, 'product_listing_thumbnail');
69-
$item[$fieldName . '_src'] = $imageHelper->getUrl();
89+
if (!isset($dataSource['data']['items'])) {
90+
return $dataSource;
91+
}
92+
93+
$fieldName = $this->getData('name');
94+
foreach ($dataSource['data']['items'] as & $item) {
95+
if (isset($item[$fieldName])) {
96+
$item[$fieldName . '_src'] = $this->getUrl($item[$fieldName]);
97+
continue;
98+
}
99+
100+
if (isset($item['entity_id'])) {
101+
$src = $this->categoryImage->getUrl(
102+
$this->categoryRepository->get($item['entity_id'])
103+
);
104+
105+
if (!empty($src)) {
106+
$item[$fieldName . '_src'] = $src;
107+
continue;
70108
}
71109
}
110+
111+
$item[$fieldName . '_src'] = $this->assetRepository->getUrl($this->defaultPlaceholder['image']);
72112
}
73113

74114
return $dataSource;

app/code/Magento/MediaGalleryCatalogUi/Ui/Component/Listing/Filters/UsedInProducts.php

+25-43
Original file line numberDiff line numberDiff line change
@@ -80,54 +80,36 @@ public function prepare()
8080
{
8181
$options = [];
8282
$productIds = [];
83-
$bookmarks = $this->bookmarkManagement->loadByNamespace($this->context->getNameSpace())->getItems();
84-
foreach ($bookmarks as $bookmark) {
85-
if ($bookmark->getIdentifier() === 'current') {
86-
$applied = $bookmark->getConfig()['current']['filters']['applied'];
87-
if (isset($applied[$this->getName()])) {
88-
$productIds = $applied[$this->getName()];
89-
}
90-
}
83+
$bookmark = $this->bookmarkManagement->getByIdentifierNamespace(
84+
'current',
85+
$this->context->getNameSpace()
86+
);
87+
if ($bookmark === null) {
88+
parent::prepare();
89+
return;
9190
}
9291

93-
foreach ($productIds as $id) {
94-
$product = $this->productRepository->getById($id);
95-
$options[] = [
96-
'value' => $id,
97-
'label' => $product->getName(),
98-
'is_active' => $product->getStatus(),
99-
'path' => $product->getSku(),
100-
'optgroup' => false
92+
$applied = $bookmark->getConfig()['current']['filters']['applied'];
10193

102-
];
94+
if (isset($applied[$this->getName()])) {
95+
$productIds = $applied[$this->getName()];
10396
}
10497

105-
$this->wrappedComponent = $this->uiComponentFactory->create(
106-
$this->getName(),
107-
parent::COMPONENT,
108-
[
109-
'context' => $this->getContext(),
110-
'options' => $options
111-
]
112-
);
113-
114-
$this->wrappedComponent->prepare();
115-
$productsFilterJsConfig = array_replace_recursive(
116-
$this->getJsConfig($this->wrappedComponent),
117-
$this->getJsConfig($this)
118-
);
119-
$this->setData('js_config', $productsFilterJsConfig);
120-
121-
$this->setData(
122-
'config',
123-
array_replace_recursive(
124-
(array)$this->wrappedComponent->getData('config'),
125-
(array)$this->getData('config')
126-
)
127-
);
128-
129-
$this->applyFilter();
130-
98+
foreach ($productIds as $id) {
99+
try {
100+
$product = $this->productRepository->getById($id);
101+
$options[] = [
102+
'value' => $id,
103+
'label' => $product->getName(),
104+
'is_active' => $product->getStatus(),
105+
'path' => $product->getSku(),
106+
'optgroup' => false
107+
];
108+
} catch (\Exception $e) {
109+
continue;
110+
}
111+
}
112+
$this->optionsProvider = $options;
131113
parent::prepare();
132114
}
133115
}

app/code/Magento/MediaGalleryCatalogUi/etc/adminhtml/di.xml

+7
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,11 @@
3838
</argument>
3939
</arguments>
4040
</type>
41+
<type name="Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns\Thumbnail">
42+
<arguments>
43+
<argument name="defaultPlaceholder" xsi:type="array">
44+
<item name="image" xsi:type="string">Magento_MediaGalleryCatalogUi::images/category/placeholder/image.jpg</item>
45+
</argument>
46+
</arguments>
47+
</type>
4148
</config>

app/code/Magento/MediaGalleryCatalogUi/view/adminhtml/ui_component/media_gallery_category_listing.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@
167167
<label translate="true">Products</label>
168168
</settings>
169169
</column>
170-
<column name="include_in_menu" component="Magento_Ui/js/grid/columns/select">
170+
<column name="include_in_menu" class="Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns\InMenu">
171171
<settings>
172172
<label translate="true">In Menu</label>
173173
</settings>
174174
</column>
175-
<column name="is_active" component="Magento_Ui/js/grid/columns/select" >
175+
<column name="is_active" class="Magento\MediaGalleryCatalogUi\Ui\Component\Listing\Columns\IsActive">
176176
<settings>
177177
<label translate="true">Enabled</label>
178178
</settings>
Loading

0 commit comments

Comments
 (0)