1

I have followed this question for adding a custom attribute to Magento orders.

I want to set the value of this attribute programmatically but its not saving to the database. My code:

$_order = Mage::getModel('sales/order');
$_order->loadByIncrementId(100000001);
$_order->setMyCustomField('Testing');
$_order->save();

I have also tried:

$_order->setData('my_custom_field','Testing');

I have checked that the field exists in the sales_flat_order table .

Community
  • 1
  • 1
Tekhoi
  • 127
  • 2
  • 8

1 Answers1

-1

I have now resolved this issue. I'm using XAMPP and found I needed to both restart Apache and use the "Flush Cache Storage" option in Magento.

Following this the value is saving correctly.

Tekhoi
  • 127
  • 2
  • 8