Skip to content
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

#12450: Set Current Store from Store Code if isUseStoreInUrl #12529

Merged
merged 1 commit into from
Dec 11, 2017

Conversation

osrecio
Copy link
Member

@osrecio osrecio commented Dec 3, 2017

Set Current Store from Store Code

Description

If use Store Code in Url but for some reason is empty after process, set Store_Code from Store

Fixed Issues (if relevant)

  1. Store not found when adding a ? to site URL. #12450: Store not found when adding a ? to site URL

Manual testing scenarios

  1. Turn on "Add storecode to URL's" in "Configuration > General > Web"
  2. Navigate in browser to {BASE_URL}/?
  3. Error thrown

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team magento-engcom-team added 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 Dec 3, 2017
@sidolov sidolov self-assigned this Dec 4, 2017
@sidolov sidolov added this to the December 2017 milestone Dec 4, 2017
@@ -44,7 +44,9 @@ public function process(\Magento\Framework\App\RequestInterface $request, $pathI

if ($store->isUseStoreInUrl()) {
if (!$request->isDirectAccessFrontendName($storeCode) && $storeCode != Store::ADMIN_CODE) {
$this->storeManager->setCurrentStore($storeCode);
if ($storeCode !== '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is } elseif (!empty($storeCode)) { condition in the bottom, can the whole logic be simplified maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orlangur finally I added setCurrentStore from $store->getCode() and I adjust tests for this logic

@osrecio osrecio changed the title Not Set StoreCode if empty Set Current Store from Store Code if isUseStoreInUrl Dec 4, 2017
@orlangur orlangur self-assigned this Dec 4, 2017
@sidolov sidolov removed their assignment Dec 4, 2017
@osrecio
Copy link
Member Author

osrecio commented Dec 4, 2017

Thanks @orlangur I will make Backport for 2.3 in case my tests fail for same scenario.

@osrecio osrecio changed the title Set Current Store from Store Code if isUseStoreInUrl #12450: Set Current Store from Store Code if isUseStoreInUrl Dec 5, 2017
@magento-team magento-team merged commit ff0e201 into magento:2.2-develop Dec 11, 2017
magento-team pushed a commit that referenced this pull request Dec 11, 2017
[EngCom] Public Pull Requests - 2.2-develop
 - MAGETWO-85311: Added namespace to product videos fotorama events #12469 #991
 - MAGETWO-85300: 8437: Silent error when an email template is not found #970
 - MAGETWO-85293: 12613: Verbiage Update Required: Product Image Watermark size Validation Message. #985
 - MAGETWO-85286: 8176: LinkManagement::getChildren() does not include product visibility. #986
 - MAGETWO-85285: 12482: Sitemap image links in MultiStore #935
 - MAGETWO-84955: Set Current Store from Store Code if isUseStoreInUrl #12529
 - MAGETWO-84764: NewRelic: Disables Module Deployments, Creates new Deploy Marker Command #12477
 - MAGETWO-84439: 12180 Remove unnecessary use operator for Context, causes 503 error i… #12220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: test coverage Progress: accept Release Line: 2.2 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

Successfully merging this pull request may close these issues.

6 participants