magento2
magento2 copied to clipboard
Product list does not contain extension_attributes stock_item
Description (*)
This pull request (PR) will be merge the added stock item extension_attributes in product list rest API /rest/V1/products?searchCriteria
Related Pull Requests
1.I added observer for "catalog_product_collection_load_after" in cataloginventory module.
Fixed Issues (if relevant)
- Fixes #36533
Manual testing scenarios (*)
1.Open the Postman
2.Add the API URL: {baseurl}/rest/V1/products?searchCriteria
3.Method: GET
4.Authorization "Use Admin Token"
5.Check in response There is a "stock_item": object added in extension_attributes section.
Hi @Kannakiraj123. Thank you for your contribution Here are some useful tips how you can test your changes using Magento test environment. Add the comment under your pull request to deploy test or vanilla Magento instance:
@magento give me test instance- deploy test instance based on PR changes@magento give me 2.4-develop instance- deploy vanilla Magento instance
:exclamation: Automated tests can be triggered manually with an appropriate comment:
@magento run all tests- run or re-run all required tests against the PR changes@magento run <test-build(s)>- run or re-run specific test build(s) For example:@magento run Unit Tests
<test-build(s)> is a comma-separated list of build names. Allowed build names are:
Database CompareFunctional Tests CEFunctional Tests EE,Functional Tests B2BIntegration TestsMagento Health IndexSample Data Tests CESample Data Tests EESample Data Tests B2BStatic TestsUnit TestsWebAPI TestsSemantic Version Checker
You can find more information about the builds here
:information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.
For more details, review the Magento Contributor Guide documentation.
:warning: According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
:pencil2: 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 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.
Hi @sidolov, I saw your comments at https://github.com/magento/magento2/pull/28435 and may disagree with the current implementation. So far we have:
- Stock item available for the single loaded product (\Magento\CatalogInventory\Model\Plugin\AfterProductLoad)
- Inventory data is being processed and saved (\Magento\CatalogInventory\Observer\SaveInventoryDataObserver)
Missing inventory data in the collection load cause inconsistency in logic and also violate current documentation. Moreover, seems that functionality is in demand by the community.
My suggestion is to introduce such functionality (mentioned in this PR). However, declaring it as deprecated from the very beginning, so it may be removed in some bright future altogether with the other two Inventory integration points mentioned in the current Pull Request.
The only I am not sure about is should stock data be loaded altogether with product collection in the Persistance layer (as it happens for a single product now) or should be moved to Service Layer (e.g. around Repository get list method).
Your opinion is more than welcome here :)
@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 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 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 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 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 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 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 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 all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@swnsma Hi, is there any further progress on this?
Any updates on above are the changes fine?
@magento run all tests
@magento run Database Compare, Functional Tests B2B, Functional Tests EE, Functional Tests CE, WebAPI Tests, Integration Tests
@magento run all tests
Hi @Kannakiraj123,
Thanks for the collaboration & contribution!
:heavy_check_mark: QA Passed
Preconditions:
- Install fresh Magento
2.4-develop
Steps to reproduce
1.Open the Postman 2.Add the API URL: {baseurl}/rest/V1/products?searchCriteria 3.Method: GET 4.Authorization "Use Admin Token" 5.Check in response There is a "stock_item": object added in extension_attributes section.
Before: :heavy_multiplication_x:
After: :heavy_check_mark:
Builds are failed. Hence, moving this PR to Extended Testing.
Thanks.