By default any categories that are created through the Magento Admin default the following "Is Anchor" setting to "No"


There is no method for bulk changing this setting from within the Magento Admin and if you have a LOT of categories this could be a very time consuming task to change every category one at a time and there is a good chance that you would miss one.



Create a new php file called: setanchor.php

Upload this file to the root directory of your website: html/setanchor.php

Then put the following into your internet explorer address bar: http://www.domainname.com/setanchor.php

This PHP script will set EVERY category in Magento to "Is Anchor = Yes"

<?php 
error_reporting(E_ALL);
ini_set('display_errors', '1');
 
// Load Up Magento Core
define('MAGENTO', realpath(''));

require_once(MAGENTO . '/app/Mage.php');
 
$app = Mage::app();
 
$categories = Mage::getModel('catalog/category')
 ->getCollection()
 ->addAttributeToSelect('*')
 ->addAttributeToFilter('is_anchor', 0)
 ->addAttributeToFilter('entity_id', array("gt" => 1))
 ->setOrder('entity_id')
 ;
 
foreach($categories as $category) {
 echo $category->getId() . "\t" . $category->getName() . "\n";
 $category->setIsAnchor(1);
 $category->save();
}
?>