Skip to content

Commit eab2af3

Browse files
committed
ACP2E-2978: Saving product by admin user with different role scope overwrites/deletes existing Related product information in the product
1 parent 124d785 commit eab2af3

File tree

1 file changed

+2
-4
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization

1 file changed

+2
-4
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,9 @@ protected function setProductLinks(Product $product)
302302
unset($linkTypes[$productLink->getLinkType()]);
303303
}
304304

305-
$isReadOnlyUpSellItems = false;
306305
foreach ($linkTypes as $linkType => $readonly) {
307-
$isReadOnlyRelatedItems = $readonly && $linkType === 'related' ||
308-
($isReadOnlyUpSellItems = $readonly && $linkType === 'upsell');
309-
if ($isReadOnlyRelatedItems && $isReadOnlyUpSellItems) {
306+
$isReadOnlyLinks = $readonly && in_array($linkType, ['upsell', 'related']);
307+
if ($isReadOnlyLinks) {
310308
$productLinks = null;
311309
break;
312310
} else {

0 commit comments

Comments
 (0)