Skip to content

Commit d9fd94c

Browse files
committed
AC-2904-v1:: Saving product with non-default store scope causes untouched attributes to become store scoped if loaded using ProductRepository
1 parent 1bcb114 commit d9fd94c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
namespace Magento\Catalog\Model;
88

99
use Magento\Catalog\Api\CategoryLinkManagementInterface;
10+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
1011
use Magento\Catalog\Api\Data\ProductExtension;
1112
use Magento\Catalog\Api\Data\ProductInterface;
12-
use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter;
1313
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
1414
use Magento\Catalog\Model\Product\Gallery\MimeTypeExtensionMap;
1515
use Magento\Catalog\Model\ProductRepository\MediaGalleryProcessor;
@@ -187,7 +187,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
187187
*/
188188
private $scopeOverriddenValue;
189189

190-
191190
/**
192191
* ProductRepository constructor.
193192
* @param ProductFactory $productFactory
@@ -261,8 +260,6 @@ public function __construct(
261260
$this->contentFactory = $contentFactory;
262261
$this->imageProcessor = $imageProcessor;
263262
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
264-
$this->attributeFilter = $attributeFilter ?: \Magento\Framework\App\ObjectManager::getInstance()
265-
->get(AttributeFilter::class);
266263
$this->collectionProcessor = $collectionProcessor ?: $this->getCollectionProcessor();
267264
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
268265
->get(\Magento\Framework\Serialize\Serializer\Json::class);
@@ -597,7 +594,7 @@ public function save(ProductInterface $product, $saveOptions = false)
597594
$productAttributes = $product->getAttributes();
598595
if ($productAttributes !== null
599596
&& $product->getStoreId() !== Store::DEFAULT_STORE_ID
600-
&& (count($stores) > 1 || count($websites) >= 1)
597+
&& (count($stores) > 1 || count($websites) === 1)
601598
) {
602599
foreach ($productAttributes as $attribute) {
603600
$attributeCode = $attribute->getAttributeCode();

0 commit comments

Comments
 (0)