从Magento中的销售/报价中删除自定义属性

时间:2014-05-21 08:54:18

标签: magento magento-1.7

我正在尝试删除Magento中的自定义属性,以下代码添加了我只需要使用Magento安装程序脚本删除的等效属性:

<?php
$installer = $this;
$installer->startSetup();

$installer->addAttribute("customer", "is_school",  array(
    "type"     => "int",
    "backend"  => "",
    "label"    => "is_school?",
    "input"    => "int",
    "source"   => "",
    "visible"  => false,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""
));

$installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'is_school', 'int(11)');
$installer->getConnection()->addColumn($installer->getTable('sales/order'), 'is_school', 'int(11)');

// need code to remove these two column above

$installer->endSetup();

1 个答案:

答案 0 :(得分:1)

Magento class ::方法是Mage_Eav_Model_Entity_Setup::removeAttribute()

因此,您的安装程序/更新脚本将包含以下内容:

$installer->removeAttribute("customer", "is_school");

希望有所帮助。