Skip to content

Commit 77549f9

Browse files
authored
ENGCOM-4135: [256] Fixed variant collection #331
2 parents 93498ff + 6f9276a commit 77549f9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
1111
use Magento\Framework\GraphQl\Query\Resolver\Value;
12+
use Magento\Catalog\Model\Product;
1213
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1314
use Magento\Framework\GraphQl\Config\Element\Field;
1415
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -45,12 +46,14 @@ public function resolve(
4546
$data = [];
4647
foreach ($value['options'] as $option) {
4748
$code = $option['attribute_code'];
48-
if (!isset($value['product']['model'][$code])) {
49+
/** @var Product|null $model */
50+
$model = $value['product']['model'] ?? null;
51+
if (!$model || !$model->getData($code)) {
4952
continue;
5053
}
5154

5255
foreach ($option['values'] as $optionValue) {
53-
if ($optionValue['value_index'] != $value['product']['model'][$code]) {
56+
if ($optionValue['value_index'] != $model->getData($code)) {
5457
continue;
5558
}
5659
$data[] = [

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ public function testQueryConfigurableProductLinks()
206206
/**
207207
* @var ProductRepositoryInterface $productRepository
208208
*/
209-
210209
$productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class);
211210
$product = $productRepository->get($productSku, false, null, true);
212211

0 commit comments

Comments
 (0)