Issue 32793 Add has_options and required_options to grapql Product Interface - #33125
Conversation
|
Hi @karyna-tsymbal-atwix. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
|
@magento run all tests |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
|
@magento run Functional Tests B2B |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
eduard13
left a comment
There was a problem hiding this comment.
Hi @karyna-tsymbal-atwix, could you please review the minor suggestion below?
Thank you.
| namespace Magento\GraphQl\Catalog; | ||
|
|
||
| use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
|
|
There was a problem hiding this comment.
Please add a class description
| /** | ||
| * @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php | ||
| */ | ||
| public function testHasOptionsAndRequiredOptionsAttribute() |
There was a problem hiding this comment.
| public function testHasOptionsAndRequiredOptionsAttribute() | |
| public function testHasOptionsAndRequiredOptionsAttribute(): void |
| self::assertArrayHasKey('has_options', $response['products']['items'][0]); | ||
| self::assertArrayHasKey('required_options', $response['products']['items'][0]); |
There was a problem hiding this comment.
| self::assertArrayHasKey('has_options', $response['products']['items'][0]); | |
| self::assertArrayHasKey('required_options', $response['products']['items'][0]); | |
| $this->assertArrayHasKey('has_options', $response['products']['items'][0]); | |
| $this->assertArrayHasKey('required_options', $response['products']['items'][0]); |
| products(filter: {sku: {eq: "{$productSku}"}}) { | ||
| items { | ||
| sku | ||
| has_options |
There was a problem hiding this comment.
| has_options | |
| has_options |
…nd-required-options-to-grapql-product-interface
|
@magento run all tests |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
|
@magento run Integration Tests |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
|
@magento run Functional Tests EE |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
|
Hi @eduard13, thank you for the review. |
|
Hi @Den4ik, thank you for the review. |
| categories: [CategoryInterface] @doc(description: "The categories assigned to a product.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Categories") @cache(cacheIdentity: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\CategoriesIdentity") | ||
| canonical_url: String @doc(description: "Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Products' is enabled") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl") | ||
| media_gallery: [MediaGalleryInterface] @doc(description: "An array of Media Gallery objects.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\MediaGallery") | ||
| has_options: Boolean @doc(description: "Indicates whether additional options have been created for the product.") |
There was a problem hiding this comment.
shouldn't this be wrapped in an interface?
we do have CustomizableProductInterface and this can be used as a fragment
in this interface we have
options: [CustomizableOptionInterface]
which has_options can be as simple as is_empty(options)
and required_options will be inside CustomizableOptionInterface for each option required: Boolean
So what is the real need for these 2 fields what we can't achieve it the existing way?
|
Hi @karyna-t, this PR was approved twice in 2021 and only needs a rebase now (the If you are still around and want to finish it, please go ahead. Otherwise I will open a fresh PR from my fork with your commits preserved and credited, and link it here. |
|
Hi @lbajsarowicz, feel free to open a fresh PR from your fork. Thanks! |
Description (*)
Add has_options and required_options to grapql ProductInterface
Fixed Issues (if relevant)
has_optionsandrequired_optionsare not available in GraphQL #32793Contribution checklist (*)