I want to add a column to the sales_flat_quote_item (and ..._order_item) table through an install script, but when I go to the table sales_flat_quote_item (or ..._order_item) in my database - the column is not there.

The install script's version is 0.0.1. My config.xml is also 0.0.1.

I have cleared the cache. I refreshed the back-end, so the script has ran.

Any clues?

$installer = $this;
$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), 'print_sku', "varchar NOT NULL");
$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'print_sku', "varchar NOT NULL");

1 Answer 1


In order to add column to sales_flat_quote_item you will have to write an upgrade script for that follow below steps.

  1. Create a module or use your existing custom module.
  2. Modify your config.xml to add a setup resource with class Mage_Sales_Model_Resource_Setup:

  3. Create a directory data/your_module_setup in your module

  4. Create a data-install or data-upgrade script containing the following code:

    $installer = $this;
        'quote_item',  /* order, quote, order_item, quote_item */
            'type' => 'varchar', /* int, varchar, text, decimal, datetime */
            'nullable' => false, /* default true */
            'grid' => false, /* or true if you wan't use this attribute on orders grid page */
  • I used my code for the script, but you gave me the idea to add the code in my config.xml. I didn't know I have to do that also. Thanks.
    – Syspect
    Commented Jan 10, 2014 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.