-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Allow access to current order #1032
Allow access to current order #1032
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. Have seen plenty of cases where each extension loads the order by ID just to check one attribute because there is no reference to the original object.
Thanks for the PR!
Will it work if there are few orders created in a batch? |
How is that done in core currently? I suppose we could add an |
An unregister would be needed, indeed. I'll make the change. |
Added an "unregister" in case you're creating multiple orders per request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement!
@sreichel Can we get this approved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Funny, today I have a case In a project where this change ould be helpful - to avoid having to fetch order again from db. |
It's a pain in Magento to get the order currently being created. This would be the cleanest solution, even though you could build on the
checkout_type_onepage_save_order
event, but I don't like that. You'd also need to make sure the event is always first and it created clutter.Magento uses the registry and
current_
prefix for everything, so why not here?I understand that for Magento 2 this would be a big no-no, but for Magento 1 I think this is perfectly acceptable and would make a lot of people happy.