Actually Mage_Catalog_Model_Category
does possess the event _beforeSave()
. In order to see that, you need to look on that class with wide eyes :)
Mage_Catalog_Model_Category
directly does not define _beforeSave
. However you can see that, this class inherits from another class Mage_Catalog_Model_Abstract
and it does possess _beforeSave
. It looks like this
protected function _beforeSave()
{
$this->unlockAttributes();
return parent::_beforeSave();
}
You can see that, this class again call its parent class. That parent class is nothing but Mage_Core_Model_Abstract
. There you can see that _beforeSave
defined like this.
protected function _beforeSave()
{
if (!$this->getId()) {
$this->isObjectNew(true);
}
Mage::dispatchEvent('model_save_before', array('object'=>$this));
Mage::dispatchEvent($this->_eventPrefix.'_save_before', $this->_getEventData());
return $this;
}
This function dispatches two events. Second one is important here. You can see that, it uses an event prefix
in that event. Now take a look on Mage_Catalog_Model_Category
. You can see that, it actually defines an event prefix there.
protected $_eventPrefix = 'catalog_category';
This means, whenever category section is trying to save, _beforeSave
method generates a unique event with name catalog_category_save_before
. I think , you can use that event to save any category attribute
Hope that helps
catalog_category_save_before
?