Skip to content

Commit da7f499

Browse files
committed
ConfigurableProduct validator, first check if array item exists
$productData['configurable_attribute'] is not required but its assumed to be set. This can give issues when its not set at all. Here we just check if its set before using it. Signed-off-by: Ike Devolder <[email protected]>
1 parent ebba9e7 commit da7f499

File tree

1 file changed

+5
-3
lines changed
  • app/code/Magento/ConfigurableProduct/Model/Product/Validator

1 file changed

+5
-3
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ protected function _validateProductVariations(Product $parentProduct, array $pro
112112
$product->addData($productData);
113113
$product->setCollectExceptionMessages(true);
114114
$configurableAttribute = [];
115-
$encodedData = $productData['configurable_attribute'];
116-
if ($encodedData) {
117-
$configurableAttribute = $this->jsonHelper->jsonDecode($encodedData);
115+
if (!empty($productData['configurable_attribute'])) {
116+
$encodedData = $productData['configurable_attribute'];
117+
if ($encodedData) {
118+
$configurableAttribute = $this->jsonHelper->jsonDecode($encodedData);
119+
}
118120
}
119121
$configurableAttribute = implode('-', $configurableAttribute);
120122

0 commit comments

Comments
 (0)