magento - 安装程序脚本给我 'Wrong Entity ID' Magento 错误

标签 magento magento-1.7

我有以下安装程序脚本 - 当我尝试运行它时,出现以下 Magento 错误:

Error in file: "/vagrant/site.com/public_html/app/code/local/SS/Raptor/sql/raptor_setup/install-0.0.1.php" - Wrong entity ID

我的安装程序脚本如下:
$installer = new Mage_Eav_Model_Entity_Setup();
$installer->startSetup();

$installer->addAttribute('customer', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->addAttribute('quote', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->addAttribute('order', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->endSetup();

任何想法为什么会发生这种情况?

最佳答案

您使用了错误的安装程序类。您可以使用 Mage_Customer_Model_Entity_Setup以这种方式添加属性。看到这个对 use Mage_Eav_Model_Entity_Setup to add customer attributes 的回答.

其他报价属性需要不同的设置类。您可以使用 Mage_Sales_Model_Resource_Setup作为这里的模型。

关于magento - 安装程序脚本给我 'Wrong Entity ID' Magento 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23633544/

相关文章:

url - magento 如何解析 url?

Magento导入产品错误

使用优惠券代码进行 Magento 税收计算

java - 不同格式的 Axis SOAP 响应是否相同?

magento - 如何在登录后重定向到特定页面,该页面取决于在magento中单击登录的页面?

magento - 单击下拉选项在管理面板中创建网格 magento 1.7.0.2

magento - 对 view.pthml 中的非对象调用成员函数 getItemsCount()

mysql - Magento "General error: 1005 Can' t 创建表"

magento - wamp tmp文件夹在本地运行magento时占用一些GB空间

magento - 如何检查具有给定增量 id 的订单是否已存在于 magento 中?