Open xtremevision opened 1 year ago
Hi @xtremevision. Thank you for your report. To speed up processing of this issue, 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@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues 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 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.
Hi @engcom-Hotel. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @xtremevision,
Thanks for the report and collaboration!
We have tried to reproduce the issue in Magento 2.4-develop branch and the actual result is reproducible for us. Please refer to the below screenshot for reference:
It seems to us an expected behaviour, just a quick query, are you facing any issue with the existing flow and also can you please share the official documentation link related with this.
Thanks
Yes, I am having problems with the current flow, it is a critical issue for me. In particular adding my own discount fails because the first time the quote is null, so I can not store in the database anything referencing the quote_id.
I expressed myself wrong, I meant as per official core code, where these events are dispatched, I would expect the quote to be a valid entity.
example:
My biggest concern is sales.xml which I use to add my own discount, and I must have a valid quote when it's called. Within the collect function I store information in my own table referencing the quote_id. If the quote_id is null I am unable to track the discount throughout the order life span, and beyond, after payment is made and our webhook is called with an IPN marking the order as paid, raising an invoice, which triggers additional external API calls - all looking up records based on quote_id (and order_id).
Let me know if you need more from me. Thank you for looking into this.
PS. From what I have seen, a lot of other people have experienced the same problem but have not necessarily noticed this specific pattern, i.e. the quote being null the 1st time, and valid the 2nd time.
I think I found the problem and fix. Please see below standard patch files. Not sure if this is the proper fix but it worked in my testing. Let me know if you want composer patches instead.
Thanks, Michael.
Hello @xtremevision,
Thanks for the updates!
It seems you have a valid scenario. We can move ahead to confirm this issue.
You can also create a PR if you already have a fix.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-8040 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Hi,
I have opened a PR for this issue, and signed the CLA. Not sure what else needs to be done. Please assist.
Thanks, Michael.
@magento give me 2.4.5-p1 instance
Hi @SPbryan007. Thank you for your request. I'm working on Magento instance for you.
Hi @SPbryan007, here is your Magento Instance: https://f32c1a84a97840247905fa5d1edba0f0.instances.magento-community.engineering Admin access: https://f32c1a84a97840247905fa5d1edba0f0.instances.magento-community.engineering/admin_6c05 Login: 652d38fb Password: 40652b9e62fe
I've updated my patches. Will try them again with my PR as it's failing the unit testing.
Hi,
I managed to get the PR checked with 11 passed and 4 failing. The 4 failing though have nothing to do with me. Any ideas or suggestions?
Thanks.
Hello @xtremevision,
If you feel like these failures are not due to your changes then try re-running the specific tests which are failing.
Thanks
I tried. They are still failing... :(
On 02/03/2023 11:10, Abhinav Pathak wrote:
Hello @xtremevision https://github.com/xtremevision,
If you feel like these failures are not due to your changes then try re-running the specific tests which are failing.
Thanks
— Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/36908#issuecomment-1452130567, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CESDCBFEGLWQSDKPRHLW2DBALANCNFSM6AAAAAAVFCEPWA. You are receiving this because you were mentioned.Message ID: @.***>
--
Michael Mussulis
CEO
Xtreme Vision Systems SRL
Reg Com: J40/23/03.01.2012
CUI: 29505826
mobilePhone
+ 40 721 052 013 <tel:+%201%20772%20418%203463>
mobilePhone
+ 1 772 418 3463 <tel:+%201%20772%20418%203463>
emailAddress
***@***.*** ***@***.***>
website
https://xtreme-vision.net <https://latinrhythms.dance>
Summary
Subscribing to events: sales_quote_address_collect_totals_after, sales_quote_collect_totals_before, sales_quote_collect_totals_after returns a null quote in the execute() function for the FIRST product added to the cart. Subsequent add product to cart call returns a quote entity.
I get the same result if I add a custom discount using sales.xml and section/group definition. Tested on Magento 2.4.4 and 2.4.5-p1, with php 8.1.
var/log/system.log output: [2023-02-23T02:29:48.772461+00:00] main.INFO: TestTotals1.php:execute - quote_id: [] [] [2023-02-23T02:29:48.786631+00:00] main.INFO: TotalsWithBonusProducts.php:collect - quote_id before ::collect() - [] [] [2023-02-23T02:29:48.788871+00:00] main.INFO: TestTotals3.php:execute - quote_id: [] [] [2023-02-23T02:29:48.944334+00:00] main.INFO: TotalsWithBonusProducts.php:collect - quote_id before ::collect() - [] [] [2023-02-23T02:29:48.944877+00:00] main.INFO: TestTotals3.php:execute - quote_id: [] [] [2023-02-23T02:29:48.967316+00:00] main.INFO: TestTotals2.php:execute - quote_id: [] [] (above is 1st product added to cart)
[2023-02-23T02:29:57.347658+00:00] main.INFO: TestTotals1.php:execute - quote_id: 21 [] [] [2023-02-23T02:29:57.357881+00:00] main.INFO: TotalsWithBonusProducts.php:collect - quote_id before ::collect() - 21 [] [] [2023-02-23T02:29:57.358358+00:00] main.INFO: TestTotals3.php:execute - quote_id: 21 [] [] [2023-02-23T02:29:57.475056+00:00] main.INFO: TotalsWithBonusProducts.php:collect - quote_id before ::collect() - 21 [] [] [2023-02-23T02:29:57.475349+00:00] main.INFO: TestTotals3.php:execute - quote_id: 21 [] [] [2023-02-23T02:29:57.490951+00:00] main.INFO: TestTotals2.php:execute - quote_id: 21 [] [] (above is 2nd product added to cart)
Observation: After the observers have been called, executed and the first product has been added to the cart, the quote record is created in the "quote" table.
Examples
Xtreme_Totals.zip
Proposed solution
As per official documentation, I would expect the quote record to be created before the observers are called, before any totals are collected, so the event will return a valid quote entity.
Scenario in which the flow is having an issue
Yes, I am having problems with the current flow, it is a critical issue for me. In particular adding my own discount fails because the first time the quote is null, so I can not store in the database anything referencing the quote_id.
I expressed myself wrong, I meant as per official core code, where these events are dispatched, I would expect the quote to be a valid entity.
example:
My biggest concern is sales.xml which I use to add my own discount, and I must have a valid quote when it's called. Within the collect function I store information in my own table referencing the quote_id. If the quote_id is null I am unable to track the discount throughout the order life span, and beyond, after payment is made and our webhook is called with an IPN marking the order as paid, raising an invoice, which triggers additional external API calls - all looking up records based on quote_id (and order_id).
Let me know if you need more from me. Thank you for looking into this.
Release note
No response
Triage and priority