2

This is my first time creating a multi-lingual webshop, so first I created 2 storeviews, where the switcher was working fine. Then I found out that I needed to create multi-websites instead. I did it in the same process, but it is not working now. I've added a few screenshots so you can see what I have done.

2

The store switcher does not appear unless you have 2 store views under the current website you are viewing.
Since you have only one store view for each website this does not appear.

You can try to change the /app/design/frontend/{package}/{theme}/template/page/switch/languages.phtml to support all store views like this (untested code):

<?php $stores = Mage::getModel('core/store')->getCollection()->addFieldToFilter('is_active', 1)->addFieldToFilter('store_id', array('neq'=>0));?>
<?php if(count($stores)>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 ($stores 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; ?> 
  • The problem appears because on da.thirstforgreat.... it still runs the thirstforgreat.... website. I think the problem appears because you have the line $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE']: ''; just like @roman204 said in the other answer. Remove that. – Marius Aug 5 '14 at 12:15
  • Hmm I tried deleting that now, but there still seems to be somm kind of issue. Eventhough I changed language and so on for the danish website, it hasn't changed on da.thirstforgreat... – McKeene Aug 5 '14 at 12:25
  • I think this a different problem then. It is not in the scope of this question. This was about showing the store switcher. I think you should ask an other question. – Marius Aug 5 '14 at 12:26
0

your website selection will not work, you override the $mageRunCode in line 95. it should be

switch($_SERVER['HTTP_HOST']{
    case 'domain.com':
       $_SERVER['MAGE_RUN_CODE'] = 'run_code';
    break;
    ...
    ...
   }
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE']: '';

but to get the switcher showing you should add 2 or more storeviews at a website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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