Return to Snippet

Revision: 39051
at January 12, 2011 21:52 by TheJasonParker


Initial Code
UPDATE catalog_product_entity_int cpei, catalog_product_entity cpe
SET cpei.value = "2"
WHERE cpe.entity_id = cpei.entity_id
AND cpe.sku LIKE '%SKU%'
AND cpei.attribute_id = 273

Initial URL
http://www.sonassi.com/knowledge-base/magento-knowledge-base/fast-bulk-product-status-change-with-magento/

Initial Description
You'll first need to find the attribute_id value for 'status' for your Magento installation and replace 273 in this example.

The easiest way to tell is if you go into:

Admin > Catalog > Attributes > Manage Attributes

Then in the “Attribute Code” box, enter “status” then press “Search”. Click the attribute result “status” – then look at the digits at the very end of the URL …

catalog_product_attribute/edit/attribute_id/XXX/

In the code below (to be run via command line MySQL or phpMyAdmin), just replace %SKU% with your SKU identifier and use % as a wildcard or _ as a single character wildcard.

This will obviously apply to any other attribute, so just change the code as necessary.

enabled = 1
disabled = 2

After the MySQL above has run – you’ll need to let Magento take the reigns back a little to update the category indexes, this is quite straightforward, but a little time consuming.

Remove this line to disable all...

AND cpe.sku LIKE '%SKU%'

Login to your admin and go to System > Cache Management, the select Rebuild Catalog Index

Initial Title
Disable products by sku

Initial Tags
magento

Initial Language
MySQL