本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute::_beforeSave方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute::_beforeSave方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute::_beforeSave怎么用?PHP Mage_Eav_Model_Entity_Attribute::_beforeSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute::_beforeSave方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeSave
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();
}
示例2: _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();
}
示例3: _beforeSave
/**
* 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();
}
示例4: _beforeSave
/**
* Processing object before save data
*
* @return Mage_Core_Model_Abstract
*/
protected function _beforeSave()
{
$this->setData('modulePrefix', self::MODULE_NAME);
return parent::_beforeSave();
}
示例5: _beforeSave
/**
* 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();
}