Ejemplo n.º 1
0
 /**
  * Validate SKU
  *
  * @param Mage_Catalog_Model_Product $object
  * @throws Mage_Core_Exception
  * @return bool
  */
 public function validate($object)
 {
     $helper = Mage::helper('core/string');
     if ($helper->strlen($object->getSku()) > self::SKU_MAX_LENGTH) {
         Mage::throwException(Mage::helper('catalog')->__('SKU length should be %s characters maximum.', self::SKU_MAX_LENGTH));
     }
     return parent::validate($object);
 }
Ejemplo n.º 2
0
 public function validate($object)
 {
     if ($password = $object->getPassword()) {
         if ($password == $object->getPasswordConfirm()) {
             return true;
         }
     }
     return parent::validate($object);
 }
Ejemplo n.º 3
0
 /**
  * Implode data for validation
  *
  * @param Mage_Catalog_Model_Product $object
  * @return bool
  */
 public function validate($object)
 {
     $attributeCode = $this->getAttribute()->getAttributeCode();
     $data = $object->getData($attributeCode);
     if (is_array($data)) {
         $object->setData($attributeCode, implode(',', array_filter($data)));
     }
     return parent::validate($object);
 }
 /**
  * Validate object
  *
  * @param  Varien_Object      $object
  * @throws Mage_Eav_Exception
  * @return boolean
  */
 public function validate($object)
 {
     $pattern = '#^(\\d+)?\\-\\d+;(\\d+\\-\\d+;)*\\d+\\-(\\d+)?$#';
     $value = $object->getFilterPriceRanges();
     if ('' != $value && !preg_match($pattern, $value)) {
         $message = "Provided Layered Navigation Price Ranges are incorrect.";
         $message = Mage::helper('aurmil_customizepricefilter')->__($message);
         Mage::throwException($message);
     }
     return parent::validate($object);
 }
 /**
  * Validate process
  *
  * @param Varien_Object $object
  * @return bool
  */
 public function validate($object)
 {
     if (!parent::validate($object)) {
         return false;
     }
     $attributeCode = $this->getAttribute()->getName();
     if ($attributeCode == 'default_sort_by') {
         if ($available = $object->getData('available_sort_by')) {
             if (!is_array($available)) {
                 $available = explode(',', $available);
             }
             if (!in_array($object->getData($attributeCode), $available)) {
                 Mage::throwException(Mage::helper('eav')->__('Default Product Listing Sort by not exists on Available Product Listing Sort by'));
             }
         }
     }
     return true;
 }