Skip to content

Store View switcher not working on front-end and it throws an error #11211

Closed

Description

@latypatil

If we select any store then site will go to that store and again we select another store then it throws an error because the url is wrong.

Preconditions

  1. Magento ver. 2.2.0
  2. PHP 7.0.24, mysql Ver 14.14

Steps to reproduce

  1. Create different store view from admin panel and all will appear on front-end
  2. Select any store view (No error)
  3. Again select another store view(error will be there)

Expected result

  1. It should show all store views without any error
    Ex. http://10.16.16.141/magento2.2/?___store=aus ==>this is for one of store view
    http://10.16.16.141/magento2.2/?___store=usa ==> This should be for different store view
    OR
    Base url should be the same for any store ,only store will get switch!

Actual result

  1. [Screenshot, logs]
    error

After changing the store view second time it redirect to below url :
http://10.16.16.141/magento2.2/?___store=aus?___store=usa

(URL is only for reference , it will not work)

Activity

  1. magento-engcom-team commented on Oct 4, 2017

    @magento-engcom-team
    Contributor

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

  2. added
    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for development
    Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmed
    Reproduced on 2.2.xThe issue has been reproduced on latest 2.2 release
    Reproduced on 2.3.xThe issue has been reproduced on latest 2.3 release
    on Oct 4, 2017
  3. latypatil commented on Oct 4, 2017

    @latypatil
    Author

    The issue is in /vendor/magento/module-store/Block/Switcher.php with function getTargetStorePostData () where $store->getCurrentUrl(false) , Current url has been passed there and It should be $this->getUrl('stores/store/switch').

  4. duckchip commented on Oct 9, 2017

    @duckchip
    Contributor

    this issue is a result of merge in issue [https://github.com//issues/8509] which fixes cookie redirect problems with multidomains

  5. thiagolima-bm commented on Oct 10, 2017

    @thiagolima-bm
    Member
  6. TomashKhamlai commented on Oct 11, 2017

    @TomashKhamlai
    Contributor

    @latypatil, I think that this issue is similar to issue #10908? Do you have logs in var/logs/exception.log?

  7. added 2 commits that reference this issue on Oct 20, 2017
  8. added 4 commits that reference this issue on Oct 31, 2017
  9. okorshenko commented on Oct 31, 2017

    @okorshenko
    Contributor

    the issue has been fixed and delivered to 2.2-develop branch. WIll be available with 2.2.2 release

  10. davidroberto commented on Nov 24, 2017

    @davidroberto

    @latypatil, i had the same problem and was able to fix it with this small fix.

    I know it's not perfect and that i should overwrite the core module in a custom plugin, but anyway i'll not need this fix anymore when i'll update the code with the new release containing the official fix.

    In /vendor/magento/module-store/block/switcher.php, in getTargetStorePostData method, replace

    return $this->_postDataHelper->getPostData( $store->getCurrentUrl(false), $data );

    by:

    $currentUrl = strtok($store->getCurrentUrl(false), '?'); return $this->_postDataHelper->getPostData( $currentUrl, $data );

  11. magento-engcom-team commented on Jan 30, 2018

    @magento-engcom-team
    Contributor

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

    The fix will be available with the upcoming patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions