protected function _beforeSave()
 {
     if ($this->getFrontendInput() == "image") {
         $this->setBackendModel('catalog/category_attribute_backend_image');
         $this->setBackendType('varchar');
     }
     if ($this->getFrontendInput() == "date") {
         $this->setBackendModel('eav/entity_attribute_backend_datetime');
         $this->setBackendType('datetime');
     }
     if ($this->getFrontendInput() == "textarea") {
         $this->setBackendType('text');
     }
     if ($this->getFrontendInput() == "text") {
         $this->setBackendType('varchar');
     }
     if ($this->getFrontendInput() == "multiselect" || $this->getFrontendInput() == "select") {
         $this->setData('source_model', 'eav/entity_attribute_source_table');
         $this->setBackendType('varchar');
     }
     if ($this->getFrontendInput() == "boolean") {
         $this->setFrontendInput("select");
         $this->setBackendType('int');
         $this->setData('source_model', 'eav/entity_attribute_source_boolean');
     }
     return parent::_beforeSave();
 }
 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     $this->setData('modulePrefix', self::MODULE_NAME);
     if (isset($this->_origData['is_global'])) {
         if (!isset($this->_data['is_global'])) {
             Mage::throwException('0_o');
         }
         if ($this->_data['is_global'] != $this->_origData['is_global'] && $this->_getResource()->isUsedBySuperProducts($this)) {
             Mage::throwException(Mage::helper('eav')->__('Scope must not be changed, because the attribute is used in configurable products.'));
         }
     }
     if ($this->getFrontendInput() == 'price') {
         if (!$this->getBackendModel()) {
             $this->setBackendModel('catalog/product_attribute_backend_price');
         }
     }
     return parent::_beforeSave();
 }
Example #3
0
 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     if ($this->_getResource()->isUsedBySuperProducts($this)) {
         throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('This attribute is used in configurable products'));
     }
     $this->setData('modulePrefix', self::MODULE_NAME);
     return parent::_beforeSave();
 }
Example #4
0
 /**
  * Processing object before save data
  *
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     $this->setData('modulePrefix', self::MODULE_NAME);
     return parent::_beforeSave();
 }
Example #5
0
 /**
  * Processing object before save data
  *
  * @throws Mage_Core_Exception
  * @return Mage_Core_Model_Abstract
  */
 protected function _beforeSave()
 {
     $this->setData('modulePrefix', self::MODULE_NAME);
     if (isset($this->_origData['is_global'])) {
         if (!isset($this->_data['is_global'])) {
             $this->_data['is_global'] = self::SCOPE_GLOBAL;
         }
         if ($this->_data['is_global'] != $this->_origData['is_global'] && $this->_getResource()->isUsedBySuperProducts($this)) {
             Mage::throwException(Mage::helper('blog')->__('Scope must not be changed, because the attribute is used in configurable products.'));
         }
     }
     if ($this->getFrontendInput() == 'textarea') {
         if ($this->getIsWysiwygEnabled()) {
             $this->setIsHtmlAllowedOnFront(1);
         }
     }
     return parent::_beforeSave();
 }