2014-04-27 93 views
1

我有兩個商店創建,零售和批發。我創建了一個在兩個商店都可見的靜態塊。如果沒有登錄,我想隱藏一條線,當有人用css顯示器打開批發頁面時:無。從一個magento商店隱藏文字

我需要一個php代碼,可以檢測不同的商店,所以我可以添加css類。我見過登錄用戶的例子,但不是商店。

<?php 
if (store = wholesale) then 
else if… 
end if 
?> 

任何人:

,我正在尋找的示例代碼?

回答

1

使用本

$storeCode = Mage::app()->getStore()->getCode(); 
if($storeCode == 'default') 
{ 
      /* your code here */ 
}; 
+0

我加了這個,但它不工作!可能是什麼原因? $ storeCode = Mage :: app() - > getStore() - > getCode();如果($ storeCode =='wholesale') { echo'hello world'; }; – user3362364

+0

確保您的商店代碼在菜單系統 - >管理存儲的後端註冊,查看商店視圖名稱代碼&它的配置是否正確......或調試使用echo $ storeCode; – Ansyori

0

您可以將儲存條件按如下:

if (Mage::app()->getStore()->getId() == YOUR STORE VIEW ID HERE) 
{ 
    //apply your custom code here 
} 
or 
if (Mage::app()->getStore()->getCode() == YOUR STORE VIEW CODE HERE) 
{ 
    //apply your custom code here 
} 

應用商店ID或密碼,並相應地把他們的條件。