2014-12-02 127 views
0

因此,當您閱讀標題時,我需要與magento靜態塊的幫助,我的任務是讓2個商店中的靜態塊內容不同,如果甚至可能的話? ty尋求答案。 P.S.對不起英語不好。Magento商店店鋪中的不同內容的靜態塊

+0

這是在一個多商店設置或2個完全獨立的網站? – PixieMedia 2014-12-02 19:34:14

+0

多店鋪設置,它與mac444s的答案。 – 2014-12-03 22:10:51

回答

0

試試這個它適合我。我用html/javascript製作了它。您可以通過

var shopName= '{{config path="general/store_information/name"}}'; 

然後根據您的需要進行比較來獲得店名。將代碼粘貼到靜態塊編輯器中。

<!DOCTYPE html> 
<html> 
<body onload="websiteMessage()"> 
<p>Happy new years !!!</p> 
<p id="static_block"></p> 

<script> 
function websiteMessage() { 
    var shopName= '{{config path="general/store_information/name"}}'; 
    var string = ""; 

if(shopName.localeCompare("Leather_shoes_shop") == 0) 
{ 
    string = "leather shoes"; 
} 
else if(shopName.localeCompare("Rubber_shoes_shop") == 0) 
{ 
    string = "rubber shoes"; 
} 
else 
{ 
    string = "other"; 
} 
document.getElementById('static_block').innerHTML = string; 
} 
</script> 
</body> 
</html> 
+0

謝謝!!!多數民衆贊成我正在尋找。 – 2014-12-02 18:30:56

1

FYI正確Magento的方式多店做,這是建立兩個具有相同ID的靜態塊和分配每一個你想讓它顯示在商店視圖。 Magento將根據當前正在查看的商店加載正確的版本。