$productId = 123; //product id $productModel = Mage::getModel('catalog/product')->load($productId); //load product model echo $productModel->getName(); //get product name
$newProduct = Mage::getModel('catalog/product'); //create new product model object $newProduct->setName('New Product'); //set product name $newProduct->setPrice(99.99); //set product price $newProduct->save(); //save product objectIn this example, we are creating a new product model object using the Mage::getModel() method and passing the “catalog/product” as a parameter. After creating the object, we are setting its name and price using the setName() and setPrice() methods. Finally, we are saving the object to the database using the save() method. Package Library: Mage_Core_Model_Abstract belongs to the Mage_Core package library in Magento.