Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-configurable-product-graph-ql
Model
Resolver
Variant
Attributes.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\ConfigurableProductGraphQl\Model\Resolver\Variant
;
9
10
use
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
;
11
use
Magento\Framework\GraphQl\Config\Element\Field
;
12
use
Magento\Framework\GraphQl\Query\ResolverInterface
;
13
17
class
Attributes
implements
ResolverInterface
18
{
24
public
function
resolve
(
25
Field
$field,
26
$context,
27
ResolveInfo
$info
,
28
array
$value
=
null
,
29
array $args =
null
30
) {
31
if
(!isset(
$value
[
'options'
]) || !isset(
$value
[
'product'
])) {
32
return
null
;
33
}
34
35
$data
= [];
36
foreach
(
$value
[
'options'
] as
$option
) {
37
$code
=
$option
[
'attribute_code'
];
38
if
(!isset(
$value
[
'product'
][
$code
])) {
39
continue
;
40
}
41
42
foreach
(
$option
[
'values'
] as
$optionValue
) {
43
if
(
$optionValue
[
'value_index'
] !=
$value
[
'product'
][
$code
]) {
44
continue
;
45
}
46
$data
[] = [
47
'label'
=>
$optionValue
[
'label'
],
48
'code'
=>
$code
,
49
'use_default_value'
=>
$optionValue
[
'use_default_value'
],
50
'value_index'
=>
$optionValue
[
'value_index'
]
51
];
52
}
53
}
54
return
$data
;
55
}
56
}
Magento\Framework\GraphQl\Query\ResolverInterface
Definition:
ResolverInterface.php:18
Magento\Framework\GraphQl\Schema\Type\ResolveInfo
Definition:
ResolveInfo.php:13
Magento\ConfigurableProductGraphQl\Model\Resolver\Variant\Attributes\resolve
resolve(Field $field, $context, ResolveInfo $info, array $value=null, array $args=null)
Definition:
Attributes.php:24
Magento\ConfigurableProductGraphQl\Model\Resolver\Variant
Definition:
Attributes.php:8
Magento\Framework\GraphQl\Config\Element\Field
Definition:
Field.php:15
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$value
$value
Definition:
gender.phtml:16
$optionValue
$optionValue
Definition:
quote_with_product_and_custom_options.php:9
$info
foreach( $_productCollection as $_product)() ?>" class $info
Definition:
listing.phtml:52
Magento\ConfigurableProductGraphQl\Model\Resolver\Variant\Attributes
Definition:
Attributes.php:17
$option
$option
Definition:
product_configurable_with_single_child.php:38
$code
$code
Definition:
info.phtml:12