Hi, you can do it easily.
Step1: Create a showstatic.phtml template with pp/design/frondtend/YourPackage/YourPackage/template/cms/
Step 2: on this phtml, you can check the client login to the system and its group ID, and then use the Static block.
code:
<?php $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn(); // add Handler when customer is loggedin if($loggedIn): $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get customer Group name $group = Mage::getModel('customer/group')->load($groupId); $Groupcode=$group->getData('customer_group_code'); /* static customer group code array for which static block will call */ $Enableforgroup=array(13, 2, 8, 7); // call static array if (in_array($Groupcode, $Enableforgroup)){ echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); } endif; ?>
Now you can call this phtml in the product category
Category:
Category page app/design/frondtend/YourPackage/YourPackage/template/catalog/category/view.phtml
echo $this->getLayout()->createBlock('core/template')->setTemplate('cms/showstatic.phtml')->toHtml();
Product:
Product page app/design/frondtend/YourPackage/YourPackage/template/catalog/product/view.phtml
echo $this->getLayout()->createBlock('core/template')->setTemplate('cms/showstatic.phtml')->toHtml();
AS magento process:
Create a local.xml file in app/design/frondtend/YourPackage/YourPackage/layout/
Code:
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <catalog_category_view> <reference name="content"> <block type="core/template" name="showstatic" template="cms/showstatic.phtml"> <block type="cms/block" name="showstatichow" > <action method="setBlockId"><block_id>footer_links_company</block_id></action> </block> </block> </reference> </catalog_category_view> <catalog_product_view> <reference name="content"> <block type="core/template" name="showstatic" template="cms/showstatic.phtml"> <block type="cms/block" name="showstatichow" > <action method="setBlockId"><block_id>footer_links_company</block_id></action> </block> </block> </reference> </catalog_product_view> </layout>
Create showstatic.phtml template showstatic.phtml in pp/design/frondtend/YourPackage/YourPackage/template/cms/
Code:
<?php $loggedIn = Mage::getSingleton('customer/session')->isLoggedIn(); // show cms blocks when customer is loggedin if($loggedIn): // get Customer group id from session echo $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); /* $Enableforgroup is array for reseller, general and clients * group ids */ $Enableforgroup=array(13, 2, 1, 7); // call static array if (in_array($groupId, $Enableforgroup)){ echo $this->getChildHtml("showstatichow"); } endif; ?>