Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Delete Unused Options Rate Topic   - - - - -

 
  • johnbol1
  • Never Re
  • Members
  • Join Date: 23-Feb 10
  • 4260 posts

Posted 03 May 2018 - 07:45 PM #1

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


Custom printed hi visibility clothing sale the UK's online hivis safety shop
v4.5.2


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10551 posts

Posted 03 May 2018 - 10:27 PM #2

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

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 04 May 2018 - 06:33 AM #3

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


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • johnbol1
  • Never Re
  • Members
  • Join Date: 23-Feb 10
  • 4260 posts

Posted 04 May 2018 - 07:07 AM #4

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 ?


Custom printed hi visibility clothing sale the UK's online hivis safety shop
v4.5.2


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 04 May 2018 - 01:08 PM #5

Just visit any page in the admin panel


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.