*/ class Mage_Rating_Model_Observer { /** * Cleanup product ratings after product delete * * @param Varien_Event_Observer $observer * @return Mage_CatalogIndex_Model_Observer */ public function processProductAfterDeleteEvent(Varien_Event_Observer $observer) { $eventProduct = $observer->getEvent()->getProduct(); if ($eventProduct && $eventProduct->getId()) { Mage::getResourceSingleton('rating/rating')->deleteAggregatedRatingsByProductId($eventProduct->getId()); } return $this; } }