Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Get current store code ? 
 
mikeyao
Jr. Member
 
Total Posts:  17
Joined:  2008-08-21
 

I created multi language stores. I need to change picture when switch the different language. So i’m going to get the current store code and change the picture, like:

switch (store_code{
case 'en':
  
$pic 'pic_en.jpg';
case 
'cn':
  
$pic 'pic_cn.jgp';
}

I don’t know how to get the current store code.

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dieTaste
Jr. Member
 
Total Posts:  6
Joined:  2008-04-29
Germany, Bayern
 

With

Mage::app()->getLocale()->getDefaultLocale()

you get the locale like de_DE!

Have fun with Magento!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriel Queiroz
Sr. Member
 
Total Posts:  135
Joined:  2008-05-28
Brasília, Brazil
 

As for the store code:

Mage::app()->getStore()->getCode();

Cheers,

 
Magento Community Magento Community
Magento Community
Magento Community
 
istel
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2009-02-17
Italy
 

Hi!
I need the “store code” in a static page.
I want to retrieve store code (Mage::app()->getStore()->getCode(); ) as the same as {{skin url=""}} . In fact, as you know, it is not possible to use php code in static pages (for example Home Page).

Any ideas?

Thank you very much

 
Magento Community Magento Community
Magento Community
Magento Community
 
stiepan
Jr. Member
 
Total Posts:  9
Joined:  2009-12-08
 

Hi, afaik there’s no xml equivalent, you have to do it in php via the phtml template files.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeyhun
Member
 
Total Posts:  38
Joined:  2010-02-20
 

I have the same issue.
I think the thread should be re-posted under a broader issue like “Managing Images for Multiview Stores.” It would be nice, if the so-called static pages had more variables available to embed.

As, I understand, there are two ways of showing different but associated images (e.g., multilanguage callouts) in static pages for multiple store views:

1. Creating separate static page variants for each store view (which makes it more complex); and
2. Having single static page with dynamic content (which makes me re-think the meaning of “static").

In the latter case, I have not seen an efficient way of appending the Store Code to image URL except maybe through a custom variable using Mage::app()->getStore()->getCode();.

See, also, http://www.mageworx.com/magento-tweaks-magento-extension.html for a paid extension.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeyhun
Member
 
Total Posts:  38
Joined:  2010-02-20
 

Hi,

To localize your images do the following:

1. Make sure your Store View Code is the same as in the ISO 3166-1 alpha-2 or IETF language tag (e.g., cn for Chinese);
2. Go to Admin > System > Configuration > GENERAL > Design > Themes;
3. Choose a Store View Name you would like the images to be localized in the ‘Current Configuration Scope’;
4.  In the ‘Default’ field enter the Store View Code (i.e., cn);
5. Make sure your images have the exact same name and extension as in the English version;
6.  For the default template, place the localized images in the following directory:
.../skin/frontend/default/[YOUR LNAGUAGE ISO-3166 CODE]/images
(e.g., .../skin/frontend/default/cn/images)

Now, your images should change with the store view.
See “Hierarchical file processing” part in http://www.packtpub.com/article/magentos-architecture-part1 for more.

Hope it works for you all, too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bkjain
Jr. Member
 
Total Posts:  14
Joined:  2012-10-10
 
Gabriel Queiroz - 26 February 2009 05:08 AM

As for the store code:

Mage::app()->getStore()->getCode();

Cheers,

It’s Work .. Thanx lot,,

 
Magento Community Magento Community
Magento Community
Magento Community
 
ElvisPfeifer1
Jr. Member
 
Total Posts:  1
Joined:  2013-05-27
 

Thank you, that’s working good

 
Magento Community Magento Community
Magento Community
Magento Community
 
manthankvora
Jr. Member
 
Total Posts:  6
Joined:  2012-04-01
 
Gabriel Queiroz - 26 February 2009 05:08 AM

As for the store code:

Mage::app()->getStore()->getCode();

Cheers,

Thank you. It works fine.

 
Magento Community Magento Community
Magento Community
Magento Community
 
longstone
Jr. Member
 
Total Posts:  11
Joined:  2011-01-02
 

Hello,
have a look here for a full description…
http://www.techdilate.com/code/magento-get-current-store-details/
bye
Enrico

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top