diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index dec89ab52ff89d9275791fde97f7f2d4024de97d..5ed9016a59f6a799258ad17cee50c43c614ead97 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -31,12 +31,18 @@ class Advanced extends Generic */ protected $_yesNo; + /** + * @var array + */ + protected $disableScopeChangeList; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Data\FormFactory $formFactory * @param Yesno $yesNo * @param Data $eavData + * @param array $disableScopeChangeList * @param array $data */ public function __construct( @@ -45,10 +51,12 @@ class Advanced extends Generic \Magento\Framework\Data\FormFactory $formFactory, Yesno $yesNo, Data $eavData, + array $disableScopeChangeList = ['sku'], array $data = [] ) { $this->_yesNo = $yesNo; $this->_eavData = $eavData; + $this->disableScopeChangeList = $disableScopeChangeList; parent::__construct($context, $registry, $formFactory, $data); } @@ -229,7 +237,7 @@ class Advanced extends Generic ); $this->_eventManager->dispatch('product_attribute_form_build', ['form' => $form]); - if ($attributeObject->getId() && !$attributeObject->getIsUserDefined()) { + if (in_array($attributeObject->getAttributeCode(), $this->disableScopeChangeList)) { $form->getElement('is_global')->setDisabled(1); } $this->setForm($form); diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php index a54834d4f56966f448480c1000f1f98ba45c4356..7408df0ede1d678644939f92c9055007e97e3759 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Attribute/Edit/Tab/AdvancedTest.php @@ -89,7 +89,7 @@ class AdvancedTest extends \PHPUnit_Framework_TestCase $this->localeDate->expects($this->any())->method('getDateFormat')->willReturn('mm/dd/yy'); $entityType->expects($this->any())->method('getEntityTypeCode')->willReturn('entity_type_code'); $this->eavData->expects($this->any())->method('getFrontendClasses')->willReturn([]); - $formElement->expects($this->exactly(3))->method('setDisabled')->willReturnSelf(); + $formElement->expects($this->exactly(2))->method('setDisabled')->willReturnSelf(); $this->yesNo->expects($this->any())->method('toOptionArray')->willReturn(['yes', 'no']); $this->filesystem->expects($this->any())->method('getDirectoryRead')->willReturn($directoryReadInterface); $directoryReadInterface->expects($this->any())->method('getRelativePath')->willReturn('relative_path');