Always update on duplicate when using save() in custom model
-
31-10-2019 - |
Frage
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?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange