1

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

Amit Bera
  • 7,581
  • 7
  • 31
  • 57
user3362364
  • 441
  • 11
  • 25

1 Answers1

1

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>
Amit Bera
  • 7,581
  • 7
  • 31
  • 57
  • but i'm talking about a paragraph in the text editor of the CMS pages/Static blocks and NOT the entire page/block. Here's the paragraph for example: "Welcome to the world of Handloom products. Here are the varieties which is shown only to the wholesale users." – user3362364 Apr 16 '14 at 05:09
  • First of all, you cannot check customer data in editor static content. – Amit Bera Apr 16 '14 at 05:13
  • If you want hidden the text ,then add my code in header.phtml and put the Welcome to the world of Handloom product in html element. After that using javasciprt hide and show text – Amit Bera Apr 16 '14 at 05:16
  • instead of the jquery, i used css as there was some issue. anyways, you are f**king AWESOME. Thank You so much :) – user3362364 Apr 16 '14 at 08:57
  • up-voted and also have made it as accepted answer. Hope someone else find it useful too. Thanks again :) – user3362364 Apr 16 '14 at 10:41