0

Here is my situation. I have a store for each country I serve and a view for each language supported.

I will have pages for the different languages.

My question is how do I create a menu for my pages in Magento without editing the templates? Is it even possible?

And how can I have a changing menu for each language I support (it will not be divided by countries)?

If not possible, how can I detect which language was selected so I can use a if in my code?

And since I have my Magento setup divided in multiple countries and languages, and that I have a custom design (template), how can I load multiple header templates for each languages without having to copy my whole custom template?

Meaning is there a way to have as a base template without changing the base template of Magento with different header templates?

  • 1
    The second half of this question should be asked separately. – philwinkle Aug 27 '13 at 23:56
  • Any movement on this? Anything I can do to help clarify an answer for you? Please update your question if you have more information that can help us close this out. – philwinkle Sep 6 '13 at 19:22
  • Sorry, I am looking at it now. – jnbdz Sep 6 '13 at 22:14
1

This could be very easy or very difficult. Let's go the easy route:

Create a new CMS page. Add this short code to it to create a new block inside it:

{{block type="page/switch" name="store.switcher.list" template="switcher/list.phtml"}}

Obviously you'll have to create that new template phtml file we just referenced - we're calling it list.phtml; you can call it whatever you like.

The contents of that template would reference the getGroups method of the parent block:

<?php foreach ($this->getGroups() as $_group): ?>
    <a href="<?php echo $_group->getHomeUrl() ?>"
    <?php echo $this->escapeHtml($_group->getName()) ?>
    </a><br/>
<?php endforeach; ?>

This displays a vertical list of anchor text. Each link is the store's URL to its home page. Obviously there's not much in the way of design. If you want to get fancier you can output each store name in a <td></td> and every 5 lines output a </tr><tr> to create a tabular design:

<table>
<tbody>
<tr>
<?php $i=0; ?>
<?php foreach($this->getGroups() as $_group)): ?>
    <?php if($i++%10==0):?></tr><tr><?php endif; ?>
    <td>
        <a href="<?php echo $_group->getHomeUrl() ?>"
        <?php echo $this->escapeHtml($_group->getName()) ?>
        </a>
    </td>
<?php endforeach; ?>
</tr>
</tbody>
</table>
| improve this answer | |
  • What does the $this refer to? – jnbdz Sep 6 '13 at 22:23
  • The page/switch block, namely, Mage_Page_Block_Switch – philwinkle Sep 6 '13 at 22:31

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.