Hi i hope someone can help me. Ive created a automatic product importer script, and it works adding the products and categories programatically. The only issue I'm having is it isn't setting the stock , when you go into the Backend of the CMS the products are listed with manage stock = no and so its not setting a quantity. Im using magento 1.9.0.1
Can someone point out what I'm missing here please, this is the code i have...
$newProduct->setAttributeSetId(4)
->setTypeId('simple')
->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
->setTaxClassId(2)
->setCreatedAt(strtotime('now'))
->setName($product["ItemTitle"])
->setEannumber($product["EANNumber"])
->setWeight($product["Weight"])
->setStatus(1)
->setPrice($product["Price"])
->setCategoryIds($CategoryIDs)
->setWebsiteIds(array(1))
->setSku($product["ItemCode"])
->setDistributor('entatech')
->setDescription($productDescription2)
->setShortDescription($productDescriptionone)
->setMetaTitle($product["ItemTitle"])
->setMetaKeyword($prodKeywords)
->setMetaDescription($product["description2"]);
$newProduct->setCreatedAt(strtotime('now'));
$newProduct->setStockData(array(
'use_config_manage_stock' => 1,
'is_in_stock' => 1,
'qty' => $product["Stock"],
'manage_stock' => 1,
'use_config_notify_stock_qty' => 0
));
$newProduct->getResource()->save($newProduct);