Ejemplo n.º 1
0
 protected function _beforeSave(Varien_Object $customer)
 {
     try {
         parent::_beforeSave($customer);
     } catch (Mage_Eav_Model_Entity_Attribute_Exception $e) {
         if ($e->getAttributeCode() == 'mobile') {
             $exception = new Mage_Core_Exception($e->getMessage(), UrbanSurprises_Customer_Model_Customer::EXCEPTION_MOBILE_EXISTS);
             throw $exception;
         }
     }
 }
Ejemplo n.º 2
0
 protected function _beforeSave(Varien_Object $customer)
 {
     parent::_beforeSave($customer);
     if ($customer->getUsername()) {
         $select = $this->_getWriteAdapter()->select()->from($this->getEntityTable(), array($this->getEntityIdField()))->where('username=?', $customer->getUsername());
         if ($customer->getId()) {
             $select->where('entity_id !=?', $customer->getId());
         }
         if ($this->_getWriteAdapter()->fetchOne($select)) {
             Mage::throwException(Mage::helper('udsell')->__('This customer username already exists.'));
         }
     }
     return $this;
 }