Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
ENGCOM-4135: [256] Fixed variant collection #331
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav authored Feb 11, 2019
2 parents 93498ff + 6f9276a commit 77549f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Catalog\Model\Product;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
Expand Down Expand Up @@ -45,12 +46,14 @@ public function resolve(
$data = [];
foreach ($value['options'] as $option) {
$code = $option['attribute_code'];
if (!isset($value['product']['model'][$code])) {
/** @var Product|null $model */
$model = $value['product']['model'] ?? null;
if (!$model || !$model->getData($code)) {
continue;
}

foreach ($option['values'] as $optionValue) {
if ($optionValue['value_index'] != $value['product']['model'][$code]) {
if ($optionValue['value_index'] != $model->getData($code)) {
continue;
}
$data[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ public function testQueryConfigurableProductLinks()
/**
* @var ProductRepositoryInterface $productRepository
*/

$productRepository = ObjectManager::getInstance()->get(ProductRepositoryInterface::class);
$product = $productRepository->get($productSku, false, null, true);

Expand Down

0 comments on commit 77549f9

Please sign in to comment.