Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magento/magento2-page-builder#543: Content Product Attributes Default… #29238

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/code/Magento/Catalog/Setup/CategorySetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omiroshnichenko @bluemwhitew do we need to add new integration tests for these new php functions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Catalog\Setup\Patch\Data;

use Magento\Catalog\Setup\CategorySetup;
use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Class UpdateProductDescriptionOrder
*
* @package Magento\Catalog\Setup\Patch
*/
class UpdateProductDescriptionOrder implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var CategorySetupFactory
*/
private $categorySetupFactory;

/**
* @param ModuleDataSetupInterface $moduleDataSetup
* @param CategorySetupFactory $categorySetupFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
CategorySetupFactory $categorySetupFactory
) {
$this->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()
bluemwhitew marked this conversation as resolved.
Show resolved Hide resolved
{
return '2.3.5';
}

/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
}