1

I have 3 websites(.com/, .com/en/ and .com/eu/), each has one store view. And I created Website Switcher using this method.

https://stackoverflow.com/questions/4270490/how-do-i-get-a-website-switcher-instead-of-store-switcher

<?php
$websites = Mage::app()->getWebsites();

if (count($websites) > 1): ?>
<div class="website-switcher">
    <label for="select-website"><?php echo $this->__('Select Store:') ?></label>
    <select id="select-website" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
    <?php foreach ($websites as $website): // print out each website name and code as a dropdown box item ?>
        <?php $_selected = $website->getCode() == Mage::app()->getWebsite()->getCode() ? ' selected="selected"' : '' ?>
        <option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
    <?php endforeach; ?>
    </select>
</div>
<?php endif; ?>

Now I want to add another language store view on .com/eu/. However, language switcher is not working. I use the default language switcher. The switcher shows up, but when I try to switch to the new store view, it redirects to the page of .com/ website.

How can I fix this?

closed as off-topic by Fabian Schmengler, Qaisar Satti, Amit Bera, Raphael at Digital Pianism, Marius Mar 29 '16 at 7:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced OR seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Fabian Schmengler, Qaisar Satti, Amit Bera, Raphael at Digital Pianism, Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

  • please post screenshots of what have you done so far – Dexter Oct 20 '14 at 11:53
  • what if you use the default language switcher, does it work? – Julien Lachal Oct 20 '14 at 11:54
  • I use the default language switcher. I only changed store switcher. But even if I use default store switcher, did not work. – rtk0407 Oct 20 '14 at 12:13
  • May I ask why you are using the "$website->getDefaultStore()->getBaseUrl()" - our language switcher uses GetCurrentUrl() – snh_nl May 8 '15 at 13:52
  • The code above is website switcher, not language switcher. And because I have multiple websites, I need to use "$website->getDefaultStore()->getBaseUrl()" . For language switcher, I also use getCurrentUrl() – rtk0407 May 10 '15 at 8:30
1

Turned out that I forgot to reset on the admin config the base url on the website scope, instead of storeview scope.

Not the answer you're looking for? Browse other questions tagged or ask your own question.