Andreas
Andreas

Reputation: 73

Edit row in phpMyAdmin not saving. Magento cant setData

Currently i'am developing a module that saves additional data to a order in Magento. I have the module working on my local copy of Magento. My problem is that when i uploaded my module to the actual "live" version of the site the module stops working.

It is unable to save the data to the custom attribute in sales_flat_order. I'am also unable to manually edit the order in phpMyAdmin. It refuses to save the changes. The store itself can still create orders and works like it should except the custom attribute.

This is the code i use for saving data:

$_order->setData('myAttribute', $_comments)->getResource()->saveAttribute($_order, 'myAttribute');

The server uses Apache and Apc.

Any suggestions?

Upvotes: 0

Views: 514

Answers (1)

Andreas
Andreas

Reputation: 73

The problem with phpMyAdmin seems to be a bug when using the edit button for a specific row. It wants to update wrong attribute.

For magento it turns out that i had to save in a different way on the live server so instead of:

$_order->setData('myAttribute', $_comments)->getResource()->saveAttribute($_order, 'myAttribute');

I had to use:

$_order->setData('myAttribute', $_comments)->save();

Upvotes: 1

Related Questions