I have the following installer script - when I try to run this I get the following Magento error:
Error in file: "/vagrant/site.com/public_html/app/code/local/SS/Raptor/sql/raptor_setup/install-0.0.1.php" - Wrong entity ID
My installer script is as follows:
$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();
Any ideas why this might be happening?
You are using the wrong setup class. You could use Mage_Customer_Model_Entity_Setup
to add the attributes this way. See this answer to use Mage_Eav_Model_Entity_Setup to add customer attributes.
Additional quote attributes require a different setup class. You can use Mage_Sales_Model_Resource_Setup
as model here.
Magento2 Fix:
You need to include your dependencies in your ModuleName/etc/module.xml file. I was adding a custom attribute for Products and had to include:
<sequence>
<module name="Magento_Catalog" />
</sequence>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With