Can't save custom data to “sales_order” table
-
16-10-2019 - |
Question
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.
Solution 2
Sorry for my late reply, i've been working on Magento upgrade. Now I'm running 1.6.2, the easiest version with our custom modules.
I've solved my problem by using the addAttribute method.
See documentation here : enter link description here
OTHER TIPS
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.