/** * After Save Attribute manipulation * * @param Mage_Catalog_Model_Abstract $object * @return $this */ public function afterSave($object) { // var_dump($object);exit; $hasChanges = $object->dataHasChangedFor($this->getAttribute()->getName()); if (!$hasChanges) { return $this; } $data = $object->getData($this->getAttribute()->getName()); return $this; }
/** * Check unique url_key value in catalog_category_entity_url_key table. * * @param Mage_Catalog_Model_Abstract $object * @return bool * @throws Mage_Core_Exception */ protected function _isAvailableUrl($object) { $select = $this->_connection->select()->from($this->getAttribute()->getBackendTable(), array('entity_id', 'store_id'))->where('value = ?', $object->getUrlKey())->limit(1); $row = $this->_connection->fetchRow($select); // we should allow save same url key for product in current store view // but not allow save existing url key in current store view from another store view if (empty($row)) { return true; } elseif ($object->hasData('url_key') && !$object->dataHasChangedFor('url_key')) { return true; } elseif ($object->getId() && $object->getStoreId() !== null && ($row['store_id'] == $object->getStoreId() && $row['entity_id'] == $object->getId())) { return true; } return false; }