-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 not detecting current store using store code in url using $storeResolver->getCurrentStoreId() #9429
Fix not detecting current store using store code in url using $storeResolver->getCurrentStoreId() #9429
Conversation
Use $storeManager->getStore()->getId() instead of $storeResolver->getCurrentStoreId()
We just were hit by this bug by upgrading a store from Magento 2.1.5 to 2.1.6, but at yet another place. Namely in the layered navigation. In version 2.1.6 Magento added some extra caching for the layered navigation select attributes, and they also use the super buggy Replacing that with I think the real solution is to make sure the Tnx for the PR @mimarcel, saved me a lot of time and debugging! |
@hostep It's indeed confusing that Glad this solution was useful to someone! |
Ok I think this makes sense, thanks for the clarification! |
* @param DirectoryHelper $directoryHelper | ||
*/ | ||
public function __construct( | ||
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollection, | ||
\Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollection, | ||
StoreResolverInterface $storeResolver, | ||
StoreManagerInterface $storeManager, |
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.
Unfortunately, due to backwards compatibility policy we may not change constructor arguments. Please add another optional dependency and deprecate the old one if it is not used anymore.
…#9429 - Code style updated
Description
Current store id is not correctly identified when
$storeResolver->getCurrentStoreId()
is used.$storeManager->getStore()->getId()
should be used instead.Fixed Issues
Manual testing scenarios
PRE-REQUISTIES:
STESP TO REPLICATE
EXPECTED
Available country for checkout: Romania
ACTUAL
Available country for checkout: Estonia
Contribution checklist