If I add these columns:
$installer->run("ALTER TABLE sales_flat_order_item add COLUMN shipping_status_id int");
$installer->run("ALTER TABLE sales_flat_quote_item add COLUMN shipping_status_id int");
And run this test 2 times:
$o = Mage::getModel('sales/order_item');
$o->load(92);
print $o->getShippingStatusId() . "\n";
$o->setShippingStatusId(123);
$o->save();
I see nothing.
If I drop the columns and add:
$installer->run("ALTER TABLE sales_flat_order_item add COLUMN shipping_status int");
$installer->run("ALTER TABLE sales_flat_quote_item add COLUMN shipping_status int");
And run this test 2 times:
$o = Mage::getModel('sales/order_item');
$o->load(92);
print $o->getShippingStatus() . "\n";
$o->setShippingStatus(123);
$o->save();
Then it works, value is saved and I can get it back.
The difference is _id in the column. Why does this not work in the 1st example? Is there something special about it? I checked it a couple of times.
Did another test, added both columns:
$installer->run("ALTER TABLE sales_flat_order_item add COLUMN shipping_status_id int");
$installer->run("ALTER TABLE sales_flat_order_item add COLUMN shipping_status int");
$installer->run("ALTER TABLE sales_flat_quote_item add COLUMN shipping_status_id int");
$installer->run("ALTER TABLE sales_flat_quote_item add COLUMN shipping_status int");
Test:
$o = Mage::getModel('sales/order_item');
$o->load(92);
print $o->getItemId() . "/" . $o->getShippingStatusId() . "\n";
print $o->getItemId() . "/" . $o->getShippingStatus() . "\n";
$o->setShippingStatusId(123);
$o->setShippingStatus(456);
$o->save();
Only 456 value is set and get.
/var/cache is deleted.
You need to delete Magento cache physically (/var/cache/) after columns adding. Zend caches your table structure, so it needed to be refreshed after update.
Also, try to use
Try to use debugger to understand problem better.
Also you may do
and check if ‘shipping_status_id’ exist in data