Last active
September 13, 2016 19:37
-
-
Save renorram/0802a21885b5b8f795d00e1b7fbb7144 to your computer and use it in GitHub Desktop.
Magento delete categories progamatically
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 | |
public function deleteAction(){ | |
// not a good practice | |
Mage::register("isSecureArea", 1); | |
//load all categories | |
$categories = Mage::getModel('catalog/category') | |
->getCollection() | |
->addAttributeToSelect('*') | |
->addIsActiveFilter(); | |
foreach($categories as $category){ | |
if($category->getName() == 'Cal'){ | |
$category->delete(); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment