Skip to content

Commit 9e866ae

Browse files
committed
ACP2E-2464: [Cloud] Can not save configurable child product by admin user with website permission
- testing solution
1 parent 1819863 commit 9e866ae

File tree

1 file changed

+13
-9
lines changed
  • app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule

1 file changed

+13
-9
lines changed

app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/Validation.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,19 @@ public function afterValidate(Rule $rule, $validateResult, DataObject $product)
4949
{
5050
if (!$validateResult && ($configurableProducts = $this->configurable->getParentIdsByChild($product->getId()))) {
5151
foreach ($configurableProducts as $configurableProductId) {
52-
$configurableProduct = $this->productRepository->getById(
53-
$configurableProductId,
54-
false,
55-
$product->getStoreId()
56-
);
57-
$validateResult = $rule->getConditions()->validate($configurableProduct);
58-
// If any of configurable product is valid for current rule, then their sub-product must be valid too
59-
if ($validateResult) {
60-
break;
52+
try {
53+
$configurableProduct = $this->productRepository->getById(
54+
$configurableProductId,
55+
false,
56+
$product->getStoreId()
57+
);
58+
$validateResult = $rule->getConditions()->validate($configurableProduct);
59+
// If any of configurable product is valid for current rule, then their sub-product must be valid too
60+
if ($validateResult) {
61+
break;
62+
}
63+
} catch (\Exception $e) {
64+
continue;
6165
}
6266
}
6367
}

0 commit comments

Comments
 (0)