2013-05-05 55 views
0

链接到个人Magento的多店铺我有两家店设置与使用Magento的1.7.2子域:如何使用SID

店#1: www.store.com

店#2: alt.store.com

页脚内有一个调用存储选择器,但输出是以下拉菜单的形式。我搜索了几个小时,找不到解决方案,我试图做的是有能力链接文本和/或图像,以便商店之间的切换更加用户友好。类似于用户在gap.com上的商店之间切换的方式

如果我直接链接到商店的URL而没有SID(这是下拉菜单首次在商店之间切换时引入的内容),则购物车中的商品不是记住。这看起来应该比试图找到答案要容易得多...关于如何使这项工作有任何想法?

当网站#1,你会看到这样click here to shop on our other store

一个链接,然后在网站上#2,如果你想回去存储#1,我假设的SID将不再需要因为你已经烹饪过,但如果你不是逻辑应包括SID ......至少这是我从看到下降的行动和我阅读的信息位的理解。感谢您的帮助提前。

+0

在块类中可以使用$ this-> getUrl()。调查Mage_Core_Model_Url。你应该可以做这样的事情:$ this-> getUrl('...',array('_ store'=> ...)) – butterbrot 2013-05-06 06:45:38

回答

0

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缓存页脚块。

enter image description here

+0

感谢您的回答,但正如我在原始文章中提到的那样,提供给我一个下拉。相反,我正在寻找如何链接图片或文本,而不是像您所描述的那样使用传统的下拉菜单。 – user1851806 2013-05-06 04:34:47

+0

我更新了我的安装程序。 – ndlinh 2013-05-06 11:44:02