Skip to content

Commit 9fa9af8

Browse files
committed
Merge remote-tracking branch 'l3/ACP2E-677' into PR_L3_05_04_2022
2 parents cd80024 + 97c74f4 commit 9fa9af8

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ public function save(ProductInterface $product, $saveOptions = false)
607607
if ($existingProduct->getData($attributeCode) === $value
608608
&& $attribute->getScope() !== EavAttributeInterface::SCOPE_GLOBAL_TEXT
609609
&& !is_array($value)
610-
&& $attribute->getData('frontend_input') !== 'media_image'
611610
&& !$attribute->isStatic()
612611
&& !array_key_exists($attributeCode, $productDataToChange)
613612
&& $value !== null

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiWebsiteTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,38 @@ public function testUpdatePrice(): void
383383
$this->assertEquals(8, $secondWebsiteStore2Response['special_price']);
384384
}
385385

386+
/**
387+
* @magentoApiDataFixture Magento/Store/_files/second_website_with_two_stores.php
388+
* @magentoApiDataFixture Magento/Catalog/_files/product_with_image.php
389+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
390+
*/
391+
public function testPartialUpdateShouldNotOverrideImagesRolesInheritance(): void
392+
{
393+
$sku = 'simple';
394+
$name = 'Product Simple edited';
395+
$store = $this->objectManager->get(Store::class);
396+
$storeId = (int) $store->load('fixture_third_store', 'code')->getId();
397+
/** @var ProductRepositoryInterface $productRepository */
398+
$productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
399+
$product = $productRepository->get($sku);
400+
$request = [
401+
ProductInterface::SKU => $sku,
402+
ProductInterface::NAME => $name,
403+
];
404+
$response = $this->saveProduct($request, 'fixture_third_store');
405+
$this->assertEquals($name, $response['name']);
406+
$this->assertOverriddenValues(
407+
[
408+
'name' => true,
409+
'image' => false,
410+
'small_image' => false,
411+
'thumbnail' => false,
412+
],
413+
$product,
414+
$storeId
415+
);
416+
}
417+
386418
/**
387419
* @param array $expected
388420
* @param array $actual

0 commit comments

Comments
 (0)