Mage_Catalog_Model_Observer Class Reference

List of all members.

Public Member Functions

 storeEdit (Varien_Event_Observer $observer)
 storeAdd (Varien_Event_Observer $observer)
 storeGroupSave (Varien_Event_Observer $observer)
 storeDelete (Varien_Event_Observer $observer)
 categoryMove (Varien_Event_Observer $observer)
 catalogProductImportAfter (Varien_Event_Observer $observer)
 catalogProductCompareClean (Varien_Event_Observer $observer)
 categorySaveAfter (Varien_Event_Observer $observer)


Detailed Description

Definition at line 35 of file Observer.php.


Member Function Documentation

catalogProductCompareClean ( Varien_Event_Observer observer  ) 

Catalog Product Compare Items Clean

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 175 of file Observer.php.

00176     {
00177         Mage::getModel('catalog/product_compare_item')->clean();
00178         return $this;
00179     }

catalogProductImportAfter ( Varien_Event_Observer observer  ) 

Process catalog data after products import

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 162 of file Observer.php.

00163     {
00164         Mage::getModel('catalog/url')->refreshRewrites();
00165         Mage::getResourceSingleton('catalog/category')->refreshProductIndex();
00166         return $this;
00167     }

categoryMove ( Varien_Event_Observer observer  ) 

Process catalog data after category move

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 138 of file Observer.php.

00139     {
00140         $categoryId = $observer->getEvent()->getCategoryId();
00141         $prevParentId = $observer->getEvent()->getPrevParentId();
00142         $parentId = $observer->getEvent()->getParentId();
00143         Mage::getModel('catalog/url')->refreshCategoryRewrite($categoryId);
00144         Mage::getResourceSingleton('catalog/category')->refreshProductIndex(array(
00145             $categoryId, $prevParentId, $parentId
00146         ));
00147         Mage::getModel('catalog/category')->load($prevParentId)->save();
00148         Mage::getModel('catalog/category')->load($parentId)->save();
00149         if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00150             Mage::getResourceModel('catalog/category_flat')
00151                 ->move($categoryId, $prevParentId, $parentId);
00152         }
00153         return $this;
00154     }

categorySaveAfter ( Varien_Event_Observer observer  ) 

After save event of category

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 187 of file Observer.php.

00188     {
00189         if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00190             $category = $observer->getEvent()->getCategory();
00191             Mage::getResourceModel('catalog/category_flat')->synchronize($category);
00192         }
00193         return $this;
00194     }

storeAdd ( Varien_Event_Observer observer  ) 

Process catalog data related with new store

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 69 of file Observer.php.

00070     {
00071         $store = $observer->getEvent()->getStore();
00072         /* @var $store Mage_Core_Model_Store */
00073         Mage::app()->reinitStores();
00074         Mage::getConfig()->reinit();
00075         Mage::getModel('catalog/url')->refreshRewrites($store->getId());
00076         Mage::getResourceSingleton('catalog/category')->refreshProductIndex(
00077             array(),
00078             array(),
00079             array($store->getId())
00080         );
00081         if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00082             Mage::getResourceModel('catalog/category_flat')
00083                 ->synchronize(null, array($store->getId()));
00084         }
00085         Mage::getResourceModel('catalog/product')->refreshEnabledIndex($store);
00086         return $this;
00087     }

storeDelete ( Varien_Event_Observer observer  ) 

Process delete of store

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 123 of file Observer.php.

00124     {
00125         if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00126             $store = $observer->getEvent()->getStore();
00127             Mage::getResourceModel('catalog/category_flat')->deleteStores($store->getId());
00128         }
00129         return $this;
00130     }

storeEdit ( Varien_Event_Observer observer  ) 

Process catalog ata related with store data changes

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 43 of file Observer.php.

00044     {
00045         $store = $observer->getEvent()->getStore();
00046         /* @var $store Mage_Core_Model_Store */
00047         if ($store->dataHasChangedFor('group_id')) {
00048             Mage::app()->reinitStores();
00049             Mage::getModel('catalog/url')->refreshRewrites($store->getId());
00050             Mage::getResourceModel('catalog/category')->refreshProductIndex(
00051                 array(),
00052                 array(),
00053                 array($store->getId())
00054             );
00055             if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00056                 Mage::getResourceModel('catalog/category_flat')->synchronize(null, array($store->getId()));
00057             }
00058             Mage::getResourceSingleton('catalog/product')->refreshEnabledIndex($store);
00059         }
00060         return $this;
00061     }

storeGroupSave ( Varien_Event_Observer observer  ) 

Process catalog data related with store group root category

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Catalog_Model_Observer

Definition at line 95 of file Observer.php.

00096     {
00097         $group = $observer->getEvent()->getGroup();
00098         /* @var $group Mage_Core_Model_Store_Group */
00099         if ($group->dataHasChangedFor('root_category_id') || $group->dataHasChangedFor('website_id')) {
00100             Mage::app()->reinitStores();
00101             foreach ($group->getStores() as $store) {
00102                 Mage::getModel('catalog/url')->refreshRewrites($store->getId());
00103                 Mage::getResourceSingleton('catalog/category')->refreshProductIndex(
00104                     array(),
00105                     array(),
00106                     array($store->getId())
00107                 );
00108                 if (Mage::helper('catalog/category_flat')->isEnabled(true)) {
00109                     Mage::getResourceModel('catalog/category_flat')
00110                         ->synchronize(null, array($store->getId()));
00111                 }
00112             }
00113         }
00114         return $this;
00115     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:39 2009 for Magento by  doxygen 1.5.8