Disable products by sku


/ Published in: MySQL
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.