Can’t Save Custom Data to sales_order Table

ce-1.4.0.1databasesales

I'm running Mage 1.4.0.1.

With a mysql setup script, I have created a new column "asyncupload_validated" (tinyint(1) not null default 0) to the "sales_order" table.

I try to set this data to 1 and save it.

Here is my code, who doesn't work currently :

$order = Mage::getModel("sales/order")->load($_POST["order_id"]);
$order->setAsyncuploadValidated(1);
$order->save(); 
echo "<p>".$this->__("Your files are now validated.")."</p>";

The code is called (tested with some Mage::log) and the POST var is ok. It seems to be the save() param who is failing.

Best Answer

I would say in version 1.4 (UPDATE!!! REALLY!!!) orders where still eav, so to add a table you should use Mage_Sales_Model_Mysql4_Setup to addAttribute(). If you want it in the sales_order table, just use as type static.

If the attribute is added and the Zend_Db cache is renewed it should be saved.

Related Topic