Skip to content

Commit

Permalink
Merge pull request #119 from riha112/3267
Browse files Browse the repository at this point in the history
Bundle label fix for 2.4.3
  • Loading branch information
carinadues authored Sep 13, 2021
2 parents 2439206 + cb0a5d0 commit c6915d4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/Model/Resolver/Product/BundleLabel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* ScandiPWA_CatalogGraphQl
*
* @category ScandiPWA
* @package ScandiPWA_CatalogGraphQl
* @author <[email protected]>
* @copyright Copyright (c) 2018 Scandiweb, Ltd (https://scandiweb.com)
*/
declare(strict_types=1);

namespace ScandiPWA\CatalogGraphQl\Model\Resolver\Product;

use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\BundleGraphQl\Model\Resolver\Options\Label;

class BundleLabel extends Label
{
/**
* @param Field $field
* @param ContextInterface $context
* @param ResolveInfo $info
* @param array|null $value
* @param array|null $args
* @return \Magento\Framework\GraphQl\Query\Resolver\Value|mixed
* @throws \Exception
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
if (isset($value['product']) && isset($value['product']['name'])) {
return $value['product']['name'];
}

return parent::resolve($field, $context, $info, $value, $args);
}
}
3 changes: 3 additions & 0 deletions src/etc/graphql/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,7 @@

<preference for="Magento\CatalogGraphQl\Model\Resolver\Category\DataProvider\Breadcrumbs"
type="ScandiPWA\CatalogGraphQl\Model\Resolver\Category\DataProvider\Breadcrumbs" />

<preference for="Magento\BundleGraphQl\Model\Resolver\Options\Label"
type="ScandiPWA\CatalogGraphQl\Model\Resolver\Product\BundleLabel" />
</config>

0 comments on commit c6915d4

Please sign in to comment.