From 53b25c780dca13caf188675334c5c23945c67207 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 20:46:22 +0100 Subject: [PATCH 01/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Reordering Description/Short Description Product Attributes --- app/code/Magento/Catalog/Setup/CategorySetup.php | 16 ++++++++-------- .../Setup/Patch/Data/UpdateProductAttributes.php | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index f8542454bef92..9f12f68fb9beb 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -421,9 +421,9 @@ public function getDefaultEntities() 'comparable' => true, 'visible_in_advanced_search' => true, ], - 'description' => [ + 'short_description' => [ 'type' => 'text', - 'label' => 'Description', + 'label' => 'Short Description', 'input' => 'textarea', 'sort_order' => 3, 'global' => ScopedAttributeInterface::SCOPE_STORE, @@ -432,10 +432,14 @@ public function getDefaultEntities() 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_in_advanced_search' => true, + 'used_in_product_listing' => true, + 'is_used_in_grid' => true, + 'is_visible_in_grid' => false, + 'is_filterable_in_grid' => false, ], - 'short_description' => [ + 'description' => [ 'type' => 'text', - 'label' => 'Short Description', + 'label' => 'Description', 'input' => 'textarea', 'sort_order' => 4, 'global' => ScopedAttributeInterface::SCOPE_STORE, @@ -444,10 +448,6 @@ public function getDefaultEntities() 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_in_advanced_search' => true, - 'used_in_product_listing' => true, - 'is_used_in_grid' => true, - 'is_visible_in_grid' => false, - 'is_filterable_in_grid' => false, ], 'price' => [ 'type' => 'decimal', diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php index d02753d44adee..31a5ac46a9297 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php @@ -113,14 +113,15 @@ public function apply() \Magento\Catalog\Model\Product::ENTITY, $attributeSetId, 'Content', - 'description' + 'short_description', + 100 ); $categorySetup->addAttributeToGroup( \Magento\Catalog\Model\Product::ENTITY, $attributeSetId, 'Content', - 'short_description', - 100 + 'description', + 110 ); //Images tab From 00650a86825d4261055ea8f096d4f3b416d347e2 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 21:24:02 +0100 Subject: [PATCH 02/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Partially Reverting 53b25c780dca13caf188675334c5c23945c67207 --- .../Catalog/Setup/Patch/Data/UpdateProductAttributes.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php index 31a5ac46a9297..d02753d44adee 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductAttributes.php @@ -113,15 +113,14 @@ public function apply() \Magento\Catalog\Model\Product::ENTITY, $attributeSetId, 'Content', - 'short_description', - 100 + 'description' ); $categorySetup->addAttributeToGroup( \Magento\Catalog\Model\Product::ENTITY, $attributeSetId, 'Content', - 'description', - 110 + 'short_description', + 100 ); //Images tab From eb09069eb6e060343c47ba506b81ffa30485e649 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 21:48:05 +0100 Subject: [PATCH 03/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Adding New Patch --- .../Data/UpdateProductDescriptionOrder.php | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php new file mode 100644 index 0000000000000..77fcedd8c6272 --- /dev/null +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -0,0 +1,109 @@ +moduleDataSetup = $moduleDataSetup; + $this->categorySetupFactory = $categorySetupFactory; + } + + /** + * {@inheritdoc} + */ + public function apply() + { + /** @var CategorySetup $categorySetup */ + $categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]); + $attributeSetId = $categorySetup->getDefaultAttributeSetId(\Magento\Catalog\Model\Product::ENTITY); + + // Content + $categorySetup->addAttributeGroup( + \Magento\Catalog\Model\Product::ENTITY, + $attributeSetId, + 'Content', + 15 + ); + $categorySetup->updateAttributeGroup( + \Magento\Catalog\Model\Product::ENTITY, + $attributeSetId, + 'Content', + 'tab_group_code', + 'basic' + ); + $categorySetup->addAttributeToGroup( + \Magento\Catalog\Model\Product::ENTITY, + $attributeSetId, + 'Content', + 'short_description', + 100 + ); + $categorySetup->addAttributeToGroup( + \Magento\Catalog\Model\Product::ENTITY, + $attributeSetId, + 'Content', + 'description', + 110 + ); + } + + /** + * {@inheritdoc} + */ + public static function getDependencies() + { + return [ + UpdateMediaAttributesBackendTypes::class, + ]; + } + + /** + * {@inheritdoc} + */ + public static function getVersion() + { + return '2.3.5'; + } + + /** + * {@inheritdoc} + */ + public function getAliases() + { + return []; + } +} From 67851de528fc47469ea41ec1c2537f3f8df0c66f Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 21:49:44 +0100 Subject: [PATCH 04/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Refactoring --- .../Setup/Patch/Data/UpdateProductDescriptionOrder.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php index 77fcedd8c6272..873296bfcf145 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -8,17 +8,15 @@ use Magento\Catalog\Setup\CategorySetup; use Magento\Catalog\Setup\CategorySetupFactory; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; -use Magento\Framework\Setup\Patch\PatchVersionInterface; /** * Class UpdateProductDescriptionOrder * * @package Magento\Catalog\Setup\Patch */ -class UpdateProductDescriptionOrder implements DataPatchInterface, PatchVersionInterface +class UpdateProductDescriptionOrder implements DataPatchInterface { /** * @var ModuleDataSetupInterface From 374e86f9d7a6dea1ff6ea5a05afda19176568be5 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 22:04:01 +0100 Subject: [PATCH 05/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Code Review Feedback/Amends --- .../Setup/Patch/Data/UpdateProductDescriptionOrder.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php index 873296bfcf145..42d9339fdd6d8 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -89,14 +89,6 @@ public static function getDependencies() ]; } - /** - * {@inheritdoc} - */ - public static function getVersion() - { - return '2.3.5'; - } - /** * {@inheritdoc} */ From 6e8867f80436afdd2dd75051e62e572ca7191ba0 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Wed, 22 Jul 2020 22:21:00 +0100 Subject: [PATCH 06/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Refactoring --- .../Data/UpdateProductDescriptionOrder.php | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php index 42d9339fdd6d8..5b6d2627f65c9 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -47,34 +47,21 @@ public function apply() { /** @var CategorySetup $categorySetup */ $categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]); - $attributeSetId = $categorySetup->getDefaultAttributeSetId(\Magento\Catalog\Model\Product::ENTITY); + $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); // Content - $categorySetup->addAttributeGroup( - \Magento\Catalog\Model\Product::ENTITY, - $attributeSetId, - 'Content', - 15 - ); - $categorySetup->updateAttributeGroup( - \Magento\Catalog\Model\Product::ENTITY, - $attributeSetId, - 'Content', - 'tab_group_code', - 'basic' - ); - $categorySetup->addAttributeToGroup( - \Magento\Catalog\Model\Product::ENTITY, - $attributeSetId, - 'Content', + $categorySetup->updateAttribute( + $entityTypeId, 'short_description', + 'frontend_label', + 'Short Description', 100 ); - $categorySetup->addAttributeToGroup( - \Magento\Catalog\Model\Product::ENTITY, - $attributeSetId, - 'Content', + $categorySetup->updateAttribute( + $entityTypeId, 'description', + 'frontend_label', + 'Description', 110 ); } From 8b5cb3db6e8c14b9741920268e62520f767074fe Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Fri, 24 Jul 2020 10:07:00 +0100 Subject: [PATCH 07/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Fixing Static Tests --- .../Setup/Patch/Data/UpdateProductDescriptionOrder.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php index 5b6d2627f65c9..c0377298e5a13 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -12,9 +12,7 @@ use Magento\Framework\Setup\Patch\DataPatchInterface; /** - * Class UpdateProductDescriptionOrder - * - * @package Magento\Catalog\Setup\Patch + * Reorder Short Description/Description Product Attributes */ class UpdateProductDescriptionOrder implements DataPatchInterface { @@ -41,7 +39,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { @@ -67,7 +65,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -77,7 +75,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { From b74061c4e0acbc2d1cf8cda6695fc6cee04f099a Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Fri, 24 Jul 2020 10:23:06 +0100 Subject: [PATCH 08/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Fixing Unit Tests --- app/code/Magento/Catalog/Setup/CategorySetup.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Catalog/Setup/CategorySetup.php b/app/code/Magento/Catalog/Setup/CategorySetup.php index 9f12f68fb9beb..f8542454bef92 100644 --- a/app/code/Magento/Catalog/Setup/CategorySetup.php +++ b/app/code/Magento/Catalog/Setup/CategorySetup.php @@ -421,9 +421,9 @@ public function getDefaultEntities() 'comparable' => true, 'visible_in_advanced_search' => true, ], - 'short_description' => [ + 'description' => [ 'type' => 'text', - 'label' => 'Short Description', + 'label' => 'Description', 'input' => 'textarea', 'sort_order' => 3, 'global' => ScopedAttributeInterface::SCOPE_STORE, @@ -432,14 +432,10 @@ public function getDefaultEntities() 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_in_advanced_search' => true, - 'used_in_product_listing' => true, - 'is_used_in_grid' => true, - 'is_visible_in_grid' => false, - 'is_filterable_in_grid' => false, ], - 'description' => [ + 'short_description' => [ 'type' => 'text', - 'label' => 'Description', + 'label' => 'Short Description', 'input' => 'textarea', 'sort_order' => 4, 'global' => ScopedAttributeInterface::SCOPE_STORE, @@ -448,6 +444,10 @@ public function getDefaultEntities() 'wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_in_advanced_search' => true, + 'used_in_product_listing' => true, + 'is_used_in_grid' => true, + 'is_visible_in_grid' => false, + 'is_filterable_in_grid' => false, ], 'price' => [ 'type' => 'decimal', From 1bd733a10038b96662e4a681e679f8aa1f9a6da6 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Fri, 24 Jul 2020 13:50:33 +0100 Subject: [PATCH 09/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Fixing Functional Tests --- .../Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml | 3 ++- .../Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml index d86a696880bae..dbc6fcb9e3265 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml @@ -32,6 +32,7 @@ + @@ -67,7 +68,7 @@ - + diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml index 1e4adedfc168d..aef4d88490500 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml @@ -44,7 +44,7 @@ - + From 2357344c1679cd65598b337781167b992b681845 Mon Sep 17 00:00:00 2001 From: Matt Walters Date: Fri, 24 Jul 2020 15:18:22 +0100 Subject: [PATCH 10/10] magento/magento2-page-builder#543: Content Product Attributes Default Sorting Order - Fixing Static Tests --- .../Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php index c0377298e5a13..db113448eb238 100644 --- a/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php +++ b/app/code/Magento/Catalog/Setup/Patch/Data/UpdateProductDescriptionOrder.php @@ -62,6 +62,8 @@ public function apply() 'Description', 110 ); + + return $this; } /**