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

Rest API Magento 2.4 order update overwrites existing item information #22431

Closed
aschrammel opened this issue Apr 19, 2019 · 14 comments · Fixed by #28483
Closed

Rest API Magento 2.4 order update overwrites existing item information #22431

aschrammel opened this issue Apr 19, 2019 · 14 comments · Fixed by #28483
Assignees
Labels
Component: Sales Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@aschrammel
Copy link

aschrammel commented Apr 19, 2019

Preconditions (*)

magento 2.4-develop

Steps to reproduce (*)

  1. Place an order with a product with custom option.

  2. On the order item in the database the custom options are stored in the sales_order_item table, product_options field in the info_buyRequest as "key": "value" pair.

  3. Update the order using the Rest API (f.e. just hold order).

  4. The product_options are manipulated, omitting the custom options (they are present as options as object, but missing in the info_buy_request as "key": "value" pair.

Expected result (*)

The info_buyRequest remain as they were before the API Update
image

Actual result (*)

The info_buyRequest data are changed
image

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Apr 19, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 19, 2019

Hi @aschrammel. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@aschrammel do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@aschrammel
Copy link
Author

aschrammel commented Apr 20, 2019

@magento-engcom-team It's not possible to reproduce on remote instance, as I don't have database access to this instance.

@ghost ghost self-assigned this Apr 22, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 22, 2019

Hi @engcom-backlog-nazar. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost ghost added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: Catalog labels Apr 22, 2019
@ghost
Copy link

ghost commented Apr 22, 2019

Hi @aschrammel thank you for you report, this issue has already ben fixed in this -> commit 7c6ecc3

@ghost ghost closed this as completed Apr 22, 2019
@aschrammel
Copy link
Author

Hi @engcom-backlog-nazar,

thanks for your feedback but unfortunately the fix you mentioned does not fix the problem described.
The custom options stored in the info_buyRequest as options object with it's corresponding ID but not - as it's done before the update - as textual key and value.

E.g. i have on in the the product_options field in sales_order_itemtable something like this:

{
    "info_buyRequest": {
        "uenc": "XXX",
        "product": "XXX",
        "serial_number": "XXX",
        "country": "AT",
        "max_qty": "1",
        "related_product": "",
        "qty": "1",
        "options": {
            "17": "XXX",
            "18": "AT"
        }
    },
    "options": [
        {
            "label": "Seriennummer",
            "value": "XXX",
            "print_value": "XXX",
            "option_id": "17",
            "option_type": "field",
            "option_value": "XXX",
            "custom_view": false
        },
        {
            "label": "Installationsland",
            "value": "AT",
            "print_value": "AT",
            "option_id": "18",
            "option_type": "field",
            "option_value": "AT",
            "custom_view": false
        }
    ]
}

After updating the order via the API the product_options field in sales_order_item is contains following:

{
    "info_buyRequest": {
        "qty": "1.0000",
        "options": {
            "17": "XXX",
            "18": "AT"
        }
    },
    "options": [
        {
            "label": "Seriennummer",
            "value": "XXX",
            "print_value": "XXX",
            "option_id": "17",
            "option_type": "field",
            "option_value": "XXX",
            "custom_view": false
        },
        {
            "label": "Installationsland",
            "value": "AT",
            "print_value": "AT",
            "option_id": "18",
            "option_type": "field",
            "option_value": "AT",
            "custom_view": false
        }
    ]
}

For us it is not an option to rely on the option IDs or the options array as for the same content (Serial / Installation Country) various IDs and labels in different languages exist.

So the issue in this case are the missing data in info_buyRequest:

"uenc": "XXX",
"product": "XXX",
"serial_number": "XXX",
"country": "AT",
"max_qty": "1",
"related_product": "",

After placing the order the data is stored on the item correctly - it's only missing after updating the order via API.

I hope it's more clear now.
Thank you in advance :)

@aschrammel aschrammel reopened this Apr 23, 2019
@ghost ghost removed their assignment Apr 23, 2019
@aschrammel
Copy link
Author

Additionally maybe interesting is the fact, that this happens on virutal products!
As far as I've seen now, there's no ProductOptionProcessor for virtuals.

@AlexWorking AlexWorking added Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release and removed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Apr 23, 2019
@mahesh-rajawat mahesh-rajawat self-assigned this Apr 24, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 24, 2019

Hi @maheshWebkul721. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.
    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

@GovindaSharma GovindaSharma self-assigned this May 10, 2019
@m2-assistant
Copy link

m2-assistant bot commented May 10, 2019

Hi @GovindaSharma. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.
    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

@dkyosev9
Copy link

dkyosev9 commented Jun 24, 2019

Same issue here. Seems like very major/important issue. It works good with Simple but not with Bundle products.

Preconditions (*)

Magento Version 2.3.1

Steps to reproduce (*)

Place an order with a bundle product with custom options
On the order item in the database the custom options are stored in the product_options column in the info_buyRequest as "key": "value" pair.
Ship the order from the admin order edit screen or when add a comment and save the order programmatically.
The product_options are manipulated, omitting the custom options and keeps some new "key": "value" pairs. Most of the `info_buy_request` "key": "value" pairs are missing.

Expected result (*)

The product_options remain as they were before the order state update

Actual result (*)

Missing custom options in the product_options column (sales_order table).

@mahesh-rajawat mahesh-rajawat removed their assignment Jun 27, 2019
@ghost ghost unassigned GovindaSharma Sep 27, 2019
@engcom-Charlie engcom-Charlie self-assigned this Sep 30, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 30, 2019

Hi @engcom-Charlie. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Charlie engcom-Charlie added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 3, 2019
@ghost ghost unassigned engcom-Charlie Oct 3, 2019
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Oct 3, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Charlie
Thank you for verifying the issue. Based on the provided information internal tickets MC-21450 were created

Issue Available: @engcom-Charlie, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Charlie engcom-Charlie changed the title Rest API Magento 2.2.8 order update overwrites existing item information Rest API Magento 2.3 order update overwrites existing item information Oct 3, 2019
@kevinjavitz
Copy link

Here is a temp fix if you need to use the item saving api using a preference, if you rely on updating the product_options in the api this will not work though: https://gist.github.com/salesigniter/967f594a7ab34c6f73162e4e92fd34fb

@engcom-Charlie engcom-Charlie added the Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch label Jun 2, 2020
@engcom-Charlie engcom-Charlie self-assigned this Jun 2, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 2, 2020

Hi @engcom-Charlie. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@engcom-Charlie engcom-Charlie changed the title Rest API Magento 2.3 order update overwrites existing item information Rest API Magento 2.4 order update overwrites existing item information Jun 2, 2020
@ihor-sviziev ihor-sviziev added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Jun 3, 2020
@ghost ghost added the Priority: P3 May be fixed according to the position in the backlog. label Jun 9, 2020
@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jun 25, 2020
@magento-engcom-team
Copy link
Contributor

Hi @aschrammel. Thank you for your report.
The issue has been fixed in #28483 by @engcom-Charlie in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Sales Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants