Skip to content

Default Store is always used when retrieving sequence value's for sales entity's. #9055

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

Closed
reztierk opened this issue Mar 29, 2017 · 6 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line 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 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@reztierk
Copy link

reztierk commented Mar 29, 2017

The getReservedOrderId function in /vendor/magento/module-quote/Model/ResourceModel/Quote.php and the _beforeSave function in \Magento\Sales\Model\ResourceModel\EntityAbstract are using getStore()->getGroup()->getDefaultStoreId(), when they should be using getStore()->getStoreId(). Causing orders placed on other storeviews to use the prefix/suffix/increment id and sequence tables of the default store.

Preconditions

  1. Magento 2.1.5

Steps to reproduce

  1. Setup a clean install of Magento 2.1.5 with sample data
  2. Add a second store view to the default website
  3. Place an order on the second store view

Expected result

  1. An increment id using the prefix from the new store view, and an entry in the sequence_order_2 table

Actual result

  1. An increment id using the prefix from the default store view, and an entry in the sequence_order_1 table
@reztierk reztierk changed the title getReservedOrderId always using groups defaultStoreId getReservedOrderId is always using the groups defaultStoreId Mar 29, 2017
@reztierk reztierk changed the title getReservedOrderId is always using the groups defaultStoreId Default Store is always used when retrieving sequence value's for sales entity's. Mar 29, 2017
@jaykobi
Copy link

jaykobi commented Jun 9, 2017

Those line were introduced two years ago:
f9559c2
MAGETWO-36935: Orders placed in different store views should not have duplicated IDs

But I don't see why, either. With sequences and the meta table I can precisely crontrol when which increment id is used. But getStore()->getGroup()->getDefaultStoreId() completely breaks this for multiple store views in one group.

One more in the long list of bugs that REALLY need to be fixed asap.
Thanks for reporting @reztierk.

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 5, 2017
@magento-engcom-team
Copy link
Contributor

@reztierk, thank you for your report.
We've created internal ticket(s) MAGETWO-80977 to track progress on the issue.

@tdgroot
Copy link
Member

tdgroot commented Oct 24, 2017

I'm working on it #SQUASHTOBERFEST

@okorshenko
Copy link
Contributor

Hi @reztierk
The issue has been fixed and delivered in 2.2-develop branch. Will be available with upcoming patch release.

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Dec 12, 2017
@domeglic
Copy link

domeglic commented Feb 2, 2018

Was this fixed completely? Because one of the classes mentioned by @reztierk is still the same:
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Sales/Model/ResourceModel/EntityAbstract.php#L129

I can only reproduce the bug when creating an order without going through checkout though (integration test).

@magento-engcom-team
Copy link
Contributor

Hi @reztierk. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1362 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 8, 2018
magento-devops-reposync-svc pushed a commit that referenced this issue Aug 1, 2024
[Support Tier-4] 07-02-2024 Regular delivery of bugfixes and improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line 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 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

6 participants