From 3a169aa873e278da53300add82f87222d5503521 Mon Sep 17 00:00:00 2001 From: Stanislav Ilnytskyi Date: Wed, 9 Sep 2020 11:20:07 +0200 Subject: [PATCH 01/32] Use compiled config for generated data instead of general config. events, ui, action_list --- app/code/Magento/Ui/etc/di.xml | 5 +++++ app/etc/di.xml | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/etc/di.xml b/app/code/Magento/Ui/etc/di.xml index b0cef3b90d43..65253ab8279d 100644 --- a/app/code/Magento/Ui/etc/di.xml +++ b/app/code/Magento/Ui/etc/di.xml @@ -361,6 +361,11 @@ Magento\Ui\Model\Manager\Proxy + + + Magento\Framework\App\Interception\Cache\CompiledConfig + + Magento\Ui\Config\Argument\Parser\Composite\Proxy diff --git a/app/etc/di.xml b/app/etc/di.xml index 585c88f68ff6..9473693181c8 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -394,6 +394,11 @@ + + + Magento\Framework\App\Interception\Cache\CompiledConfig + + Magento\Framework\App\Cache\Type\Config @@ -425,7 +430,7 @@ - Magento\Framework\App\Cache\Type\Config + Magento\Framework\App\Interception\Cache\CompiledConfig\Proxy Magento\Framework\ObjectManager\Config\Reader\Dom\Proxy plugin-list @@ -851,6 +856,7 @@ + Magento\Framework\App\Interception\Cache\CompiledConfig Magento\Framework\Event\Config\Reader\Proxy From 9de3fbce1403caebcf6ac231f02d85319559bb5f Mon Sep 17 00:00:00 2001 From: 4ctobias Date: Fri, 2 Jul 2021 22:55:00 +0200 Subject: [PATCH 02/32] Fixed typo in tracking.phtml - renamed JS-functions "currier" to "carrier" --- .../view/adminhtml/templates/order/tracking.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml index 1f5ce694939f..18fae1994e3a 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml @@ -29,7 +29,7 @@ require(['prototype'], function(){ $('trackingC' + this.index).disabled = false; $('trackingT' + this.index).disabled = false; $('trackingN' + this.index).disabled = false; - this.bindCurrierOnchange(); + this.bindCarrierOnchange(); }, deleteRow : function(event) { var row = Event.findElement(event, 'tr'); @@ -37,17 +37,17 @@ require(['prototype'], function(){ row.parentNode.removeChild(row) } }, - bindCurrierOnchange : function() { + bindCarrierOnchange : function() { var elems = $('tracking_numbers_table').select('.select'); elems.each(function (elem) { if (!elem.onchangeBound) { elem.onchangeBound = true; elem.valueInput = $(elem.parentNode.parentNode).select('.number-title')[0]; - elem.observe('change', this.currierOnchange); + elem.observe('change', this.carrierOnchange); } }.bind(this)); }, - currierOnchange : function(event) { + carrierOnchange : function(event) { var elem = Event.element(event); var option = elem.options[elem.selectedIndex]; if (option.value && option.value != 'custom') { From 5367cbfd5381820b7f1edb05f22d1c6c0e9aeb3c Mon Sep 17 00:00:00 2001 From: Roger Date: Wed, 7 Sep 2022 09:47:13 +0000 Subject: [PATCH 03/32] Issue 36101: Category selection tree in edit product is not in the same order as set in Catalog->Categories --- .../Product/Form/Modifier/Categories.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index f9efaec20186..83db5f3c80f0 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -7,18 +7,18 @@ namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; +use Magento\Backend\Model\Auth\Session; +use Magento\Catalog\Model\Category as CategoryModel; use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; -use Magento\Framework\App\ObjectManager; use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\AuthorizationInterface; use Magento\Framework\DB\Helper as DbHelper; -use Magento\Catalog\Model\Category as CategoryModel; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Serialize\SerializerInterface; -use Magento\Framework\UrlInterface; use Magento\Framework\Stdlib\ArrayManager; -use Magento\Framework\AuthorizationInterface; -use Magento\Backend\Model\Auth\Session; +use Magento\Framework\UrlInterface; /** * Data provider for categories field of product page @@ -52,6 +52,7 @@ class Categories extends AbstractModifier * @var array * @deprecated 101.0.0 * @since 101.0.0 + * @see Not use anymore */ protected $categoriesTrees = []; @@ -128,6 +129,7 @@ public function __construct( * * @return CacheInterface * @deprecated 101.0.3 + * @see getCategoriesTree */ private function getCacheManager(): CacheInterface { @@ -442,6 +444,8 @@ private function retrieveCategoriesTree(int $storeId, array $shownCategoriesIds) $collection->addAttributeToFilter('entity_id', ['in' => array_keys($shownCategoriesIds)]) ->addAttributeToSelect(['name', 'is_active', 'parent_id']) + ->addAttributeToSort('level', 'asc') + ->addAttributeToSort('position', 'asc') ->setStoreId($storeId); $categoryById = [ From 2e3902d40ff8f346a625d9a1863854cd6a1faa4a Mon Sep 17 00:00:00 2001 From: Roger Date: Thu, 8 Sep 2022 08:12:27 +0000 Subject: [PATCH 04/32] Issue 36101: fix review code --- .../Ui/DataProvider/Product/Form/Modifier/Categories.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index 83db5f3c80f0..0bd3ca6b482f 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -8,12 +8,14 @@ namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; use Magento\Backend\Model\Auth\Session; +use Magento\Catalog\Api\Data\CategoryInterface; use Magento\Catalog\Model\Category as CategoryModel; use Magento\Catalog\Model\Locator\LocatorInterface; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; use Magento\Framework\App\CacheInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\AuthorizationInterface; +use Magento\Framework\Data\Collection; use Magento\Framework\DB\Helper as DbHelper; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Serialize\SerializerInterface; @@ -444,8 +446,8 @@ private function retrieveCategoriesTree(int $storeId, array $shownCategoriesIds) $collection->addAttributeToFilter('entity_id', ['in' => array_keys($shownCategoriesIds)]) ->addAttributeToSelect(['name', 'is_active', 'parent_id']) - ->addAttributeToSort('level', 'asc') - ->addAttributeToSort('position', 'asc') + ->addAttributeToSort(CategoryInterface::KEY_LEVEL, Collection::SORT_ORDER_ASC) + ->addAttributeToSort(CategoryInterface::KEY_POSITION, Collection::SORT_ORDER_ASC) ->setStoreId($storeId); $categoryById = [ From fd61257fbf4d07360041f75202e0cf6acd6747c1 Mon Sep 17 00:00:00 2001 From: Roger Date: Fri, 9 Sep 2022 16:00:54 +0000 Subject: [PATCH 05/32] update unit test --- .../Product/Form/Modifier/CategoriesTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index 17318d420784..884a21b5aa50 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -7,15 +7,15 @@ namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier; -use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories; -use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; +use Magento\Authorization\Model\Role; +use Magento\Backend\Model\Auth\Session; use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection; +use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; +use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories; use Magento\Framework\AuthorizationInterface; use Magento\Framework\DB\Helper as DbHelper; use Magento\Framework\UrlInterface; use Magento\Store\Model\Store; -use Magento\Backend\Model\Auth\Session; -use Magento\Authorization\Model\Role; use Magento\User\Model\User; use PHPUnit\Framework\MockObject\MockObject; @@ -93,6 +93,9 @@ protected function setUp(): void $this->categoryCollectionMock->expects($this->any()) ->method('addAttributeToFilter') ->willReturnSelf(); + $this->categoryCollectionMock->expects($this->any()) + ->method('addAttributeToSort') + ->willReturnSelf(); $this->categoryCollectionMock->expects($this->any()) ->method('setStoreId') ->willReturnSelf(); From 15bc1e7f3b0ec9d2d3a2c1368d0983b4e7839018 Mon Sep 17 00:00:00 2001 From: Roger Date: Fri, 23 Sep 2022 06:04:21 +0000 Subject: [PATCH 06/32] Issue 36101: update code --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index 0bd3ca6b482f..32a1005658b6 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -54,7 +54,6 @@ class Categories extends AbstractModifier * @var array * @deprecated 101.0.0 * @since 101.0.0 - * @see Not use anymore */ protected $categoriesTrees = []; From 5851637a17e2993e3813f1d78a31790e7ed615db Mon Sep 17 00:00:00 2001 From: Pratik Oza <33807558+mage2pratik@users.noreply.github.com> Date: Fri, 6 Oct 2023 01:03:53 +0530 Subject: [PATCH 07/32] Correct typo and grammar in acl.xsd file --- lib/internal/Magento/Framework/Acl/etc/acl.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Acl/etc/acl.xsd b/lib/internal/Magento/Framework/Acl/etc/acl.xsd index 147b94cb68cb..8273281a8ac2 100644 --- a/lib/internal/Magento/Framework/Acl/etc/acl.xsd +++ b/lib/internal/Magento/Framework/Acl/etc/acl.xsd @@ -57,7 +57,7 @@ - Item id attribute can has only [a-z0-9/_]. Minimal length 3 symbol. Case insensitive. + Item id attribute can have only [a-z0-9/_]. Minimal length 3 characters. Case insensitive. From 2dc298e2f6a8a19d180ff5e2c5662fd958d8defa Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Wed, 17 Apr 2024 10:19:57 +0200 Subject: [PATCH 08/32] Fixed wrong usage of sprintf, it only takes 2 placeholders here and we gave it 3 arguments. --- .../Consumer/Config/Validator/ConsumerInstance.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Validator/ConsumerInstance.php b/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Validator/ConsumerInstance.php index 5d38fddc8f60..3c69d69969a0 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Validator/ConsumerInstance.php +++ b/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Validator/ConsumerInstance.php @@ -15,7 +15,7 @@ class ConsumerInstance implements ValidatorInterface { /** - * {@inheritdoc} + * @inheritdoc */ public function validate($configData) { @@ -43,7 +43,6 @@ private function validateConsumerInstance($consumerConfig) "'%s' does not exist and thus cannot be used as 'consumerInstance' for '%s' consumer.", $consumerInstance, $consumerConfig['name'], - ConsumerInterface::class ) ); } From 2235083ee87c25e46005be47fdcc4f5a28a838e6 Mon Sep 17 00:00:00 2001 From: Vincent ENJALBERT Date: Thu, 25 Apr 2024 16:12:37 +0200 Subject: [PATCH 09/32] 38662 - Graphql type error fix --- .../Model/Customer/GetCustomSelectedOptionAttributes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/GetCustomSelectedOptionAttributes.php b/app/code/Magento/CustomerGraphQl/Model/Customer/GetCustomSelectedOptionAttributes.php index 8724e57ff11c..72bbc0c4f038 100644 --- a/app/code/Magento/CustomerGraphQl/Model/Customer/GetCustomSelectedOptionAttributes.php +++ b/app/code/Magento/CustomerGraphQl/Model/Customer/GetCustomSelectedOptionAttributes.php @@ -55,7 +55,7 @@ public function execute(string $entityType, array $customAttribute): ?array continue; } $result[] = [ - 'uid' => $this->uid->encode($option->getValue()), + 'uid' => $this->uid->encode((string) $option->getValue()), 'value' => $option->getValue(), 'label' => $option->getLabel() ]; From 8f0387c34e7aee076a5d07a69e589df198fffb59 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Tue, 18 Jun 2024 20:33:01 +0200 Subject: [PATCH 10/32] Remove 'pub/' directory from paths in source maps when compiling css using grunt. --- dev/tools/grunt/configs/less.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tools/grunt/configs/less.js b/dev/tools/grunt/configs/less.js index 9ae376b9e21b..c72b891a5f9b 100644 --- a/dev/tools/grunt/configs/less.js +++ b/dev/tools/grunt/configs/less.js @@ -24,7 +24,7 @@ var lessOptions = { sourceMapRootpath: '/', sourceMapBasepath: function (f) { this.sourceMapURL = this.sourceMapFilename.substr(this.sourceMapFilename.lastIndexOf('/') + 1); - return "/"; + return 'pub/'; }, dumpLineNumbers: false, // use 'comments' instead false to output line comments for source ieCompat: false From a53f8f111aad6cd77b63f96260d973df5186f074 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Wed, 19 Jun 2024 08:23:33 +0200 Subject: [PATCH 11/32] Attempt to fix the static test failures. --- dev/tools/grunt/configs/less.js | 68 ++++++++++++++++----------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/dev/tools/grunt/configs/less.js b/dev/tools/grunt/configs/less.js index c72b891a5f9b..f147b71f3f75 100644 --- a/dev/tools/grunt/configs/less.js +++ b/dev/tools/grunt/configs/less.js @@ -5,47 +5,45 @@ 'use strict'; -var combo = require('./combo'), - themes = require('../tools/files-router').get('themes'), - _ = require('underscore'); - -var themeOptions = {}; +var combo = require('./combo'), + themes = require('../tools/files-router').get('themes'), + _ = require('underscore'), + themeOptions = {}, + lessOptions = { + options: { + sourceMap: true, + strictImports: false, + sourceMapRootpath: '/', + sourceMapBasepath: function () { + this.sourceMapURL = this.sourceMapFilename.substr(this.sourceMapFilename.lastIndexOf('/') + 1); + return 'pub/'; + }, + dumpLineNumbers: false, // use 'comments' instead false to output line comments for source + ieCompat: false + }, + setup: { + files: { + '<%= path.css.setup %>/setup.css': '<%= path.less.setup %>/_setup.less' + } + }, + updater: { + files: { + '<%= path.css.updater %>/updater.css': '<%= path.less.setup %>/_setup.less' + } + }, + documentation: { + files: { + '<%= path.doc %>/docs.css': '<%= path.doc %>/source/docs.less' + } + } + }; -_.each(themes, function(theme, name) { +_.each(themes, function (theme, name) { themeOptions[name] = { files: combo.lessFiles(name) }; }); -var lessOptions = { - options: { - sourceMap: true, - strictImports: false, - sourceMapRootpath: '/', - sourceMapBasepath: function (f) { - this.sourceMapURL = this.sourceMapFilename.substr(this.sourceMapFilename.lastIndexOf('/') + 1); - return 'pub/'; - }, - dumpLineNumbers: false, // use 'comments' instead false to output line comments for source - ieCompat: false - }, - setup: { - files: { - '<%= path.css.setup %>/setup.css': '<%= path.less.setup %>/_setup.less' - } - }, - updater: { - files: { - '<%= path.css.updater %>/updater.css': '<%= path.less.setup %>/_setup.less' - } - }, - documentation: { - files: { - '<%= path.doc %>/docs.css': '<%= path.doc %>/source/docs.less' - } - } -}; - /** * Compiles Less to CSS and generates necessary files if requested. */ From 292dadfbaa59a68d9bdcad1accfb6286d4965ea1 Mon Sep 17 00:00:00 2001 From: Marc Rodriguez Date: Wed, 19 Jun 2024 10:20:07 +0200 Subject: [PATCH 12/32] Fix issue when compiling statics with multiple jobs --- lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index fc84dcafc468..1d8bc6fcda8f 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -432,6 +432,12 @@ private function avoidReusingParentProcessConnection() $this->parentConnections[] = $this->_connection; $this->_connection = null; $this->pid = getmypid(); + + // Reset config host to avoid issue with multiple connections + if (!empty($this->_config['port'])) { + $this->_config['host'] = implode(':', [$this->_config['host'], $this->_config['port']]); + unset($this->_config['port']); + } } } From 3303adab0f88922c62c59e2dbe06187417c80dd6 Mon Sep 17 00:00:00 2001 From: engcom-Charlie Date: Thu, 11 Jul 2024 14:36:30 +0530 Subject: [PATCH 13/32] Fixed static test failure --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php index 32a1005658b6..b7dc6fc86f6e 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php @@ -53,6 +53,7 @@ class Categories extends AbstractModifier /** * @var array * @deprecated 101.0.0 + * @see Nothing * @since 101.0.0 */ protected $categoriesTrees = []; From f260a5cd17c391936c9fcd466e7b0b14284c6451 Mon Sep 17 00:00:00 2001 From: Quterorta Date: Fri, 12 Jul 2024 12:05:19 +0300 Subject: [PATCH 14/32] magento/magento2#38845:"Area code not set" after update to 2.4.5-p8 - fixed issue by providing needed area code as a function argue --- lib/internal/Magento/Framework/App/Area.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/App/Area.php b/lib/internal/Magento/Framework/App/Area.php index 58a690a230b5..75e552281ba3 100644 --- a/lib/internal/Magento/Framework/App/Area.php +++ b/lib/internal/Magento/Framework/App/Area.php @@ -241,7 +241,7 @@ protected function _initConfig() */ protected function _initTranslate() { - $this->_translator->loadData(null, false); + $this->_translator->loadData($this->_code, false); \Magento\Framework\Phrase::setRenderer( $this->_objectManager->get(\Magento\Framework\Phrase\RendererInterface::class) From df8785420de3448adf25dbe89318f6764c39ca62 Mon Sep 17 00:00:00 2001 From: Yaroslav Kozar Date: Fri, 12 Jul 2024 14:15:00 +0300 Subject: [PATCH 15/32] magento#38805: Issue at product import when provided with custom options-type: file - Fixed issue with parsing 'file_extension' data. - Resolved the issue where the price was not set for the file custom-options type. --- .../Model/Import/Product/Option.php | 20 ++- .../Model/Import/Product/Type/OptionTest.php | 134 ++++++++++++++++++ 2 files changed, 152 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php index 548fcff079b8..aa691dee3308 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php @@ -147,7 +147,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity 'radio' => true, 'checkbox' => true, 'multiple' => true, - 'file' => ['sku', 'file_extension', 'image_size_x', 'image_size_y'], + 'file' => ['price', 'sku', 'file_extension', 'image_size_x', 'image_size_y'], ]; /** @@ -2093,10 +2093,26 @@ protected function _parseCustomOptions($rowData) $k = 0; $name = ''; foreach ($optionValues as $optionValue) { + $separator = preg_quote($this->_productEntity->getMultipleValueSeparator(), '/'); + $pattern = '/(?:^|' . $separator . ')file_extension=([a-zA-Z' . $separator . ']+)(?:' . $separator . '|$)/'; + + if (preg_match($pattern, $optionValue, $matches)) { + $fileExtNameAndValue = $matches[0]; + $fileExtNameAndValue = ltrim($fileExtNameAndValue, $separator); + $optionValue = str_replace($fileExtNameAndValue, '', $optionValue); + $fileExtNameAndValue = rtrim($fileExtNameAndValue, $separator); + $optionValue = rtrim($optionValue, $separator); + } + $optionValueParams = explode($this->_productEntity->getMultipleValueSeparator(), $optionValue); + + if (isset($fileExtNameAndValue)) { + $optionValueParams[] = $fileExtNameAndValue; + } + foreach ($optionValueParams as $nameAndValue) { $nameAndValue = explode('=', $nameAndValue); - $value = isset($nameAndValue[1]) ? $nameAndValue[1] : ''; + $value = $nameAndValue[1] ?? ''; $value = trim($value); $fieldName = isset($nameAndValue[0]) ? trim($nameAndValue[0]) : ''; if ($value && ($fieldName === 'name')) { diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php index dd324df8a9a9..0295443b2f83 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php @@ -924,6 +924,140 @@ public static function validateRowStoreViewCodeFieldDataProvider(): array ]; } + /** + * Test parsing different option's type with _parseCustomOptions() method. + * + * @param array $rowData + * @param array $responseData + * + * @return void + * @dataProvider validateParseCustomOptionsDataProvider + * @throws \ReflectionException + */ + public function testValidateParseCustomOptions(array $rowData, array $responseData): void + { + $reflection = new \ReflectionClass(Option::class); + $reflectionMethod = $reflection->getMethod('_parseCustomOptions'); + $result = $reflectionMethod->invoke($this->model, $rowData); + $this->assertEquals($responseData, $result); + } + + /** + * Data provider for testValidateParseCustomOptions. + * + * @return array + */ + public static function validateParseCustomOptionsDataProvider(): array + { + return [ + 'file_type' => [ + '$rowData' => [ + 'custom_options' => 'name=Test Field Title,type=file,required=1,' + . 'sku=1-text,price=12,file_extension=png,jpeg,jpg,gif,image_size_x=1024,' + . 'image_size_y=1024,price_type=fixed' + ], + '$responseData' => [ + 'custom_options' => [ + 'Test Field Title' => [ + [ + 'name' => 'Test Field Title', + 'type' => 'file', + 'required' => '1', + 'sku' => '1-text', + 'price' => '12', + 'file_extension' => 'png,jpeg,jpg,gif', + 'image_size_x' => '1024', + 'image_size_y' => '1024', + 'price_type' => 'fixed' + ] + ] + ] + ] + ], + 'drop_down' => [ + '$rowData' => [ + 'custom_options' => 'name=Test Field Title,type=drop_down,required=0,' + . 'sku=1-text,price=10,price_type=fixed' + ], + '$responseData' => [ + 'custom_options' => [ + 'Test Field Title' => [ + [ + 'name' => 'Test Field Title', + 'type' => 'drop_down', + 'required' => '0', + 'sku' => '1-text', + 'price' => '10', + 'price_type' => 'fixed' + ] + ] + ] + ] + ], + 'field' => [ + '$rowData' => [ + 'custom_options' => 'name=Test Field Title,type=field,required=1' + . ';sku=1-text,price=0,price_type=fixed' + ], + '$responseData' => [ + 'custom_options' => [ + 'Test Field Title' => [ + [ + 'name' => 'Test Field Title', + 'type' => 'field', + 'required' => '1', + 'sku' => '1-text', + 'price' => '0', + 'price_type' => 'fixed' + ] + ] + ] + ] + ], + 'area' => [ + '$rowData' => [ + 'custom_options' => 'name=Test Field Title,type=area,required=1,' + . 'sku=1-text,price=20,max_characters=150,price_type=fixed' + ], + '$responseData' => [ + 'custom_options' => [ + 'Test Field Title' => [ + [ + 'name' => 'Test Field Title', + 'type' => 'area', + 'required' => '1', + 'sku' => '1-text', + 'price' => '20', + 'max_characters' => '150', + 'price_type' => 'fixed' + ] + ] + ] + ] + ], + 'date_time' => [ + '$rowData' => [ + 'custom_options' => 'name=Test Field Title,type=date_time,required=0,' + . 'sku=1-text,price=30,price_type=fixed' + ], + '$responseData' => [ + 'custom_options' => [ + 'Test Field Title' => [ + [ + 'name' => 'Test Field Title', + 'type' => 'date_time', + 'required' => '0', + 'sku' => '1-text', + 'price' => '30', + 'price_type' => 'fixed' + ] + ] + ] + ] + ] + ]; + } + /** * Data provider of row data and errors. * From ee102d6b7edc8f1da9ffacbbce52ade4afa0cd42 Mon Sep 17 00:00:00 2001 From: Yaroslav Kozar Date: Fri, 12 Jul 2024 15:35:57 +0300 Subject: [PATCH 16/32] magento#38805: Fix for Static Test error "ExcessiveMethodLength" --- .../Model/Import/Product/Type/OptionTest.php | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php index 0295443b2f83..9fafb81b3411 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php @@ -994,26 +994,6 @@ public static function validateParseCustomOptionsDataProvider(): array ] ] ], - 'field' => [ - '$rowData' => [ - 'custom_options' => 'name=Test Field Title,type=field,required=1' - . ';sku=1-text,price=0,price_type=fixed' - ], - '$responseData' => [ - 'custom_options' => [ - 'Test Field Title' => [ - [ - 'name' => 'Test Field Title', - 'type' => 'field', - 'required' => '1', - 'sku' => '1-text', - 'price' => '0', - 'price_type' => 'fixed' - ] - ] - ] - ] - ], 'area' => [ '$rowData' => [ 'custom_options' => 'name=Test Field Title,type=area,required=1,' From 1da8655a46e25a4d6e2651545da541b9c9c44e54 Mon Sep 17 00:00:00 2001 From: Oleh Dmytrychenko Date: Fri, 12 Jul 2024 13:10:52 +0300 Subject: [PATCH 17/32] magento/magento2#32990: Date and Time Format for Custom Option Not Working - fixed Catalog Date & Time custom options not honoring Date Fields Order when using JS calendar --- .../Magento/Catalog/Block/Product/View/Options/Type/Date.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php index 291ca3566b2e..46ec18394864 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php +++ b/app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php @@ -93,7 +93,10 @@ public function getCalendarDateHtml() $yearStart = $this->_catalogProductOptionTypeDate->getYearStart(); $yearEnd = $this->_catalogProductOptionTypeDate->getYearEnd(); - $dateFormat = $this->_localeDate->getDateFormatWithLongYear(); + $fieldsSeparator = '/'; + $fieldsOrder = $this->_catalogProductOptionTypeDate->getConfigData('date_fields_order') ?? ''; + $fieldsOrder = str_replace(",", $fieldsSeparator, $fieldsOrder); + $dateFormat = $fieldsOrder ?: $this->_localeDate->getDateFormatWithLongYear(); /** Escape RTL characters which are present in some locales and corrupt formatting */ $escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat); $value = null; From 691786378ecb3e07da3f174908735c89bc5ffc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cengcom-Echo=E2=80=9D?= Date: Tue, 16 Jul 2024 13:14:21 +0530 Subject: [PATCH 18/32] Fixed static test failures --- .../view/adminhtml/templates/order/tracking.phtml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml index 18fae1994e3a..ca192351e4ce 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml @@ -8,6 +8,7 @@ /** * @var $block Magento\Shipping\Block\Adminhtml\Order\Tracking * @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer + * @var $escaper \Magento\Framework\Escaper */ ?> getCarriers() as $_code => $_name): ?> - + @@ -101,7 +102,7 @@ script; type="button" class="action-default action-delete" onclick="trackingControl.deleteRow(event);return false"> - escapeHtml(__('Delete')) ?> + escapeHtml(__('Delete')) ?> @@ -111,10 +112,10 @@ script; - - - - + + + + From ab65056ef6a1ff833aa7720464ea12db9c9ed70b Mon Sep 17 00:00:00 2001 From: Roger Date: Thu, 18 Jul 2024 15:14:43 +0000 Subject: [PATCH 19/32] fix unit test --- .../Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php index e0ee892de4be..a4f5c697c7b5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php @@ -11,8 +11,8 @@ use Magento\Backend\Model\Auth\Session; use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; -use Magento\Framework\App\CacheInterface; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories; +use Magento\Framework\App\CacheInterface; use Magento\Framework\AuthorizationInterface; use Magento\Framework\DB\Helper as DbHelper; use Magento\Framework\UrlInterface; @@ -91,6 +91,9 @@ protected function setUp(): void $this->categoryCollectionMock->expects($this->any()) ->method('addAttributeToSelect') ->willReturnSelf(); + $this->categoryCollectionMock->expects($this->any()) + ->method('addAttributeToSort') + ->willReturnSelf(); $this->categoryCollectionMock->expects($this->any()) ->method('addAttributeToFilter') ->willReturnSelf(); From 09c69c561b3d795ac5abb559204e988564b31d2a Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Thu, 18 Jul 2024 17:47:43 +0200 Subject: [PATCH 20/32] Remove references to files from extjs which got removed in e1ccdb83e7e312572038c476d0695300700db849 --- .../Backend/view/adminhtml/layout/default.xml | 2 - .../adminhtml_email_template_preview.xml | 2 - .../Theme/view/adminhtml/requirejs-config.js | 7 - .../catalog/category/widget/tree.phtml | 208 ------------------ .../Test/Js/_files/whitelist/magento.txt | 1 - 5 files changed, 220 deletions(-) delete mode 100644 app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index 1c28d5fc5935..5edc9400ea93 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -11,8 +11,6 @@ - - diff --git a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml index de3f2b97d5c3..47c284710814 100644 --- a/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml +++ b/app/code/Magento/Email/view/adminhtml/layout/adminhtml_email_template_preview.xml @@ -7,8 +7,6 @@ --> - - diff --git a/app/code/Magento/Theme/view/adminhtml/requirejs-config.js b/app/code/Magento/Theme/view/adminhtml/requirejs-config.js index 948bd2a57c30..504bd86bfb04 100644 --- a/app/code/Magento/Theme/view/adminhtml/requirejs-config.js +++ b/app/code/Magento/Theme/view/adminhtml/requirejs-config.js @@ -5,13 +5,6 @@ var config = { 'shim': { - 'extjs/ext-tree': [ - 'prototype' - ], - 'extjs/ext-tree-checkbox': [ - 'extjs/ext-tree', - 'extjs/defaults' - ], 'jquery/editableMultiselect/js/jquery.editable': [ 'jquery' ] diff --git a/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml deleted file mode 100644 index df8780343376..000000000000 --- a/app/code/Magento/Widget/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ /dev/null @@ -1,208 +0,0 @@ - - -getId() ?> -
-getUseMassaction() ? 1 : 0; -$isAnchorOnly = /* @noEscape */ $block->getIsAnchorOnly() ? 1 : 0; -$nodeClickListener = /* @noEscape */ $block->getNodeClickListener(); -$withEmpltyNode = /* @noEscape */ ($block->getWithEmptyNode() ? 'false' : 'true'); -$isVisible = (bool) $block->getRoot()->getIsVisible(); -$categoryId = (int) $block->getCategoryId(); -$rootId = (int) $block->getRoot()->getId(); -$isWasExpanded = (int) $block->getIsWasExpanded(); -$treeJson = /* @noEscape */ $block->getTreeJson(); -$scriptString = <<
escapeHtml(__('Carrier')) ?>escapeHtml(__('Title')) ?>escapeHtml(__('Number')) ?>escapeHtml(__('Action')) ?>escapeHtml(__('Carrier')) ?>escapeHtml(__('Title')) ?>escapeHtml(__('Number')) ?>escapeHtml(__('Action')) ?>