Question

I have a custom model linked to a custom table. In that table, the column sku is unique. I'd like the following code to always update on duplicate:

Mage::getModel('company/product_log')
  ->setData('sku', 'abc123')
  ->setData('error', 'Invalid price.')
  ->save();

I'd like to do this from within the model itself instead of having to repeat update-vs-insert logic everywhere I want to use this table.

What is the best way to do this, or an existing example already in Magento?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top