Skip to content

Commit 5256cd5

Browse files
committed
ACP2E-3410: Configurable product edit form load causes timeout and memory exhaustion
1 parent c008fd6 commit 5256cd5

File tree

2 files changed

+239
-60
lines changed
  • app/code/Magento/ConfigurableProduct
    • Block/Adminhtml/Product/Edit/Tab/Variations/Config
    • Test/Unit/Block/Adminhtml/Product/Edit/Tab/Variations/Config

2 files changed

+239
-60
lines changed

app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Variations/Config/Matrix.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function __construct(
8989
LocatorInterface $locator,
9090
array $data = []
9191
) {
92-
parent::__construct($context, $data);
92+
parent::__construct($context, $data, $data['jsonHelper'] ?? null, $data['directoryHelper'] ?? null);
9393
$this->_configurableType = $configurableType;
9494
$this->stockRegistry = $stockRegistry;
9595
$this->variationMatrix = $variationMatrix;
@@ -278,7 +278,7 @@ private function getVariantAttributeComposition(): array
278278
protected function _getAssociatedProducts()
279279
{
280280
$product = $this->getProduct();
281-
$ids = $this->getProduct()->getAssociatedProductIds();
281+
$ids = $product->getAssociatedProductIds();
282282
if ($ids === null) {
283283
// form data overrides any relations stored in database
284284
return $this->_configurableType->getUsedProducts($product);
@@ -378,13 +378,13 @@ private function buildAttributeDetails(AbstractAttribute $attribute): array
378378
];
379379

380380
foreach ($attribute->getOptions() as $option) {
381-
if (!empty($option['value'])) {
381+
if ($option->getValue()) {
382382
$details['options'][] = [
383383
'attribute_code' => $attribute->getAttributeCode(),
384384
'attribute_label' => $attribute->getStoreLabel(0),
385-
'id' => $option['value'],
386-
'label' => $option['label'],
387-
'value' => $option['value'],
385+
'id' => $option->getValue(),
386+
'label' => $option->getLabel(),
387+
'value' => $option->getValue(),
388388
'__disableTmpl' => true,
389389
];
390390
}
@@ -415,10 +415,10 @@ private function buildChildProductOption(array $attributeDetails): array
415415
* Get label for a specific value of an attribute.
416416
*
417417
* @param AbstractAttribute $attribute
418-
* @param int $valueId
418+
* @param mixed $valueId
419419
* @return string
420420
*/
421-
private function extractAttributeValueLabel(AbstractAttribute $attribute, int $valueId): string
421+
private function extractAttributeValueLabel(AbstractAttribute $attribute, mixed $valueId): string
422422
{
423423
foreach ($attribute->getOptions() as $attributeOption) {
424424
if ($attributeOption->getValue() == $valueId) {

0 commit comments

Comments
 (0)