【发布时间】:2014-03-28 05:41:11
【问题描述】:
我一直在尝试通过编程方式为后端的 magento 中的类别创建一个属性。所以,我按照http://www.hesselbom.net/magento-custom-attributes-with-selectbox 中的步骤操作,它运行良好,甚至我可以保存选定的值。然而,如果我尝试创建一个文本框属性,则不会保存这些值。谁能指导我如何做到这一点?
以下是我的代码。
$installer->addAttribute('catalog_category', 'custom_textfield', array(
'type' => 'varchar',
'label' => 'Custom field',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => TRUE,
'required' => FALSE,
'default' => ''
));
$attributeId = $installer->getAttributeId($entityTypeId, 'custom_textfield');
我也相应地更新了配置文件中的版本。
【问题讨论】: