How To Update Product Status (ENABLED/DISABLED) Programmatically In Magento?
Magneto Update Product Status (ENABLED/DISABLED) :- Sometimes we need to update product status programmatically in magento. In this blog we are going to study how to update product status enable and disable as per the discretion with programmatically syntax code and example.
Magento Set Product Status Enable Syntax:-
In the following code we have used product id and store id for enabling the respective product in Magento.
$productid=15;// product id which you want to change status; $storeid=1 // your store id 0 is for default store id Mage::getModel('catalog/product_status')->updateProductStatus($productid, $storeid, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
Magento Set Product Status Disable Syntax:-
Similarly in the scenario for disabling products we also have to use product ID and store ID respectively.
$productId = 16; $storeId = 1; Mage::getModel('catalog/product_status')->updateProductStatus($productId, $storeId, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);