/** * Customer attribute validate before save * * @param Mage_Customer_Model_Attribute $model * @return void */ public function customerAttributeSaveBefore($model) { foreach (array_keys($model->getData()) as $key) { $isScopeKey = strpos($key, 'scope_') === 0; if (!$isScopeKey && $key != $model->getIdFieldName()) { $model->unsetData($key); } } $modelWebsiteId = $model->getWebsite() ? $model->getWebsite()->getId() : null; if (!$modelWebsiteId || !$this->_role->hasWebsiteAccess($modelWebsiteId, true)) { $this->_throwSave(); } }
/** * Return scope values for attribute and website * * @param Mage_Customer_Model_Attribute $object * @return array */ public function getScopeValues(Mage_Customer_Model_Attribute $object) { $select = $this->_getReadAdapter()->select()->from($this->getTable('customer/eav_attribute_website'))->where('attribute_id = ?', $object->getId())->where('website_id = ?', $object->getWebsite()->getId())->limit(1); $result = $this->_getReadAdapter()->fetchRow($select); if (!$result) { $result = array(); } return $result; }