/** * Remove entity attribute. Overwritten for flat entities support * * @param mixed $entityTypeId * @param mixed $code * * @return $this|Mage_Eav_Model_Entity_Setup */ public function removeAttribute($entityTypeId, $code) { if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) { $this->_removeFlatAttribute($this->_flatEntityTables[$entityTypeId], $code); $this->_removeGridAttribute($this->_flatEntityTables[$entityTypeId], $code, $entityTypeId); } else { parent::removeAttribute($entityTypeId, $code); } return $this; }
//字高 $a_zigao = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '字高(mm)', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('10', ''), 'o2' => array('12', '')))); //格式 $a_geshi = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '语言格式', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('中文', ''), 'o2' => array('英文', '')))); //位数 $a_weishu = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '位数', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('10', ''), 'o2' => array('12', '')))); //用途 $a_yongtu = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '用途', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('10', ''), 'o2' => array('12', '')))); //包装 $a_baozhuang = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '包装', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('15ML', ''), 'o2' => array('28ML', ''), 'o3' => array('55ML', ''), 'o4' => array('500ML', ''), 'o5' => array('1000ML', '')))); //颜色 $a_yanse = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '颜色', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('红', ''), 'o2' => array('绿', ''), 'o3' => array('蓝', ''), 'o4' => array('紫', ''), 'o5' => array('黑', ''), 'o6' => array('其它', '')))); //材质 $a_caizhi = array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => '材质', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_table', 'default' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'visible_in_advanced_search' => 1, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'used_in_product_listing' => 1, 'unique' => 0, 'apply_to' => '', 'is_configurable' => 0, 'option' => array('value' => array('o1' => array('钢', ''), 'o2' => array('木', ''), 'o3' => array('胶', '')))); //先清理可能存在的属性 $installer->removeAttribute('catalog_product', 'a_xinghao'); $installer->removeAttribute('catalog_product', 'a_xingzhuang'); $installer->removeAttribute('catalog_product', 'a_guige'); $installer->removeAttribute('catalog_product', 'a_chang'); $installer->removeAttribute('catalog_product', 'a_kuan'); $installer->removeAttribute('catalog_product', 'a_riqi'); $installer->removeAttribute('catalog_product', 'a_leixing'); $installer->removeAttribute('catalog_product', 'a_zigao'); $installer->removeAttribute('catalog_product', 'a_geshi'); $installer->removeAttribute('catalog_product', 'a_weishu'); $installer->removeAttribute('catalog_product', 'a_yongtu'); $installer->removeAttribute('catalog_product', 'a_baozhuang'); $installer->removeAttribute('catalog_product', 'a_yanse'); $installer->removeAttribute('catalog_product', 'a_caizhi'); //end 清理属性 //生成属性