Created
March 16, 2015 00:49
-
-
Save weblance2/f6e5efbe45beb275366c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
// Load Up Magento Core | |
define('MAGENTO', realpath('/path/to/magento')); | |
require_once(MAGENTO . 'app/Mage.php'); | |
$app = Mage::app(); | |
$categories = Mage::getModel('catalog/category') | |
->getCollection() | |
->addAttributeToSelect('*') | |
->addAttributeToFilter('is_anchor', 1) | |
->addAttributeToFilter('entity_id', array("gt" => 1)) | |
->setOrder('entity_id') | |
; | |
foreach($categories as $category) { | |
echo $category->getId() . "\t" . $category->getName() . "\n"; | |
$category->setIsAnchor(0); | |
$category->save(); | |
} | |
print "If your seeing this there were no errors."; | |
} | |
catch (Exception $e) { | |
print "OOOPS! " . $e->getMessage() . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment