隐藏一个magento商店的文字

时间:2014-04-27 20:31:22

标签: magento magento-1.8

我有两个商店,零售和批发。我在两个商店中都创建了一个静态块。如果没有登录,我想在某人使用css display:none。

打开批发页面时隐藏一行

我需要一个可以检测不同商店的PHP代码,这样我就可以添加css类了。我已经看到了登录用户的示例,但没有看到商店的示例。

我正在寻找的示例代码:

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

任何?

2 个答案:

答案 0 :(得分:1)

使用此

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

答案 1 :(得分: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或代码并将其置于相应状态。