Ejemplo n.º 1
0
 /**
  * additional validation for unique brands
  *
  * @override
  * @throws Mage_Core_Exception if the brands are not unique -> validation failed
  * @return Netresearch_Ops_Model_System_Config_Backend_Intersolve_Brands
  */
 public function save()
 {
     $brands = $this->getValue();
     if (is_array($brands) && sizeof($brands) > 1) {
         $alreadyProcessedBrands = array();
         foreach ($brands as $brand) {
             if (is_array($brand) && array_key_exists('brand', $brand)) {
                 if (in_array($brand['brand'], $alreadyProcessedBrands)) {
                     Mage::throwException("Brands must be unique");
                 }
                 $alreadyProcessedBrands[] = $brand['brand'];
             }
         }
     }
     return parent::save();
 }