i am trying building a small module which house a Observer for getting called when and event called when catalog_product_import_profile_after
is fired this is custom event which i have fired using the
Mage::dispatchEvent('catalog_product_import_profile_after',array('adapter'=>$this));
in the app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php
file
My module config.xml is
<?xml version="1.0"?>
<config>
<modules>
<GWB_ClearOrphan>
<version>0.1.0</version>
</GWB_ClearOrphan>
</modules>
<global>
<helpers>
<clearorphan>
<class>GWB_ClearOrphan_Helper</class>
</clearorphan>
</helpers>
<models>
<clearorphan>
<class>GWB_ClearOrphan_Model</class>
<resourceModel>clearorphan_mysql4</resourceModel>
</clearorphan>
</models>
<events>
<catalog_product_import_profile_after> <!-- identifier of the event we want to catch -->
<observers>
<catalog_product_import_profile_after_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>clearorphan/observer</class> <!-- observers class alias -->
<method>disableProducts</method> <!-- observer's method to be called -->
<args></args> <!-- additional arguments passed to observer -->
</catalog_product_import_profile_after_handler>
</observers>
</catalog_product_import_profile_after>
</events>
</global>
</config>
and the Observer.php
is
<?php
class GWB_ClearOrphan_Model_Observer
{
public function disableProducts(Varien_Event_Observer $observer)
{
//mail('[email protected]','sub-test','msg-test');
try{
$collection = Mage::getModel('catalog/product')->getCollection();
$pro_collection = var_dump($collection);
mail('[email protected]','collection',$pro_collection);
}
catch(Exception $e) {
//Mage::log($e->getMessage(), null, 'collection.log');
}
}
the mail under the disableProducts function is working correctly but i am not able to get the product collection using this code $collection = Mage::getModel('catalog/product')->getCollection();
any body having any idea about what i have made wrong kindly point it out. Thanks.