Update for CS-Cart 4.x
#file
app/addons/my_changes/controllers/backend/my_changes.php
#content```php
/*
* © 2014 HungryWeb.net
*
* @website: www.hungryweb.net
* @support: support@hungryweb.net
*
*/
if (!defined('BOOTSTRAP')) { die('Access denied'); }
if($mode=='delete_all_products'){
$products = db_get_array('SELECT product_id FROM ?:products');
foreach($products as $p){
fn_delete_product($p['product_id']);
}
fn_set_notification('N', fn_get_lang_var('notice'), 'All the products has been deleted with succes!');
return array(CONTROLLER_STATUS_OK, "products.manage");
}
```
#callback
```php
http://www.domain.com/admin.php?dispatch=my_changes.delete_all_products
```
I hope that helps,
---
Valentin
[color=#808080][size=2]part of hungryweb.net[/size][/color]
[quote name='richardfmm' timestamp='1408630477' post='190204']
Hi,
i have try this: www.domain/public_html/cs4/admin.php?dispatch=my_changes.delete_all_products
and www.domain/public_html/cs4/app/addons/my_changes/controlers/backend/my_changes.php
Bott i get a 404.
[/quote]
I consider mistake is here
#wrong
.../controlers/...
#correct
.../controllers/...
Please try and let me know
—
Valentin
[color=#808080][size=2]part of hungryweb.net[/size][/color]
Hi Vali,
Change the new html and works great now.
The error whas also: “public_html” in the link.
All products are gone and notice text appear in admin.
Thanks a lot.
gr.
Thanks, Vali.
I was looking for method how remove all features, and your code is helpful. Just add to #content another «if»:
if($mode=='delete_all_product_features'){
//exit;
// deleting features
$feature_ids = db_get_fields("SELECT feature_id FROM ?:product_features");
foreach ($feature_ids as $feature_id) {
fn_delete_feature($feature_id);
}
fn_set_notification('N', fn_get_lang_var('notice'), 'All the product features has been deleted with succes!');
return array(CONTROLLER_STATUS_OK, "product_features.manage");
}
and #callback url:
http://www.domain.com/admin.php?dispatch=my_changes.delete_all_product_features