php - Creating a new product in magento -
i started magento development , starting hang of it. found examples on how create new product , code:
$p2 = mage::getmodel('catalog/product'); $p2->setsku('art002'); $p2->setattributesetid(2); $p2->setprice(20); $p2->save();
is supposed that. however, when running code, takes forever (cpu usage peaks 100%) , never finishes.
i had same issue updating product, got working this:
mage::getsingleton('catalog/product_action') ->updateattributes(array($product->getid()), array('price'=>10), 1);
but fail see how use create new product.
(background: trying create interface module wms, need able upload/update products, update stock.)
i repeated code on test machine, couldn't reproduce problem. think need change index mode 'update on save' 'update when scheduled', in admin >> system >> advanced >> index management
Comments
Post a Comment