1

我在 Magento 中为客户创建了一个自定义属性。

我不小心为我的属性设置了错误的类型。

现在我想修改此属性或删除此属性,然后创建新属性。

谁能告诉我是否可以删除或修改磁电机中的自定义属性?

提前致谢。

4

1 回答 1

11

您可以使用以下内容在其中一个模块中创建升级脚本:

$this->updateAttribute('customer', 'attribute_code_here', 'type', 'varchar'); //or any other type

基本上,您可以像这样更改客户、类别和产品的任何属性;

$entityType = 'customer';//or catalog_category or catalog_product
$attributeCode = 'attribute_code_here';
$changeWhat = 'field_name_here';
$changeInto = 'new value here';
$this->updateAttribute($entityType, $attributeCode, $changeWhat, $changeInto);

要删除属性,请运行以下命令:

$this->removeAttribute('customer', 'attribute_code_here');

它遵循与上述相同的规则。

于 2013-08-09T07:41:37.400 回答