Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[SOLVED]How to change product status to disable programmatically? 
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

I have this:

$product->addAttributeUpdate('status'20);

and I can see that the Status is set to Disabled in the backend.  However, the product is still listed with out of stock being displayed in the category page. And when I click on it, it returns a 404.

When I click Save in the backend, the product disappears in the category page, which is what I want. I couldn’t figure out why it’s listed in the category page when the status is set to disable programmatically. Anyone has any idea?

Solution:

Mage::getModel('catalog/product_status')->updateProductStatus($product->getId(), $storeIdMage_Catalog_Model_Product_Status::STATUS_DISABLED);
 
Magento Community Magento Community
Magento Community
Magento Community
 
webpagemaster
Jr. Member
 
Total Posts:  18
Joined:  2010-05-12
 

What file to edit?

nevermind, my fix was to refresh cache and catalogs

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top