$customer = Mage::getModel('customer/customer'); $customer->setData('firstname', 'John'); $customer->setData('lastname', 'Doe'); if ($customer->isObjectNew()) { // Object is new, has not been saved to the database yet } else { // Object already exists in the database }
$product = Mage::getModel('catalog/product'); $product->setData('name', 'My product'); $product->setData('sku', 'my-sku'); if ($product->isObjectNew()) { $product->save(); }The Mage_Core_Model_Abstract class is part of the Magento Core package library.