Search code examples
magentomagento-1.8static-block

Hide a paragraph of static block /cms page from wholesale customer group in magento


i'm using CMS pages and Static Blocks and would like to hide a text paragraph from showing it to a wholesale group.

is this possible with magento? Kindly help.

Magento 1.8.1


Solution

  • If,you want to hide a text paragraph from ,then first check wholesaler is logged in or not, then check current customer group is wholesaler.

    Here code add in header.phtml

    <?php
        if(Mage::getSingleton('customer/session')->isLoggedIn() and Mage::getSingleton('customer/session')->getCustomerGroupId()==2 ){
        ?>
        <script type="text/javascript">
        document.getElementById("noforid").style.display=none;
        </script>
        /* using jquery*/
         <?php 
        // do not show paragraph
        //Get customer Group name
        $group = Mage::getModel('customer/group')->load($groupId);
         }
        else{
        ?>
        <?php
        // text paragraph of your
        }
        ?>
    

    And put you content in a html element and put id of element.Using java-script hide the content.

    <p id="noforid">your text</p>