Question

I have created two store views, each one for a different language. I created two static blocks, having the same identifier but different content (one in English and one in Russian) and each one is assigned to the corresponding store view.

Then, I created two categories, one for the English and one for the Russian language and assigned from the display settings the corresponding CMS static block. When I change language, the category changes accordingly and the static block content is loaded correctly. Now, I need to add one link on home page and the link should redirect me to this category page and display the correct static block content. For example when the user selects EN as language, display the English store view static block and when the user selects the RU as language, to display the Russian store view static block.

This is my code:

<h3 class="product-name"><a href="/family.html"> <?php echo $this->__('Family') ?></a></h3>

The problem with this is that family.html only loads in the English store view but in the Russian store view loads the page without the content (which is a different CMS static block). How can I change the reference in order to load the page and the content in both stores?

Was it helpful?

Solution

you should add the ___store parameter to the link

<h3 class="product-name"><a href="/family.html?___store=ru"> <?php echo $this->__('Family') ?></a></h3>

this will go to the "russian" store view (assuming "ru" as storeview code)

but you shoudl edit your question because is nto clear wht you mean for "selected" language.

if you are already in "russian" and you dont use the "store code for the url" you are in a serious trouble because Magento cannot understand if /family.html refer to the en or ru store.

Usually we use

/en/family.html

/ru/family.html (or better a locale version)

if you dont use the store code

/family-en.html

/ru/family-ru.html

Hope this helps

OTHER TIPS

I'm not really sure what you want to achieve, but I try to answer nevertheless.

To add a static block to your home page use following snippet (this goes to cms page content tab):

{{block type="cms/block" block_id="my-static-block-id"}}

This displays static block "my-static-block-id" which is assigned to the current view. To add links into static block use:

<a href="{{store url='my-page'}}">My Page</a>

This creates a link that refers to a page {base url}/my-page

One CANNOT "redirect" to static blocks as static blocks are not pages, they are more like complex page components (menus, footer blocks and so on), they only have meaning and value with context.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top