cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]Store name -Flags and dropdown image problem

SOLVED

[SOLVED]Store name -Flags and dropdown image problem

Good afternoon!
There is a problem.
I have here is the code

 

<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
    <label for="select-store"><?php echo $this->__('Select Store:') ?></label>
    <select id="select-store" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
        <?php foreach ($this->getGroups() as $_group): ?>
        <?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? ' selected="selected"' : '' ?>
        <option value="<?php echo $_group->getHomeUrl() ?>"<?php echo $_selected ?>><?php echo $this->escapeHtml($_group->getName()) ?></option>
    <?php endforeach; ?>
    </select>
</div>
<?php endif; ?>

 

.store-switcher { float: left }
.store-switcher a {
display: block;
float: left;
height: 20px;
text-decoration: none;
width: 26px;
}

 

it makes representations store in a drop-down list
and working properly

 

select

 

whether it is possible on the basis of this code do

 

this type

or

 

I would be very grateful if you help

5 REPLIES

Re: Store name -Flags and dropdown image problem

Hello Advertech,

 

Absolutely, yes. Which's Magento version you use? If you use equal or greater version 1.9.x, Magento has already flags template for you.

You can find here: 

app/design/frontend/base/default/template/page/switch/flags.phtml

 

You can download latest version from official website and copy this file into your current theme package.

Note: Magento doesn't support flags images, you should google.Smiley Wink

 

Problem solved? Click Accept as Solution!

Re: Store name -Flags and dropdown image problem

Not certainly in that way
I do not fit.

here's a screenshot

 

so I only need to fix this code above
to display flags (multi stores)

now I have no flag - pictures

 

 

 

Re: Store name -Flags and dropdown image problem

Hello Advertech,

 

I want to ask you a question:

For example, we have

+Store name 1: EESTI has three store views: UK, US, VN.

+Store name 2: UK Category has two stores: London and Liverpool.

When choosing EESTI, you also want to show the list of three store views => flag + UK, flag + US, flag + VN?

Problem solved? Click Accept as Solution!

Re: Store name -Flags and dropdown image problem

When choosing EESTI, you also want to show the list of three store views => flag + UK, flag + US, flag + VN?

 

yes you said is true
Only in my case
the output of these flags

When choosing myshop  you also want to show the list of three store views => flag(uk_store_view_name) = UK_storename, flag(et_store_viev_name) = EEsti_storename

Re: Store name -Flags and dropdown image problem

Hello Advertech,

 

Some hard code lines only use for your website here. The important point you need to know is that your store code must is country code. For example: Store Eesti => et, UK Store => uk.

You should google flag images. And then, put them into skin/frontend/your package them/flags/

 

<?php if(count($this->getGroups())>1): ?>
    <div class="store-switcher">
        <label for="select-store"><?php echo $this->__('Select Store:') ?></label>
        <select id="select-store" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
            <?php foreach ($this->getGroups() as $_group): ?>
                <?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? ' selected="selected"' : '' ?>
                <?php $stores = $_group->getStores();
                    foreach ($stores as $store):
                        if ($store->getIsActive() != 0): ?>
                <option value="<?php echo $_group->getHomeUrl() ?>" style="background-image:url('<?php echo $this->getSkinUrl('images/flags/flag_'.$store->getCode().'.gif') ?>');"<?php echo $_selected ?>><?php echo $this->escapeHtml($_group->getName()) ?></option>
                <?php   endif;
                    endforeach; ?>
            <?php endforeach; ?>
        </select>
    </div>
<?php endif; ?>

 

 Hope this works for you.

Problem solved? Click Accept as Solution!