Skip to content

Instantly share code, notes, and snippets.

@tuanphpvn
Last active August 4, 2016 00:43
Show Gist options
  • Save tuanphpvn/6b70fb856f05b7148d42 to your computer and use it in GitHub Desktop.
Save tuanphpvn/6b70fb856f05b7148d42 to your computer and use it in GitHub Desktop.
Delete all product belong to category
<?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