Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:37:04+00:00 2026-06-12T16:37:04+00:00

In my project I have to display the webshop in two languages. By default

  • 0

In my project I have to display the webshop in two languages.
By default you can choose languages with the following code in:

app/design/frontend/base/default/template/page/switch/language.phtml

<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<label for="select-language"><?php echo $this->__('Your Language:') ?></label>
<select id="select-language" title="<?php echo $this->__('Your Language') ?>" onchange="window.location.href=this.value">
<?php foreach ($this->getStores() as $_lang): ?>
    <?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
    <option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php      echo $this->htmlEscape($_lang->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>

This of course displaya a select box with the options being all the languages.

I however want to change this so that it become seperate links.
I just don’t really know how to do this.

This is what I have now.

<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<?php foreach ($this->getStores() as $_lang):?>
    <a href="" title=""><?php echo $this->htmlEscape($_lang->getName()) ?></a>
<?php endforeach;?>
</div>
<?php endif; ?>

PS: I did not change this in the default magento code. I am working in app/design/frontend/default/projectname/template/page/switch/language.phtml.

So I managed to get this working by myself with this code:

<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<?php foreach ($this->getStores() as $_lang):?>
    <a href="<?php echo Mage::getUrl() . '?___store=' . $_lang->getId()?>" title=""><?php echo $this->htmlEscape($_lang->getName()) ?></a>
<?php endforeach;?>
</div>
<?php endif; ?>

But now when I switch language. It redirects to the home page.
I found I should use:

$_lang->getCurrentUrl()

But I have no idea where to place this in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:37:05+00:00Added an answer on June 12, 2026 at 4:37 pm

    You’re very close, you just need to include the URL!

    <?php if(count($this->getStores())>1): ?>
    <div class="form-language">
    <?php foreach ($this->getStores() as $_lang):?>
        <a href="<?php echo $_lang->getCurrentUrl() ?>" title="<?php echo $this->htmlEscape($_lang->getName()) ?>"><?php echo $this->htmlEscape($_lang->getName()) ?></a>
    <?php endforeach;?>
    </div>
    <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Display Templates in my ASP.NET MVC project. Right now i can
In my project i have to display the bar chart for 30 days with
I have a project where I want to display overlays to locate people on
I have a project in which I need to display multiple UITableView instances inside
We have installed RHQ monitoring system http://rhq-project.org/display/RHQ/Home . From that time our program started
In my project I have to display a list of reports so in the
The following scenario came up in our project: We have hierarchical business objects. The
Im am trying to improve a ToDo app for the iPhone. I have two
We have a project that requires to display a 3D object on the browser
As a part of my project I have to display animated 3d models in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.