0

How to isAnchor is yes using layout xml file.option is available yes in admin but i have 200+ category so it is possible xml file.

1 Answer 1

0

You can do it with an external php file in root....

 <?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();

        }

?>
2
  • not working this solution Please read once again my question.
    – Jigar
    Apr 25, 2017 at 13:49
  • Hi @Jigar_vala are you using an external file to make this fix or any inside files
    – Nihar S
    May 8, 2017 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.