sj_magento
sj_magento

Reputation: 121

I couldn't save price for product in Magento

 $p = Mage::getModel("catalog/product");
       $p->setData("sku","real val sku111");
       $p->setData("name","real val name");
       $p->setData("price",21);
       $p->setData("custom_attr","real val");
       $p->save();

I couldn't save price with that code. It saves all other attribute value but when I check in admin panel, price column is always empty. I couldn't find out why. Could you help me?

Upvotes: 3

Views: 911

Answers (1)

Thomas Lang
Thomas Lang

Reputation: 501

Try this:

$product = Mage::getModel('catalog/product');
$product->setSku('testsku61')
    ->setName('test product21') 
   ->setPrice(21);
$product->save();

Upvotes: 1

Related Questions