如何在Magento中重命名属性代码?

Rud*_*lah 15 attributes magento entity-attribute-value magento-1.4

我想将现有属性的代码重命名为其他内容.原因是因为300个产品填写了属性字段,我不想因为我更改了属性的代码而不得不重新导入所有这些产品.

Jon*_*Day 29

你可以在mysql中编辑它eav_attribute.attribute_code.请务必事先进行备份,然后再重新编制索引System>Index Management.


Jan*_* Wy 29

使用具有以下内容的升级脚本要容易得多:

$installer = $this;
$installer->startSetup();
$installer->updateAttribute('catalog_product', 'old_attribute_code', array('attribute_code' => 'new_attribute_code'));
$installer->endSetup();
Run Code Online (Sandbox Code Playgroud)