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

Page 1 of 2
Moving “Select Store” Dropdown from footer to header or another block
 
dell
Member
 
Avatar
Total Posts:  61
Joined:  2008-01-01
 

The “select store” dropdown resides out of site at the bottom of the pages.  How would I move “Select store” dropdown selector to the header or even the top of the left pane so an unfamiliar or new customer would readily see the “store” options without having to roll up the page? 

Appreciate the help. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
johannes
Magento Team
 
Avatar
Total Posts:  11
Joined:  2007-08-03
 

Dell - The store switcher is its own block in Magento.  You can see it called by page.xml towards the bottom as:

<block type="core/store_switcher" name="store_switcher" template="core/stores.phtml"/>

Also note that it’s inside of the footer block.

To move it to a different place, you’d need to move the xml call to the desired new location in the layout, and then do any necessary updates to the relevant .phtml files and/or .css files.  For more information about working with Magento’s template system, please check out the Magento Designer’s Guide at http://www.magentocommerce.com/design_guide

Chapter 4, “Intro to Layouts” covers the code structure in much more depth than this post wink
http://www.magentocommerce.com/design_guide/articles/intro-to-layouts

Hope that helps smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
dell
Member
 
Avatar
Total Posts:  61
Joined:  2008-01-01
 

Thanks for the lead.  Not sure if it helped or not.  I took the following actions.  First I opened <b>"page.xml" </b> and moved
<b><block type="core/store_switcher" name="store_switcher" template="core/stores.phtml"/> </b>
To: Header area:

<block type="page/html_header" name="header" as="header">
<block type="page/html_toplinks" name="top.left.links" as="topLeftLinks"/>
<block type="page/html_toplinks" name="top.right.links" as="topRightLinks"/>
<b><block type="core/store_switcher" name="store_switcher" template="core/stores.phtml"/></b>

Then I opened <b>“main.xml”</b> and moved line #127
<b><block type="core/store_switcher" name="store_switcher" template="core/stores.phtml"/></b>

From the “footer section” to the header section above in main.xml.

<block type="page/html_header" name="header" as="header">
<b><block type="core/store_switcher" name="store_switcher" template="core/stores.phtml"/></b>
<block type="page/html_toplinks" name="top.left.links" as="topLeftLinks"/>
<block type="page/html_toplinks" name="top.right.links" as="topRightLinks"/>
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
</block>

Then I opened the “boxes.css” line 554 and moved the following line from footer section:

<b>.footer .store-switcher { display:inline; padding:0 10px 0 0; vertical-align:middle; }</b>

To the header section above in “boxes.css”:

.header { border-top:5px solid #0d2131; }
.header-top-container { border-bottom:1px solid #415966; background:url(../images/header_top_container_bg.jpg) repeat-x 50% 0; }
.header-top { padding:10px; }
<b>.header .store-switcher { display:inline; padding:0 10px 0 0; vertical-align:center; }</b>
.header-nav-container { background:url(../images/nav_bg.jpg) repeat-y 50% 0 #0a263d; }
.middle-container { background:url(../images/main_container_bg.gif) no-repeat 50% 0 #fbfaf6; }
.middle { background:url(../images/main_bg.gif) no-repeat #fffffe; padding:25px 25px 80px 25px; }

This removed “store switcher” from footer but it does not show up in the center of the header.  Looking for some more guidance.

Appreciate, confused

 
Magento Community Magento Community
Magento Community
Magento Community
 
dell
Member
 
Avatar
Total Posts:  61
Joined:  2008-01-01
 

Thought some more about this and realized I needed to also modify the “header.phtml” to call for the “select store” dropdown .

Added:  <?=$this->getChildHtml()?>

to the phtml below and the “select store” dropdown now appears in the header.  Problem is I’m also duplicating the links, menu, etc by use of this command.  Someone more familiar with the programming language should be able to tell me how to change this one line to get the correct results.....  Thanks

<div class="header-top-container">
<div class="header-top">
<h1 id="logo"><a href="<?=$this->getUrl('')?>"><img src="<?=$this->getLogoSrc()?>" alt="<?=$this->getLogoAlt()?>"/></a></h1>
<p class="no-show"><a href="#main"><strong><?=$this->__('Skip to Main Content')?> »</strong></a></p>

<?=$this->getChildHtml('topSearch')?>
<div class="quick-access">
<div class="account-access">
<strong><?=$this->getWelcome()?></strong><?=$this->getChildHtml('topLeftLinks')?>
</div>
<div class="shop-access">
<?=$this->getChildHtml('topRightLinks')?>
<?=$this->getChildHtml()?>
</div>

</div>

</div>
</div>
<?=$this->getChildHtml('topMenu')?>

Appreciate the help: smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
kharisma
Member
 
Total Posts:  67
Joined:  2007-10-18
Australia
 

Just an idea, but would it help to put as="store_switcher” into the definition for the store_switcher in page.xml then call <?=$this->getChildHtml('store_switcher')?> in header.phtml?

Just guessing but might be worth a try smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
dell
Member
 
Avatar
Total Posts:  61
Joined:  2008-01-01
 

Thanks Kharisma, for the hint.  Actually I had tried “store_switcher” originally but left out the single quotes.  Making it ( ‘store_switcher’) indeed placed it in the header were customer can readily spot.  Didn’t have to define in page.xml although that would probably be the correct thing to do.
grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
kharisma
Member
 
Total Posts:  67
Joined:  2007-10-18
Australia
 

Glad it worked smile

BTW What version are you using? I cannot find main.xml in the frontend of 0.7.14800.  There was one in 0.6.14800.

I have tried what you suggested in version 7 (without the main.xml ‘cos can only find the adminhtml/.../main.xml) and still stubbornly remains in the footer, so my suggestion was just a guess.

page.xml : moved <block type="core/store_switcher" name="store_switcher" as="storeSwitcher" template="core/stores.phtml"/> up to the header.

header.phtml: inserted <?=$this->getChildHtml('storeSwitcher')?>

boxes.css: changed the code to .header .store-switcher { display:inline; padding:0 10px 0 0; vertical-align:middle; }

No joy - why? Is there a step I haven’t done? (’course, I can’t find a main.xml in the frontend - have double-checked the zip file that I downloaded)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

This part of the learning curve is easier if you add in more than one store - even if only making one shop. Create a test store, load products into it and work on the test category tree. When done, export what you have, then try loading products into ‘base’ (default main shop) with CSV import. I presume you will be importing all your products…

 
Magento Community Magento Community
Magento Community
Magento Community
 
dell
Member
 
Avatar
Total Posts:  61
Joined:  2008-01-01
 

I am using version 6.14100.  Saw somewhere on the forum that new version would not run on 1 & 1 shared which is my host so have not try to load new version yet.  Would like to but no reason to waste time if it won’t work.  I need the “store selector” to be easily visible to customers so once I have loaded a newer version I’ll be tackling this again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
artmechanix
Member
 
Total Posts:  39
Joined:  2008-08-07
 

If it helps anyone else…

I’m using Magento 1.1.6.  I wanted to keep my store switcher at the bottom, but also add one at the top, underneath “My Account” “My Wishlist”, etc.  I only had to deal with two pages to get those results.

magento/app/design/frontend/default/default/layout/page.xml and
magento/app/design/frontend/default/default/template/page/header.phtml

In page.xml, I inserted

<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
around line 68, within the header block.  For mine, I put it after languages and before top menu.

In header.phtml, I inserted

<?=$this->getChildHtml('store_switcher')?>
around line 37 within the div class “shop-access” call, after top links.  (you might want to put a break
<br/>
in there, also, so that there’s a little bit of distance between the store switcher and the account navigation links.

Then in Admin’s Cache Management, I did a refresh, and all changes showed up.

Doh… I just noticed kharisma already mentioned this, and the css inclusion will take care of the spacing break, I mentioned.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bts_eu
Sr. Member
 
Total Posts:  81
Joined:  2008-05-07
 

Thank you very much! It helped me! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
bts_eu
Sr. Member
 
Total Posts:  81
Joined:  2008-05-07
 

Now I´ve got a further question. I would like to change the pulldown-menu to images. I´ve done that also with the language-pulldown (http://www.magentocommerce.com/boards/viewthread/8434/) and I´ve tried to do that with the stores.phtml. The images are there, but the links don´t work. There is the same link on every store. Can somebody help me please?

Here ist my stores.phtml:

<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">

<?php foreach ($this->getGroups() as $_store): ?>
<a href="<?php echo $_store->getCurrentUrl() ?>"><img
src
="<?php echo $this->getSkinUrl('images/store_' . $this->htmlEscape($_store->getName()) . '.gif') ?>" width="155" height="27"
alt="<?php echo $this->htmlEscape($_store->getName()) ?>"/></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>

Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bts_eu
Sr. Member
 
Total Posts:  81
Joined:  2008-05-07
 

Can somebody help me please?

 
Magento Community Magento Community
Magento Community
Magento Community
 
elbie
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2009-01-08
 

bts_ue and all,

Hava been fidling with this for several hours now.
Got to this:

<!-- this is a store switcher that shows a standard text link -->

<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
    
<?php foreach ($this->getGroups() as $_group): ?>
    
<a href="<?php echo $_group->getHomeUrl() ?>"><?php echo $this->htmlEscape($_group->getName()) ?></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>


<!-- this is a store switcher that shows an image based link -->

<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
    
<?php foreach ($this->getGroups() as $_group): ?>
    
<a href="<?php echo $_group->getHomeUrl() ?>"><img
src
="<?php echo $this->getSkinUrl('images/store_' . $this->htmlEscape($_group->getName()) . '.gif') ?>" width="30" height="20"
alt="<?php echo $this->htmlEscape($_group->getName()) ?>"/></a>
    
<?php endforeach; ?>
</div>
<?php endif; ?>

The issue that I have with it is that it work fine as long as you have only one language configured for your website.
When you have several (like me), that it get’s a little messy in the sense that when you have selected an alternative language, the link for the second store point to the default language. Hence the user needs to reselect the alternative language again.
Not very nice…

If anyone has an idea to fix that, please feel free grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
akamyself
Jr. Member
 
Total Posts:  14
Joined:  2008-08-15
 

Hi everybody

Allow me to get back on the main thread subject which is about moving the store-switcher from the bottom to the top.
Tried Dell, Kharisma and vivaknievel advices and guidance but does not work.

Using Magento 1.2.0.1 and wanting to have style-switcher at both top (right next to the language drop down) and at the bottom, I did add this line in the page.xml :

<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>

Right after the language block.

In the header.phtml I put :

<?=$this->getChildHtml('store_switcher')?>

Right before the </div>

And last in the boxes.css I added at line 331 :

.store-switcher { display:inline; padding:0 10px 0 0; vertical-align:middle; }

Right after the language-switcher lines.

But nothing appears on the frontend. Like some people, I don’t have any main.xml file so I guess all changes have to be made on the 3 I mentioned.
If someone can help me out with this, would really appreciate this…

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
akamyself
Jr. Member
 
Total Posts:  14
Joined:  2008-08-15
 

please…

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2