product enable/disable by coding in Magento

In this article we talk about that how to product enable and disable through coding.
Below given code follow the code....

<?php
$proid=100;// 100 is product id
$storeid=0; // 0 is your store id 0(this is default store id)
Mage::getModel('catalog/product_status')->updateProductStatus($proid, $storeid, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
?>

"Mage_Catalog_Model_Product_Status::STATUS_DISABLED" it is use for disable if any product do enable then only small change:-- "Mage_Catalog_Model_Product_Status::STATUS_ENABLED"

Labels: