-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 32793 Add has_options and required_options to grapql Product Interface #33125
base: 2.4-develop
Are you sure you want to change the base?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -123,6 +123,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\ | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
Description (*)
Add has_options and required_options to grapql ProductInterface
Fixed Issues (if relevant)
has_options
andrequired_options
are not available in GraphQL #32793Contribution checklist (*)