Posted By

TheJasonParker on 01/12/11



Versions (?)

Disable products by sku

 / Published in: MySQL


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 …


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

  1. UPDATE catalog_product_entity_int cpei, catalog_product_entity cpe
  2. SET cpei.value = "2"
  3. WHERE cpe.entity_id = cpei.entity_id
  4. AND cpe.sku LIKE '%SKU%'
  5. AND cpei.attribute_id = 273

Report this snippet  


RSS Icon Subscribe to comments
Posted By: TheJasonParker on January 15, 2011

Don't really need this now as you can do it from the admin backend (v1.4.x)

You need to login to post a comment.