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
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();
}
?>
-
-
Hi @Jigar_vala are you using an external file to make this fix or any inside files– Nihar SMay 8, 2017 at 18:04