Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I avoid these long links (from store) when I switch Store Views? Example: /sp/?___from_store=default ?? 
 
otzstzzn
Mentor
 
Total Posts:  1071
Joined:  2009-07-13
 

Hi,

How do I avoid these long links when I switch Store Views?

Example 1: (this is ok )

www,mydomain.com/default/

Example 2 -16:

www,mydomain.com/sp/?___from_store=default

or

www,mydomain.com/fr/?___from_store=sp

How can i avoid this here > ?___from_store=

or this

com/fr/?___from_store=sp

Thank you very much !

Image Attachments
Bild 146.pngBild 147.pngBild 148.pngBild 149.pngBild 150.pngBild 151.pngBild 152.pngBild 153.pngBild 154.pngBild 155.pngBild 156.pngBild 157.pngBild 158.pngBild 159.pngBild 160.pngBild 161.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
Appmerce
Guru
 
Avatar
Total Posts:  376
Joined:  2008-05-13
Amsterdam, The Netherlands
 

If you use different subdomains, you should add a switch in index.php to load correct store views.

Make a store view per language.

Then remove the standard language switch (in header.phtml), and create your own to jump to subdomains without adding ?__from_store

 
Magento Community Magento Community
Magento Community
Magento Community
 
otzstzzn
Mentor
 
Total Posts:  1071
Joined:  2009-07-13
 

Hi Morningtime,

thank you very much !

 
Magento Community Magento Community
Magento Community
Magento Community
 
DerAndrej
Jr. Member
 
Total Posts:  3
Joined:  2010-05-12
 

There is a much easier way to achieve this. I write this for Magento 1.4x, but with a little modification it is achievable for every older Magento version.

If you look into /app/code/core/Mage/Core/Model/Store.php you see following function:

public function getCurrentUrl($fromStore true)

So without changing any core code grab /app/design/frontend/base/default/template/page/switch/languages.phtml

Change the line

<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
to
<option value="<?php echo $_lang->getCurrentUrl(false) ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
and put the changed file into the corresponding path of your theme folder.

And now you have clean URLs.

 
Magento Community Magento Community
Magento Community
Magento Community
 
otzstzzn
Mentor
 
Total Posts:  1071
Joined:  2009-07-13
 

Hi DerAndrej,

thank you very much !!!!!

Great news ....

 
Magento Community Magento Community
Magento Community
Magento Community
 
DerAndrej
Jr. Member
 
Total Posts:  3
Joined:  2010-05-12
 

There is another real bug with language switch which occurs if you use localized category and/or product urls, I reported this issue: http://www.magentocommerce.com/bug-tracking/issue?issue=9154

 
Magento Community Magento Community
Magento Community
Magento Community
 
ex-xtc
Member
 
Total Posts:  43
Joined:  2007-10-16
 

this helped. but now it looks like:

http://www.mystore.de/?___store=de

 
Magento Community Magento Community
Magento Community
Magento Community
 
kwoolf
Jr. Member
 
Total Posts:  18
Joined:  2009-02-10
 

Yeah, I’ve searched high and low for a way to remove the `?___from_store=` parameter from SEF URLs. Is there anyone out there that can shed some light on this for me? Could the URL Rewrite be used? New install of Magento v1.4.1.1.

Kev

 
Magento Community Magento Community
Magento Community
Magento Community
 
outre99
Jr. Member
 
Total Posts:  16
Joined:  2009-06-28
 
DerAndrej - 14 May 2010 02:54 AM

There is another real bug with language switch which occurs if you use localized category and/or product urls, I reported this issue: http://www.magentocommerce.com/bug-tracking/issue?issue=9154

Ran into the same issue.  If using language (store view) specific url keys changing language via the switcher only changes the store view code but not the url-key, which results in 404.  This is a huge oversight as it invalidates the whole point of using different url keys for different languages.

The only workarounds i can think of is either create custom URL rewrite rules to force the proper url key or to automatically open the home page when the language is changed.  The first option can be time intensive if the number of categories is significant.  The second one makes sense since users don’t jump back and forth between the languages very often, but it feels like a half-baked solution somehow.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rivus
Jr. Member
 
Total Posts:  10
Joined:  2010-08-10
 

Waah, I have the same damn problem and it is really annoying me like hell, especially my customer who runs the show. I tried DerAndrejs solution, but it just works partially (thanks anyways, dude!).

I hope there’s gonne be a solution!

 
Magento Community Magento Community
Magento Community
Magento Community
 
simup
Jr. Member
 
Total Posts:  8
Joined:  2012-01-12
 
DerAndrej - 12 May 2010 05:47 AM

There is a much easier way to achieve this. I write this for Magento 1.4x, but with a little modification it is achievable for every older Magento version.

If you look into /app/code/core/Mage/Core/Model/Store.php you see following function:

public function getCurrentUrl($fromStore true)

So without changing any core code grab /app/design/frontend/base/default/template/page/switch/languages.phtml

Change the line
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
to
<option value="<?php echo $_lang->getCurrentUrl(false) ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
and put the changed file into the corresponding path of your theme folder.

And now you have clean URLs.

Thanks, Worked for me !

 
Magento Community Magento Community
Magento Community
Magento Community
 
zavodyanka
Jr. Member
 
Total Posts:  1
Joined:  2012-02-27
 

Enable “Add Store Code to Urls” to remove “?___store=de”

Image Attachments
screen_020.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
srmobile
Sr. Member
 
Total Posts:  276
Joined:  2011-10-25
 

Okay the above was working for me but since upgrading to magento 1.8 they have returned!

Doesn’t make much sense either because the language is specified.

So if you come to my site your url becomes:  http://www.mysite.com/eng

When you switch to French it becomes:  http://www.mysite.com/fr/?___from_store=eng

Anyone have an idea how to get rid of this bug?

Thanks,

SR

 
Magento Community Magento Community
Magento Community
Magento Community
 
tocotoco
Jr. Member
 
Total Posts:  5
Joined:  2012-10-22
 

Hello good morning, simup your solution works perfectly in Magento 1.7.0.2

Thank you so much

 
Magento Community Magento Community
Magento Community
Magento Community
 
Robertvane
Jr. Member
 
Total Posts:  1
Joined:  2014-03-23
 

Brilliant, works for Magento Pro ver. 1.11.0.0
Will tidy up the links in Google allright.

I looked at the Add Store Code to Urls before, but thought setting to No was correct, kinda counter intuitive I guess.

Also put the

echo $_lang->getCurrentUrl(false)
in languages.phtml.

All set to go

Thank you!
Regards
Robert

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top