Last active
August 4, 2016 00:43
-
-
Save tuanphpvn/6b70fb856f05b7148d42 to your computer and use it in GitHub Desktop.
Delete all product belong to category
This file contains hidden or 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 | |
$deleteAllProduct = function() { | |
$products = Mage::getModel('catalog/product')->getCollection(); | |
foreach ($products as $product) { | |
try { | |
$product->delete(); | |
} catch(Exception $e) { | |
echo "Product #".$product->getId()." could not be remvoved: ".$e->getMessage(); | |
} | |
} | |
}; | |
//$deleteAllProduct(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment