Skip to content

Commit 2b0eb69

Browse files
committed
70064
1 parent 9e9e7ae commit 2b0eb69

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
class Magento_Stackexchange70064_Model_Observer{
3+
4+
public function addCustomerLoadLayout($observer)
5+
{
6+
$loggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
7+
// add Handler when customer is loggedin
8+
if($loggedIn):
9+
10+
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
11+
//Get customer Group name
12+
13+
$group = Mage::getModel('customer/group')->load($groupId);
14+
Mage::log('sss'.$group->getName(),null,'am.log');
15+
16+
// add handler to current layout
17+
$observer->getEvent()->getLayout()->getUpdate()
18+
->addHandle('customer_group_'.strtolower($group->getData('customer_group_code')));
19+
//Mage::log('customer_group_'.strtolower($group->getData('customer_group_code')), null, 'logfile.log');
20+
endif;
21+
22+
}
23+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<config>
3+
<modules>
4+
<Magento_Stackexchange70064>
5+
<version>1.0.0</version>
6+
</Magento_Stackexchange70064>
7+
</modules>
8+
<global>
9+
<models>
10+
<stackexchange70064>
11+
<class>Magento_Stackexchange70064_Model</class>
12+
</stackexchange70064>
13+
</models>
14+
</global>
15+
<!--
16+
add handler
17+
-->
18+
<frontend>
19+
<events>
20+
<controller_action_layout_load_before>
21+
<observers>
22+
<customer_group_wise_handler>
23+
<class>stackexchange70064/observer</class>
24+
<method>addCustomerLoadLayout</method>
25+
</customer_group_wise_handler>
26+
</observers>
27+
</controller_action_layout_load_before>
28+
</events>
29+
</frontend>
30+
</config>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<config>
3+
<modules>
4+
<Magento_Stackexchange70064>
5+
<codePool>local</codePool>
6+
<active>true</active>
7+
</Magento_Stackexchange70064>
8+
</modules>
9+
</config>

0 commit comments

Comments
 (0)