Skip to content
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

Sales/Api/Data/OrderItemInterface typo in KEY_PRODUCT_OPTION constant #9378

Closed
wants to merge 1 commit into from
Closed

Sales/Api/Data/OrderItemInterface typo in KEY_PRODUCT_OPTION constant #9378

wants to merge 1 commit into from

Conversation

iben12
Copy link

@iben12 iben12 commented Apr 24, 2017

Description

The Magento\Sales\Api\Data\OrderItemInterface defines constants for all the keys the entity (OrderItem) contains. The constant KEY_PRODUCT_OPTION is defined as product_option, but the corresponding database field is named product_options (note the plural form). This mismatch prevents the application to find and unserialize the field, so the API does not return this data for items when requesting an order, despite the documentation states it should (see).

Fixed Issues (if relevant)

  1. Custom options in sales order details missing devdocs#946

Manual testing scenarios

  1. Send a request to the REST API endpoint of rest/V1/orders/{id}
  2. See that the items array contains product items that include the product_option property

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

The value should be "product_options" (in plural) to match the field name in the DB. This prevents the API to return product options of items when requesting an order, despite it should by documentation (http://devdocs.magento.com/swagger/#!/salesOrderRepositoryV1/salesOrderRepositoryV1GetGet).
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Apr 24, 2017

CLA assistant check
All committers have signed the CLA.

@iben12
Copy link
Author

iben12 commented Apr 25, 2017

Looks like this breaks ProductOptionProcessor when working with OrderItemRepository.

Anyone has any clue how this should work?

@vrann vrann self-assigned this May 19, 2017
@vrann vrann added this to the May 2017 milestone May 19, 2017
@vrann vrann added the develop label May 19, 2017
@vrann
Copy link
Contributor

vrann commented May 23, 2017

@iben12 thanks for digging into this issue!

However, this is more of a documentation issue. Despite product options are declared on the interface they are not supposed to be returned in the serialized format from the Web API. The main reason is not all the clients will be able to parse and ineterpret PHP serialized string.

Instead, to retrieve them there is separate product options processing mechanism invoked from the
\Magento\Sales\Api\OrderItemRepositoryInterface::get method To retrieve the product options for the order item, please use GET V1/orders/items/:id request.

Closing this PR and raising internal issue related to returning product options from the OrderInterface::getItems as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants