/** * Validate catalog event save * * @param Enterprise_CatalogEvent_Model_Event $model */ public function catalogEventSaveBefore($model) { $category = Mage::getModel('catalog/category')->load($model->getCategoryId()); if (!$category->getId()) { $this->_throwSave(); } // save event only for exclusive categories $rootFound = false; foreach ($this->_role->getAllowedRootCategories() as $rootPath) { if ($category->getPath() === $rootPath || 0 === strpos($category->getPath(), "{$rootPath}/")) { $rootFound = true; break; } } if (!$rootFound) { $this->_throwSave(); } // in non-exclusive mode allow to change the image only if ($model->getId()) { if (!$this->_role->hasExclusiveCategoryAccess($category->getPath())) { foreach (array_keys($model->getData()) as $key) { if ($model->dataHasChangedFor($key) && $key !== 'image') { $model->setData($key, $model->getOrigData($key)); } } } } }