Skip to content

Commit 42311fa

Browse files
Merge pull request #5964 from magento-obsessive-owls/543_product-attributes-default-sorting-order
[Story] 543: Content Product Attributes Default Sorting Order
2 parents 1452016 + f63c6f5 commit 42311fa

File tree

3 files changed

+89
-2
lines changed

3 files changed

+89
-2
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Setup\Patch\Data;
8+
9+
use Magento\Catalog\Setup\CategorySetup;
10+
use Magento\Catalog\Setup\CategorySetupFactory;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
14+
/**
15+
* Reorder Short Description/Description Product Attributes
16+
*/
17+
class UpdateProductDescriptionOrder implements DataPatchInterface
18+
{
19+
/**
20+
* @var ModuleDataSetupInterface
21+
*/
22+
private $moduleDataSetup;
23+
24+
/**
25+
* @var CategorySetupFactory
26+
*/
27+
private $categorySetupFactory;
28+
29+
/**
30+
* @param ModuleDataSetupInterface $moduleDataSetup
31+
* @param CategorySetupFactory $categorySetupFactory
32+
*/
33+
public function __construct(
34+
ModuleDataSetupInterface $moduleDataSetup,
35+
CategorySetupFactory $categorySetupFactory
36+
) {
37+
$this->moduleDataSetup = $moduleDataSetup;
38+
$this->categorySetupFactory = $categorySetupFactory;
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function apply()
45+
{
46+
/** @var CategorySetup $categorySetup */
47+
$categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
48+
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
49+
50+
// Content
51+
$categorySetup->updateAttribute(
52+
$entityTypeId,
53+
'short_description',
54+
'frontend_label',
55+
'Short Description',
56+
100
57+
);
58+
$categorySetup->updateAttribute(
59+
$entityTypeId,
60+
'description',
61+
'frontend_label',
62+
'Description',
63+
110
64+
);
65+
66+
return $this;
67+
}
68+
69+
/**
70+
* @inheritdoc
71+
*/
72+
public static function getDependencies()
73+
{
74+
return [
75+
UpdateMediaAttributesBackendTypes::class,
76+
];
77+
}
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
public function getAliases()
83+
{
84+
return [];
85+
}
86+
}

app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillBasicProductInfo" />
3333

3434
<click selector="{{AdminProductFormSection.contentTab}}" stepKey="clickContentTab" />
35+
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToDescription" />
3536
<waitForElementVisible selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="waitForDescription" />
3637
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon1" />
3738
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse1" />
@@ -67,7 +68,7 @@
6768
<fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.ImageDescription}}" userInput="{{ImageUpload1.content}}" stepKey="fillImageDescription1" />
6869
<fillField selector="{{ProductDescriptionWYSIWYGToolbarSection.Height}}" userInput="{{ImageUpload1.height}}" stepKey="fillImageHeight1" />
6970
<click selector="{{ProductDescriptionWYSIWYGToolbarSection.OkBtn}}" stepKey="clickOkBtn1" />
70-
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.TinyMCE4}}" stepKey="scrollToTinyMCE4" />
71+
<scrollTo selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToTinyMCE4" />
7172
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageIcon}}" stepKey="clickInsertImageIcon2" />
7273
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.Browse}}" stepKey="clickBrowse2" />
7374
<waitForLoadingMaskToDisappear stepKey="waitForLoading13"/>

app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<see selector="{{ProductDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage1"/>
4545
<dontSee selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="insertWidget1" />
4646
<dontSee selector="{{TinyMCESection.InsertVariableBtn}}" stepKey="insertVariable1" />
47-
<scrollTo selector="{{ProductDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="scrollToDesShowHideBtn2" />
47+
<scrollTo selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" y="-150" x="0" stepKey="scrollToDesShowHideBtn2" />
4848
<click selector="{{ProductShortDescriptionWYSIWYGToolbarSection.showHideBtn}}" stepKey="clickShowHideBtn2" />
4949
<waitForElementVisible selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" stepKey="waitForInsertImage2" />
5050
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertImageBtn}}" userInput="Insert Image..." stepKey="seeInsertImage2"/>

0 commit comments

Comments
 (0)