magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.44k stars 9.29k forks source link

Reorder product with options is failing #36176

Closed florinm8 closed 1 year ago

florinm8 commented 1 year ago

Preconditions and environment

Steps to reproduce

  1. place an order with a product that add custom options
  2. from 'My account' try to reorder.

Expected result

The product is added to cart and checkout can continue

Actual result

Exception occurs because \Magento\Sales\Model\Reorder\OrderInfoBuyRequestGetter::getInfoBuyRequest method assume that info_buyRequest have 'options' key

Commenting out the line if (array_key_exists($option['option_id'], $info['options'])) resolves the issue

Additional information

Below you can find the stack trace

`` TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /var/www/html/lund3/vendor/magento/module-sales/Model/Reorder/OrderInfoBuyRequestGetter.php:54 Stack trace:

0 /var/www/html/lund3/vendor/magento/module-sales/Model/Reorder/OrderInfoBuyRequestGetter.php(54): array_key_exists(0, NULL)

1 /var/www/html/lund3/vendor/magento/module-sales/Model/Reorder/Reorder.php(255): Magento\Sales\Model\Reorder\OrderInfoBuyRequestGetter->getInfoBuyRequest(Object(Magento\Sales\Model\Order\Item\Interceptor))

2 /var/www/html/lund3/vendor/magento/module-sales/Model/Reorder/Reorder.php(217): Magento\Sales\Model\Reorder\Reorder->addItemToCart(Object(Magento\Sales\Model\Order\Item\Interceptor), Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Catalog\Model\Product\Interceptor))

``

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @florinm8. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues 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

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

engcom-Bravo commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @engcom-Bravo, here is your Magento Instance: https://60fb9d24d306c4b1da755ec5d1fccc28.instances.magento-community.engineering Admin access: https://60fb9d24d306c4b1da755ec5d1fccc28.instances.magento-community.engineering/admin_56b9 Login: 5d0d9974 Password: b1d322df0f38

engcom-Bravo commented 1 year ago

Hi @florinm8,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop branch and 2.4.5 but the issue is not reproducible. Created a Product with custom options and placed order successfully.Kindly refer the screenshots.

Screenshot 2022-09-22 at 3 49 21 PM Screenshot 2022-09-22 at 3 49 55 PM

From my account we are able to Reorder the product with Custom options successfully.

Screenshot 2022-09-22 at 3 51 10 PM

Please let us know we miss anything.

Thanks.

florinm8 commented 1 year ago

Hi, thanks for checking, it seems that the 3rd party aheadworks_sarp module is causing the issue. I got confused as the Magento\Sales\Model\Reorder\OrderInfoBuyRequestGetter class was introduced in magento 2.4.4 and it's working well without it.

engcom-Bravo commented 1 year ago

Hi @florinm8

Thanks for quick response.

Aheadworks/module-sarp2 module is a 3rd party extension and code of this extension is not part of https://github.com/magento/magento2 git repository. We are closing this issue as community is not able to provide fix for it in this repository. All questions, issue reports and fix for them should be addressed to the corresponding extension owners(support) on the Magento Market place page.

Thanks.