Skip to content

Commit

Permalink
Added support for Magento 2.4.1 (#74)
Browse files Browse the repository at this point in the history
* Added support for Magento 2.4.1

* Removed hard-coded version
  • Loading branch information
alfredsgenkins authored Nov 5, 2020
1 parent c11f4fe commit b577eba
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 375 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"magento/module-rule": "*",
"magento/module-graph-ql": "*",
"magento/module-store": "*",
"magento/module-elasticsearch": "^101",
"magento/module-catalog-graph-ql": "^100.4",
"magento/module-elasticsearch": "*",
"magento/module-catalog-graph-ql": "^100.4.1",
"magento/module-configurable-product-graph-ql": "^100.3",
"magento/module-bundle-graph-ql": "^100.3",
"magento/module-swatches": "*",
Expand Down
114 changes: 0 additions & 114 deletions src/Model/Resolver/CategoryTree.php

This file was deleted.

25 changes: 22 additions & 3 deletions src/Model/Resolver/GroupedItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@

namespace ScandiPWA\CatalogGraphQl\Model\Resolver;

use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Deferred\Product;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\GroupedProduct\Model\Product\Type\Grouped as GroupedAlias;
use Magento\GroupedProduct\Model\ResourceModel\Product\Link;
use ScandiPWA\Performance\Model\Resolver\ResolveInfoFieldsTrait;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\GroupedProduct\Model\Product\Initialization\Helper\ProductLinks\Plugin\Grouped;
use Magento\Catalog\Api\Data\ProductLinkInterface;
use ScandiPWA\Performance\Model\Resolver\Products\DataPostProcessor;
use ScandiPWA\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product as ProductDataProvider;

use Magento\GroupedProductGraphQl\Model\Resolver\GroupedItems as MagentoGroupedItems;

/**
* Class ConfigurableVariant
*
* @package ScandiPWA\CatalogGraphQl\Model\Resolver
*/
class GroupedItems implements ResolverInterface
class GroupedItems extends MagentoGroupedItems
{
use ResolveInfoFieldsTrait;

Expand All @@ -45,14 +49,26 @@ class GroupedItems implements ResolverInterface
*/
protected $productDataProvider;

/**
* @var GroupedAlias
*/
protected $grouped;

public function __construct(
SearchCriteriaBuilder $searchCriteriaBuilder,
DataPostProcessor $postProcessor,
ProductDataProvider $productDataProvider
ProductDataProvider $productDataProvider,
Product $productResolver,
GroupedAlias $grouped
) {
parent::__construct(
$productResolver
);

$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->postProcessor = $postProcessor;
$this->productDataProvider = $productDataProvider;
$this->grouped = $grouped;
}

/**
Expand All @@ -72,6 +88,9 @@ public function resolve(
$itemData = [];
$productSKUs = [];
$productModel = $value['model'];

// This fix allows to request min / max price and grouped items
$this->grouped->flushAssociatedProductsCache($productModel);
$links = $productModel->getProductLinks();

foreach ($links as $link) {
Expand Down
Loading

0 comments on commit b577eba

Please sign in to comment.