Skip to content

Commit a321acd

Browse files
authored
Merge pull request #9174 from magento-gl/augcommpr
[Bluetooth] Community Pull Requests delivery Aug
2 parents 672a2e6 + 86074a0 commit a321acd

File tree

44 files changed

+540
-336
lines changed

Some content is hidden

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

44 files changed

+540
-336
lines changed

Diff for: app/code/Magento/Backend/view/adminhtml/layout/default.xml

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
<meta name="viewport" content="width=1024"/>
1212
<meta name="format-detection" content="telephone=no"/>
1313
<link src="requirejs/require.js"/>
14-
<css src="extjs/resources/css/ext-all.css"/>
15-
<css src="extjs/resources/css/ytheme-magento.css"/>
1614
</head>
1715
<body>
1816
<attribute name="id" value="html-body"/>

Diff for: app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ public function getCalendarDateHtml()
9393
$yearStart = $this->_catalogProductOptionTypeDate->getYearStart();
9494
$yearEnd = $this->_catalogProductOptionTypeDate->getYearEnd();
9595

96-
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
96+
$fieldsSeparator = '/';
97+
$fieldsOrder = $this->_catalogProductOptionTypeDate->getConfigData('date_fields_order') ?? '';
98+
$fieldsOrder = str_replace(",", $fieldsSeparator, $fieldsOrder);
99+
$dateFormat = $fieldsOrder !== "m/d/y" ? $fieldsOrder : $this->_localeDate->getDateFormatWithLongYear();
97100
/** Escape RTL characters which are present in some locales and corrupt formatting */
98101
$escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat);
99102
$value = null;

Diff for: app/code/Magento/Catalog/Model/ProductRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ private function getCollectionProcessor()
813813
{
814814
if (!$this->collectionProcessor) {
815815
$this->collectionProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(
816-
// phpstan:ignore "Class Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor not found."
816+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
817817
\Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor::class
818818
);
819819
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="AdminAddCustomizableOptionToSimpleProductActionGroup">
12+
<annotations>
13+
<description value="Add a custom option of type date to simple product." />
14+
</annotations>
15+
16+
<click selector="{{AdminProductCustomizableOptionSection.customizableOptionsToggle}}" stepKey="expandCustomOptions"/>
17+
<scrollTo selector="{{AdminProductCustomizableOptionSection.customizableOptionsToggle}}" stepKey="scrollToCustomizableOptions"/>
18+
19+
<click selector="{{AdminProductCustomizableOptionSection.addButtonOption}}" stepKey="clickAddButtonOption"/>
20+
<waitForElementVisible selector="{{AdminProductCustomizableOptionSection.customOptionXTitle}}" stepKey="waitForOptions"/>
21+
<fillField selector="{{AdminProductCustomizableOptionSection.customOptionXTitle}}" userInput="custom option 1" stepKey="fillOptionTitle"/>
22+
23+
<click selector="{{AdminProductCustomizableOptionSection.customOptionSelectType}}" stepKey="selectType"/>
24+
<click selector="{{AdminProductCustomizableOptionSection.customOptionSelectField}}" stepKey="selectField"/>
25+
<click selector="{{AdminProductCustomizableOptionSection.uncheckRequired}}" stepKey="uncheckRequired"/>
26+
<fillField selector="{{AdminProductCustomizableOptionSection.customizableOptionPrice}}" userInput="0" stepKey="fillPrice"/>
27+
28+
<waitForElementVisible selector="{{AdminProductCustomizableOptionSection.save}}" stepKey="waitForSaveButton"/>
29+
<click selector="{{AdminProductCustomizableOptionSection.save}}" stepKey="clickSaveButton"/>
30+
<waitForPageLoad stepKey="waitForAttributeToSave"/>
31+
<seeElement selector="{{AdminProductCustomizableOptionSection.successMessage}}" stepKey="seeSuccessMessage"/>
32+
</actionGroup>
33+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminConfigExpandDateAndTimeTabActionGroup">
12+
<annotations>
13+
<description>Expand date and time options tab.</description>
14+
</annotations>
15+
16+
<scrollTo selector="{{CatalogSection.dateAndTimeCustomOptions}}" stepKey="scrollDownToDateAndTime"/>
17+
<conditionalClick selector="{{CatalogSection.dateAndTimeCustomOptions}}" dependentSelector="{{CatalogSection.CheckIfTabExpandForDateAndTimeCustomOptions}}" visible="true" stepKey="expandDateAndTimeCustomOptionsTab"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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="AssertProductDateFormatInStorefrontActionGroup">
12+
<annotations>
13+
<description value="Go to product page on the storefront and assert sku and custom option date format"/>
14+
</annotations>
15+
16+
<arguments>
17+
<argument name="product"/>
18+
</arguments>
19+
20+
<!-- Go to storefront product page, assert product sku and date custom option -->
21+
<amOnPage url="{{product.urlKey}}.html" stepKey="navigateToProductPage"/>
22+
<waitForPageLoad stepKey="waitForPageLoad"/>
23+
24+
<see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/>
25+
26+
<click selector="{{StorefrontProductInfoMainSection.productCalenderButton}}" stepKey="clickCalenderButton"/>
27+
<click selector="{{StorefrontProductInfoMainSection.productCalenderGoToday}}" stepKey="clickCalenderGoTodayButton"/>
28+
29+
<generateDate date="Now" format="j/n/Y" stepKey="currentDate"/>
30+
31+
<executeJS function="
32+
var xpath = '{{StorefrontProductInfoMainSection.customDateField}}';
33+
var result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
34+
var element = result.singleNodeValue;
35+
return element.value;
36+
" stepKey="dateValue"/>
37+
38+
<assertEquals stepKey="assertDateFormat">
39+
<actualResult type="variable">dateValue</actualResult>
40+
<expectedResult type="variable">currentDate</expectedResult>
41+
</assertEquals>
42+
43+
</actionGroup>
44+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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="SelectDropdownDateAndTimeActionGroup">
12+
<annotations>
13+
<description>Select options for Use JavaScript Calendar and Date Fields Order dropdown</description>
14+
</annotations>
15+
16+
<arguments>
17+
<argument name="useJsCalender" type="string"/>
18+
<argument name="firstFieldOfDateOrder" type="string"/>
19+
<argument name="secondFieldOfDateOrder" type="string"/>
20+
<argument name="thirdFieldOfDateOrder" type="string" defaultValue="Year"/>
21+
</arguments>
22+
23+
<selectOption selector="{{AdminCustomizeDateAndTimeSection.dateAndTimeJsCalenderStatus}}"
24+
userInput="{{useJsCalender}}" stepKey="selectJsCalender" />
25+
<selectOption selector="{{AdminCustomizeDateAndTimeSection.dateAndTimeFirstFieldOrder}}"
26+
userInput="{{firstFieldOfDateOrder}}" stepKey="selectFirstFieldOrder" />
27+
<selectOption selector="{{AdminCustomizeDateAndTimeSection.dateAndTimeSecondFieldOrder}}"
28+
userInput="{{secondFieldOfDateOrder}}" stepKey="selectSecondFieldOrder" />
29+
<selectOption selector="{{AdminCustomizeDateAndTimeSection.dateAndTimeThirdFieldOrder}}"
30+
userInput="{{thirdFieldOfDateOrder}}" stepKey="selectThirdFieldOrder" />
31+
</actionGroup>
32+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCustomizeDateAndTimeSection">
12+
<element name="dateAndTimeJsCalenderStatus" type="select" selector="//*[@id='catalog_custom_options_use_calendar']"/>
13+
<element name="dateAndTimeFirstFieldOrder" type="select" selector="//*[@id='catalog_custom_options_date_fields_order'][1]"/>
14+
<element name="dateAndTimeSecondFieldOrder" type="select" selector="//*[@id='catalog_custom_options_date_fields_order'][2]"/>
15+
<element name="dateAndTimeThirdFieldOrder" type="select" selector="//*[@id='catalog_custom_options_date_fields_order'][3]"/>
16+
</section>
17+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminProductCustomizableOptionSection">
12+
<element name="customizableOptionsToggle" type="button" selector="//span[text()='Customizable Options']"/>
13+
<element name="addButtonOption" type="button" selector="button[data-index='button_add']"/>
14+
<element name="customOptionXTitle" type="input" selector="[name='product[options][0][title]']"/>
15+
<element name="customOptionSelectType" type="select" selector="[data-index='container_common'] .admin__action-multiselect-text"/>
16+
<element name="customOptionSelectField" type="select" selector="//label[contains(text(),'Date')]" />
17+
<element name="uncheckRequired" type="checkbox" selector="//span[contains(text(),'Required')]"/>
18+
<element name="customizableOptionPrice" type="input" selector=".//*[@name='product[options][0][price]']" />
19+
<element name="save" type="button" selector="//*[@id='save-button']" timeout="30"/>
20+
<element name="successMessage" type="text" selector=".message.message-success.success"/>
21+
</section>
22+
</sections>

Diff for: app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

+3
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,8 @@
114114
<element name="swatchOptionDisabled" type="text" selector=".//*[@class='swatch-option color disabled']"/>
115115
<element name="addToCartEnabled" type="button" selector="#product-addtocart-button:not([disabled])"/>
116116
<element name="selectCustomOptionDropDown" type="select" selector="//select[contains(@class,' required product-custom-option admin__control-select')]"/>
117+
<element name="productCalenderButton" type="button" selector="//*[@id='product-options-wrapper']/div/div/fieldset/div/button" />
118+
<element name="productCalenderGoToday" type="button" selector="//*[@id='ui-datepicker-div']/div[2]/button[1]" />
119+
<element name="customDateField" type="text" selector='//*[@class="product-custom-option datetime-picker input-text _has-datepicker"]' />
117120
</section>
118121
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminJsCalenderDateFormatTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Storefront should reflect the js calender format configured in the backend" />
15+
<title value="Check if js calender format configured in backend is reflected on storefront" />
16+
<description value="Check if js calender format configured in backend is reflected on storefront" />
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="AC-12164"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
22+
<before>
23+
<createData entity="_defaultCategory" stepKey="createPreReqCategory"/>
24+
</before>
25+
26+
<after>
27+
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
28+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct">
29+
<argument name="sku" value="{{_defaultProduct.sku}}"/>
30+
</actionGroup>
31+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearFilter"/>
32+
33+
<actionGroup ref="AdminOpenStoreConfigCatalogPageActionGroup" stepKey="navigateToConfigurationPage2"/>
34+
<actionGroup ref="AdminConfigExpandDateAndTimeTabActionGroup" stepKey="expandDateAndTimeCustomOptionsTab2"/>
35+
<actionGroup ref="SelectDropdownDateAndTimeActionGroup" stepKey="RevertDateAndTimeFieldOrder">
36+
<argument name="useJsCalender" value="No"/>
37+
<argument name="firstFieldOfDateOrder" value="Month"/>
38+
<argument name="secondFieldOfDateOrder" value="Day"/>
39+
</actionGroup>
40+
<actionGroup ref="AdminCheckUseSystemValueActionGroup" stepKey="checkUseSystemValueForDateFieldsOrder">
41+
<argument name="rowId" value="row_catalog_custom_options_date_fields_order"/>
42+
</actionGroup>
43+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveDateAndTimeConfig2"/>
44+
45+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
46+
</after>
47+
48+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
49+
50+
<!-- Open admin configuration, got to catalog, expand date and time tab -->
51+
<actionGroup ref="AdminOpenStoreConfigCatalogPageActionGroup" stepKey="navigateToConfigurationPage"/>
52+
<actionGroup ref="AdminConfigExpandDateAndTimeTabActionGroup" stepKey="expandDateAndTimeCustomOptionsTab"/>
53+
54+
<!-- Customize date and time configuration to D/M/Y -->
55+
<actionGroup ref="AdminUncheckUseSystemValueActionGroup" stepKey="uncheckUseSystemValueForDateFieldsOrder">
56+
<argument name="rowId" value="row_catalog_custom_options_date_fields_order"/>
57+
</actionGroup>
58+
<actionGroup ref="SelectDropdownDateAndTimeActionGroup" stepKey="CustomizeDateAndTimeFieldOrder">
59+
<argument name="useJsCalender" value="Yes"/>
60+
<argument name="firstFieldOfDateOrder" value="Day"/>
61+
<argument name="secondFieldOfDateOrder" value="Month"/>
62+
</actionGroup>
63+
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveDateAndTimeConfig"/>
64+
65+
<!-- Create simple product on storefront -->
66+
<actionGroup ref="FillAdminSimpleProductFormActionGroup" stepKey="fillProductFieldsInAdmin">
67+
<argument name="category" value="$$createPreReqCategory$$"/>
68+
<argument name="simpleProduct" value="_defaultProduct"/>
69+
</actionGroup>
70+
71+
<!-- Add customizable date option -->
72+
<actionGroup ref="AdminAddCustomizableOptionToSimpleProductActionGroup" stepKey="AddCustomizableDateOption"/>
73+
74+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="runCronIndex">
75+
<argument name="indices" value=""/>
76+
</actionGroup>
77+
78+
<!-- Assert date on storefront -->
79+
<actionGroup ref="AssertProductDateFormatInStorefrontActionGroup" stepKey="assertDateFormat">
80+
<argument name="product" value="_defaultProduct"/>
81+
</actionGroup>
82+
</test>
83+
</tests>

Diff for: app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
99

10-
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories;
11-
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
10+
use Magento\Authorization\Model\Role;
11+
use Magento\Backend\Model\Auth\Session;
1212
use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
13+
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
14+
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories;
1315
use Magento\Framework\App\CacheInterface;
1416
use Magento\Framework\AuthorizationInterface;
1517
use Magento\Framework\DB\Helper as DbHelper;
1618
use Magento\Framework\UrlInterface;
1719
use Magento\Store\Model\Store;
18-
use Magento\Backend\Model\Auth\Session;
19-
use Magento\Authorization\Model\Role;
2020
use Magento\User\Model\User;
2121
use PHPUnit\Framework\MockObject\MockObject;
2222

@@ -91,6 +91,9 @@ protected function setUp(): void
9191
$this->categoryCollectionMock->expects($this->any())
9292
->method('addAttributeToSelect')
9393
->willReturnSelf();
94+
$this->categoryCollectionMock->expects($this->any())
95+
->method('addAttributeToSort')
96+
->willReturnSelf();
9497
$this->categoryCollectionMock->expects($this->any())
9598
->method('addAttributeToFilter')
9699
->willReturnSelf();

Diff for: app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77

88
namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier;
99

10+
use Magento\Backend\Model\Auth\Session;
11+
use Magento\Catalog\Api\Data\CategoryInterface;
12+
use Magento\Catalog\Model\Category as CategoryModel;
1013
use Magento\Catalog\Model\Locator\LocatorInterface;
1114
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
12-
use Magento\Framework\App\ObjectManager;
1315
use Magento\Framework\App\CacheInterface;
16+
use Magento\Framework\App\ObjectManager;
17+
use Magento\Framework\AuthorizationInterface;
18+
use Magento\Framework\Data\Collection;
1419
use Magento\Framework\DB\Helper as DbHelper;
15-
use Magento\Catalog\Model\Category as CategoryModel;
1620
use Magento\Framework\Exception\LocalizedException;
1721
use Magento\Framework\Serialize\SerializerInterface;
18-
use Magento\Framework\UrlInterface;
1922
use Magento\Framework\Stdlib\ArrayManager;
20-
use Magento\Framework\AuthorizationInterface;
21-
use Magento\Backend\Model\Auth\Session;
23+
use Magento\Framework\UrlInterface;
2224

2325
/**
2426
* Data provider for categories field of product page
@@ -51,6 +53,7 @@ class Categories extends AbstractModifier
5153
/**
5254
* @var array
5355
* @deprecated 101.0.0
56+
* @see Nothing
5457
* @since 101.0.0
5558
*/
5659
protected $categoriesTrees = [];
@@ -128,6 +131,7 @@ public function __construct(
128131
*
129132
* @return CacheInterface
130133
* @deprecated 101.0.3
134+
* @see getCategoriesTree
131135
*/
132136
private function getCacheManager(): CacheInterface
133137
{
@@ -442,6 +446,8 @@ private function retrieveCategoriesTree(int $storeId, array $shownCategoriesIds)
442446

443447
$collection->addAttributeToFilter('entity_id', ['in' => array_keys($shownCategoriesIds)])
444448
->addAttributeToSelect(['name', 'is_active', 'parent_id'])
449+
->addAttributeToSort(CategoryInterface::KEY_LEVEL, Collection::SORT_ORDER_ASC)
450+
->addAttributeToSort(CategoryInterface::KEY_POSITION, Collection::SORT_ORDER_ASC)
445451
->setStoreId($storeId);
446452

447453
$categoryById = [

0 commit comments

Comments
 (0)