How to delete all category in magento

Instruction :- Copy and save this code file in root folder of Magento and run it; exp :- http://yoursite/deletecat.php
<?php 
error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
ini_set('max_execution_time', 1800);
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
foreach(Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('entity_id', array('gt' => 2)) as $cat) {
$cat->delete();
}
?>

No comments:

Post a Comment