Skip to main content
added 10 characters in body
Source Link
Myron
  • 337
  • 1
  • 15

This basically means that the script stops running from that point on.

Note: this should only be used at the end of the script.

What happends is: Your setupscript is ended before you added the second table.

Note: this should only be used at the end of the script.

What happends is: Your setupscript is ended before you added the second table.

This basically means that the script stops running from that point on.

Note: this should only be used at the end of the script.

Source Link
Myron
  • 337
  • 1
  • 15

In your installscript you have used halfway through the code:

$this->endSetup();

Note: this should only be used at the end of the script.

What happends is: Your setupscript is ended before you added the second table.

try this: (have not tested this code but i think it should work like this)

<?php

$installer = $this;

$installer->startSetup();
$installer->addAttribute('catalog_product', 'pre_order', array(
    'group' => 'General',
    'type' => 'int', // can be int, varchar, decimal, text, datetime
    'backend' => '', // If you're making an image attribute you'll need to add : catalog/category_attribute_backend_image
    'frontend_input' => '',
    'frontend' => '',
    'label' => 'Is Pre Order',
    'input' => 'boolean', //text, textarea, select, file, image, multiselect
    'class' => '',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, // Scope can be SCOPE_STORE, SCOPE_GLOBAL or SCOPE_WEBSITE
    'visible' => true,
    'frontend_class' => '',
    'required' => false, // or true
    'user_defined' => true, // or false
    'used_in_product_listing' => '1',
    'default' => '',
    'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
));
$installer->addAttribute('catalog_product', 'pre_order_note', array(
    'group' => 'General',
    'type' => 'varchar', // can be int, varchar, decimal, text, datetime
    'backend' => '', // If you're making an image attribute you'll need to add : catalog/category_attribute_backend_image
    'frontend_input' => '',
    'frontend' => '',
    'label' => 'Pre Order Note',
    'input' => 'text', //text, textarea, select, file, image, multiselect
    'class' => '',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, // Scope can be SCOPE_STORE, SCOPE_GLOBAL or SCOPE_WEBSITE
    'visible' => true,
    'frontend_class' => '',
    'required' => false, // or true
    'user_defined' => true, // or false
    'used_in_product_listing' => '1',
    'default' => '',
    'apply_to' => 'simple,configurable,virtual,bundle,downloadable',
));

/**
* Add 'custom_attribute' attribute for entities
*/
$entities = array(
    'quote',
    'quote_item',
    'order',
    'order_item'
);
$entitiesnew = array(
    'quote_item',
    'order_item'
);
$options = array(
    'type'     => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
    'visible'  => true,
    'required' => false,
    'default' => 0
);
$options2 = array(
    'type'     => Varien_Db_Ddl_Table::TYPE_VARCHAR,
    'visible'  => true,
    'required' => false
);
foreach ($entities as $entity) {
    $installer->addAttribute($entity, 'pre_order', $options);   
}
foreach ($entitiesnew as $entitynew) {
    $installer->addAttribute($entitynew, 'pre_order_note', $options2);
}
$installer->endSetup();
?>