Magento擁有自己的商店切換臺。你可以用它來處理你的情況。 如果你看一下基本模板的page.xml佈局,你會看到這樣的事情:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
所以,如果你想顯示在頁腳店內切換,你應該修改文件page/html/footer.phtml
和地方補充婁代碼要顯示:
<?php echo $this->getChildHtml('store_switcher'); ?>
如果你想改變下拉菜單鏈接,你應該修改模板page/switch/stores.phtml
像波紋管:
<?php if(count($this->getGroups())>1): ?>
<div class="store-switcher">
<label for="select-store"><?php echo $this->__('Select Store:') ?></label>
<ul id="select-store">
<?php foreach ($this->getGroups() as $_group): ?>
<?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? 'active' : '' ?>
<li class="store-<?php echo $_group->getCode()?> <?php echo $_selected ?>">
<a href="<?php echo $_group->getHomeUrl() ?>"><?php echo $this->htmlEscape($_group->getName()) ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
**注意:編輯腳註後的任何內容可能需要刷新緩存,因爲默認情況下Magento緩存頁腳塊。
在塊類中可以使用$ this-> getUrl()。調查Mage_Core_Model_Url。你應該可以做這樣的事情:$ this-> getUrl('...',array('_ store'=> ...)) – butterbrot 2013-05-06 06:45:38