Jump to content

Edit History

hakeryk2

hakeryk2

Well, how about make it in "proper" PHP way and create a simple module like. 
 

require_once(dirname(__FILE__).'/../../config/config.inc.php');

$products_to_delete = Db::getInstance()->executeS('
    SOME QUERY TO products_id You want to delete
');

foreach ($products_to_delete as $product_id) {
    $p = new Product($product_id);
	if (Validate::isLoadedObject($p)){
    	$p->delete();
		echo 'Deleted with ID:'.$product_id.' <br>';
	}
}

move this to some module folder and run it from browser. 

Be sure to check $products_to_delete with ddd($produts_to_delete) to see if You query contains proper ids or You can provide them manually as a array like this:

$products_to_delete = array(1,2,3,4); // 1,2,3,4 are examples! Provide your own ids!

 

It should work after few adjustments but I didn't test it. 

hakeryk2

hakeryk2

Well, how about make it in "proper" PHP way and create a simple module like. 
 

require_once(dirname(__FILE__).'/../../config/config.inc.php');

$products_to_delete = Db::getInstance()->executeS('
    SOME QUERY TO products_id You want to delete
');

foreach ($products_to_delete as $product_id) {
    $p = new Product($product_id);
    echo 'Deleted '.$p->name.' with ID:'.$product_id.' <br>';

    $p->delete();
}

move this to some module folder and run it from browser. 

Be sure to check $products_to_delete with ddd($produts_to_delete) to see if You query contains proper ids or You can provide them manually as a array like this:

$products_to_delete = array(1,2,3,4); // 1,2,3,4 are examples! Provide your own ids!

 

It should work after few adjustments but I didn't test it. 

hakeryk2

hakeryk2

Well, how about make it in "proper" PHP way and create a simple module like. 
 

require_once(dirname(__FILE__).'/../../config/config.inc.php');

$products_to_delete = Db::getInstance()->executeS('
    SOME QUERY TO products_id You want to delete
');

foreach ($products_to_delete as $product_id) {
    $p = new Product($product_id);
    echo 'Deleted '.$p->name.' with ID:'.$product_id.' <br>';

    $p->delete();
}

move this to some module folder and run it from browser. 

Be sure to check $products_to_delete with ddd($produts_to_delete) to see if You query contains proper ids.

It should work after few adjustments but I didn't test it. Maybe it will want to $p->save() after delete. I didn't test it. 

×
×
  • Create New...