The following piece of code provided by SuperDicq Remove products from all categories when price is zero) gives me a HTTP 500 error, anyone knows what's wrong?
I changed the name of htaccess, put memory limit on 1024mb. I have other scripts which are causing no problems. Also when I add this one below they start giving errors as well.
require_once 'app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::app();
$products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter(
array(
array('attribute'=>'price', 'eq'=>'0'),
array('attribute'=>'price', 'isnull'=>true),
)
);
$category_id = 863; // "Old models" category ID.
foreach($products as $product) {
$product->setCategoryIds($category_id);
$product->save();
}