I wanna use customer_logout
event to un-register data from registry.
Can anybody help?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityYou can use customer_logout event to do that below is sample code write the code in your config.xml
<events>
<customer_logout>
<observers>
<Namespace_Module_Model_Observer>
<type>singleton</type>
<class>Namespace_Module_Model_Observer</class>
<method>CustomerLogout</method>
</Namespace_Module_Model_Observer>
</observers>
</customer_logout>
</events>
First you need study about magento event/observer from
Here an example :
<global><!-- here global is define the where are you want to fire event. If we make it frontend then it will fire in frontend
if Fire admin area then it should be adminhtml
Value: global/adminhtml/frontend
-->
<events>
<customer_logout> <!-- identifier of the event we want to catch -->
<observers>
<customer_logout_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>modulename/observer</class> <!-- observers class alias -->
<method>FireAndfuncyion</method> <!-- observer's method to be called -->
</customer_logout_handler>
</observers>
</customer_logout>
</events>
</global>
when magento is fire an event then it send some parameters to Observer.Using this parameter implement your operation.
Whenever magento fire customer_logout even
t then it send customer data to Observer.
Mage::dispatchEvent('customer_logout', array('customer' => $this->getCustomer()) );
thus we can use this data.
On observer you can get this parameters value data
<?php
class ModuleNameSpace_ModuleName_Model_Observer
{
public function FireAndfuncyion(Varien_Event_Observer $observer)
{
// Mage::dispatchEvent('customer_logout', array('customer' => $this->getCustomer()) );
$customer = $observer->getEvent()->getCustomer();
}
}