Search code examples
magentostatic-block

Magento shop static block with different content in shops


so as you read title, i need help with magento static block, my task is to make static block content different in 2 shops, if it's even possible? ty for answers. P.S. Sorry for bad english.


Solution

  • Try this one it works for me. I made it with html/javascript. You can get store name by

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

    and then compare by your needs. Paste code into static block editor.

    <!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>