Create one file and paste following code:
<?php
require_once ("app/Mage.php");
Mage::app('admin');
$category_id = your_cat_id;
$products = Mage::getModel('catalog/product')->getCollection();
foreach($products as $product){
$categories = $product->getCategoryIds();
if(in_array($category_id, $categories)) {
$product_load = Mage::getSingleton('catalog/product')->load($product->getId());
Mage::dispatchEvent('catalog_controller_product_delete', array('product' => $product_load));
$product_load->delete();
}
}
?>
And upload file on root of server and run as:
www.example.com/file_name.php
<?php
require_once ("app/Mage.php");
Mage::app('admin');
$category_id = your_cat_id;
$products = Mage::getModel('catalog/product')->getCollection();
foreach($products as $product){
$categories = $product->getCategoryIds();
if(in_array($category_id, $categories)) {
$product_load = Mage::getSingleton('catalog/product')->load($product->getId());
Mage::dispatchEvent('catalog_controller_product_delete', array('product' => $product_load));
$product_load->delete();
}
}
?>
And upload file on root of server and run as:
www.example.com/file_name.php
This post is all about the Deleting product list from the category Id. This post is so much needy and very useful for the magento developer. Thanks for this kind of posts and keep updating.
ReplyDeleteKetoArt
Impressive post, thanks for it.
ReplyDeletetacrolimus capsules
Thanks for this information.
ReplyDeletebuy rudraksha mala online
gemstones dealers in Delhi