Delete Unused Options

I disabled thousands of standard options on products and replaced them with global options.

The old disabled standard options are now causing problmes when Im adding orders in admin.

Is there a way "sql query" maybe that will delete all options marked as disabled?

Thanks

John

Probably 2 queries. One for variants and descriptions and one for the option itself.

I suggest you to use default functions since they can alter additional tables (like cscart_ult_objects_sharing)

$options = db_get_fields("SELECT option_id FROM ?:product_options WHERE status = ?s", 'D');
if (!empty($options)) {
    foreach ($options as $o_id) {
        fn_delete_product_option($o_id);
    }
}

For example, you can temporary add this code to the end of the app/controllers/backend/init.php file

(!) Not tested, make DB backup just in case

I suggest you to use default functions since they can alter additional tables (like cscart_ult_objects_sharing)

$options = db_get_fields("SELECT option_id FROM ?:product_options WHERE status = ?s", 'D');
if (!empty($options)) {
    foreach ($options as $o_id) {
        fn_delete_product_option($o_id);
    }
}

For example, you can temporary add this code to the end of the app/controllers/backend/init.php file

(!) Not tested, make DB backup just in case

So I just add that code to the file and how do I execute it ?

Just visit any page in the admin panel