1

I know that manufacturer(s) can be removed, but what I would like to do is temporarily disable specific manufacturer(s) in my database so that the products associated with them are not visible in the front end.

How can this be achieved?

2 Answers 2

1

Put this script in your root directory and run it. Change the manufacturer name and Change the status when you want to revert them.

require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();

$_products = Mage::getResourceModel('catalog/product_collection'); 
$_products->addAttributeToFilter('manufacturer', array(
   'in' => 'YOUR_MFG',
    ));
$storeid = 0; // your store id 0 is the default id


foreach($_products as $_product){
     //change STATUS_DISABLED to STATUS_ENABLED to turn them back on
    Mage::getModel('catalog/product_status')->updateProductStatus($_product->getId(), $storeid, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
}
1
  • I really like this approach! I will test it on my dev server and report back. Thank you, SR
    – SR_Magento
    Commented Jan 30, 2014 at 12:52
0

I have two ways in mind:

Use manufacturer to disable the products

You can write your own module, which filters the products by manufacturer, disables them and saves them again.

Observer catalog_product_load_after and catalog_product_load_before

  1. Observe the two events, in the catalog_product_load_after observer you unset the ID if the manufacturer is the wrong one
  2. In catalog_product_collection_load_before you add a filter for the manufacturer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.