2013-05-05 54 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