I'm writing a script that will be run every hour to update a field of any product updated in the last hour. The script itself works, but it also updates the updated_at field upon saving the product.
After doing some research, I found that the best way to update the single field would be to use a direct sql statement to modify that single field.
So, I have the product id, the attribute id, and the new attribute value. The attribute uses a textarea as its input. I don't know which table to write the change to.
For example, if product_id is 1234 and attribute_id is 567, what would the sql statement look like? Something like this?
$val = "Some generated value."; $connection = Mage::getSingleton('core/resource')->getConnection('core_write'); $sql = 'UPDATE `<insert table name here>` SET `value` = ? WHERE `entity_id` = ? AND `attribute_id` = ?'; $connection->query($sql, array($val, 1234, 567));
Also, is there some kind of reference for this sort of thing that I can look at in the future?