/** * Save category before * * @param Varien_Event_Observer $observer * @return Mage_CatalogIndex_Model_Observer */ public function catalogCategorySaveBefore(Varien_Event_Observer $observer) { $category = $observer->getEvent()->getCategory(); if ($category && $category->getId()) { $products = $category->getProductCollection(); Mage::getModel('searchanise/queue')->addActionProducts($products); // save current products ids // need for find new products in catalogCategorySaveAfter if (!empty($products)) { self::$productIdsInCategory = array(); foreach ($products as $product) { if ($product->getId()) { self::$productIdsInCategory[] = $product->getId(); } } } } return $this; }
/** * Save page after * * @param Varien_Event_Observer $observer * @return Mage_CmsIndex_Model_Observer */ public function cmsPageSaveAfter(Varien_Event_Observer $observer) { $page = $observer->getEvent()->getObject(); if ($page && $page->getId()) { if (!self::$isExistsPage) { // if page was created now Mage::getModel('searchanise/queue')->addActionPage($page); } } self::$isExistsPage = false; return $this; }