I trying to create product programmatically, but it not showing at category page (at "frontend"). I use next code (yes, bad code, but it is one-time task)
$product = new Mage_Catalog_Model_Product();
...
$product->getResource()->save($product);
$product_id = $product->getId();
foreach (array($default_cat, $category_id) as $cat_id) {
Mage::getSingleton('catalog/category_api')->assignProduct($cat_id,$product_id);
}
It succesfully create product, but when I open category page - it doesn't contain product. When I open product edit page and click "save" - product also added to category page...
What I can do?
UPD. Cache clearing and rendexing doesn't help... And, when I open product edit page - categories list are correct
UPD2. Reason was in qty/stock.
add_product
function – user2726251