-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Fix getReservedOrderId() to use current store instead of default store #11702
Fix getReservedOrderId() to use current store instead of default store #11702
Conversation
@tdgroot I think we we need to add unit test for reserved order id, check that it now actually use current store. It will prevent do regression in this place |
Fair point, I'm on it. |
@ihor-sviziev Unit test added! |
@@ -167,7 +167,7 @@ public function getReservedOrderId($quote) | |||
{ | |||
return $this->sequenceManager->getSequence( | |||
\Magento\Sales\Model\Order::ENTITY, | |||
$quote->getStore()->getGroup()->getDefaultStoreId() | |||
$quote->getStore()->getStoreId() |
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 see that $quote has method getStoreId(). Isn't it better to use it?
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.
Thank you for the review.
I'd say that's better indeed, but it shouldn't matter nonetheless. If you want it to use $quote->getStoreId()
I can change that.
@ihor-sviziev I changed it to |
@tdgroot Thanks for this pull request and working on adding tests. We'll wait to see what Travis reports back. I generally agree with the proposed fix. One thing I am concerned about is, when we roll out this change it changes the behaviour of existing stores. So people that already have stores running with order numbers 00000002 would all over a sudden start getting order numbers like 200000003 which would be unexpected. Any thoughts on this and what could be done to mitigate it? Also for the deprecated notice 101.0.0 is the currently already released version - the next one where this change would be included in the develop-2.2 branch would currently be 101.0.1. |
…Model\Quote::substractProductFromQuotes
@fooman Well we could write a data upgrade to set the prefix to As for the deprecation: the version number now is |
@tdgroot thanks for the updates and thoughts. Let me get some wider feedback on how best to deal with existing stores. |
@fooman We have several clients complaining about this issue, because the behaviour of M2 right now is different then the expected behaviour of the user and the behaviour of Magento 1. So from a user perspective it's already broken and needs to be fixed. Therefor I do not see an issue when the prefixes will be changed. |
Update: we are waiting for approval from Product Owner of this feature |
Update: Product Owner approved this change. Thank you everyone for collaboration |
@okorshenko Thanks for finalizing this PR! Will this change get merged in 2.3 branch by Magento engineering or does it need another backport PR? |
@tdgroot accepting PRs are usually much faster. Could you please create PRs with the same changes to 2.1-develop and 2.3-develop branches? |
Hello, I think this is not a good solution. Thanks |
Hi @mimou78, |
Description
Fix getReservedOrderId() to use current store instead of default store. When placing orders from a new store view under the same website, it would use the reserved order id from the default store view.
In the image below, you'll the first 2 created orders without the fix. The last order(

2000000001
) is after the fix and you'll see the increment id corresponds to the store view.I also saw a typo in
Quote::substractProductFromQuotes()
and refactored the method. I created a placeholder for the old method and deprecated it.So this problem is fixed this way, but I'm wondering why it was implemented like this in the first place. Does this have implications for Single Store Mode? I'd say it wouldn't, but I think it's good to be sure. Please let me know :)
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist