chris2006 Posted February 5, 2008 Posted February 5, 2008 Hey, Does anyone know of a way to change the status of a product on a mass scale? I have tons of products to set to inactive and its a bit of hassle! Any help would be great Chris
krnl Posted February 5, 2008 Posted February 5, 2008 the only way that I have really found is to get all of the products_model numbers and put them in a text file, then loop through the text file and query the database accordingly for each. #!/bin/bash INFILE="products_to_inactivate.txt" cat $INFILE | while read PRODUCTS_MODEL; do { mysql -uusername -ppassword database_name -e "update products set products_status = '0' where products_model = '$PRODUCTS_MODEL'" } done Something along those lines should work, I think. Do some debug and backup your database before you try any of it. To debug, I would suggest creating a small text file with two products in it and running that through the script. Verify that the statuses of those two products change as you would expect (0 or 1). If it works, then you should be in good shape. Good luck!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.