Skip to content

Commit b347e74

Browse files
ENGCOM-3453: Added option_id in response for product with customizable options. #247
- Merge Pull Request magento/graphql-ce#247 from VoronoyAlexandr/graphql-ce:235_added_option_id_in_response_for_product_with_customizable_options - Merged commits: 1. 548ca3c
2 parents 5f976fa + 548ca3c commit b347e74

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ interface CustomizableOptionInterface @typeResolver(class: "Magento\\CatalogGrap
358358
title: String @doc(description: "The display name for this option")
359359
required: Boolean @doc(description: "Indicates whether the option is required")
360360
sort_order: Int @doc(description: "The order in which the option is displayed")
361+
option_id: Int @doc(description: "Option ID")
361362
}
362363

363364
interface CustomizableProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "CustomizableProductInterface contains information about customizable product options.") {

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function testQueryAllFieldsSimpleProduct()
9090
title
9191
required
9292
sort_order
93+
option_id
9394
... on CustomizableFieldOption {
9495
product_sku
9596
field_option: value {
@@ -334,6 +335,7 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
334335
title
335336
required
336337
sort_order
338+
option_id
337339
... on CustomizableFieldOption {
338340
product_sku
339341
field_option: value {
@@ -749,7 +751,8 @@ private function assertOptions($product, $actualResponse)
749751
$assertionMap = [
750752
['response_field' => 'sort_order', 'expected_value' => $option->getSortOrder()],
751753
['response_field' => 'title', 'expected_value' => $option->getTitle()],
752-
['response_field' => 'required', 'expected_value' => $option->getIsRequire()]
754+
['response_field' => 'required', 'expected_value' => $option->getIsRequire()],
755+
['response_field' => 'option_id', 'expected_value' => $option->getOptionId()]
753756
];
754757

755758
if (!empty($option->getValues())) {
@@ -773,7 +776,7 @@ private function assertOptions($product, $actualResponse)
773776
['response_field' => 'product_sku', 'expected_value' => $option->getProductSku()],
774777
]
775778
);
776-
$valueKeyName = "";
779+
777780
if ($option->getType() === 'file') {
778781
$valueKeyName = 'file_option';
779782
$valueAssertionMap = [

0 commit comments

Comments
 (0)