Delete all products

$product_ids = db_get_fields('SELECT product_id FROM ?:products'); if(!empty($product_ids)){ foreach ($product_ids as $product_id) { fn_delete_product($product_id); } } //db_query('TRUNCATE ?:products'); //FAST SOLUTION if($mode=='delete_products'){ E('DONE!!!!'); #DELETE IMAGES $ids = db_get_fields('SELECT detailed_id FROM ?:images_links WHERE object_type=?s', 'product'); foreach ($ids as $detailed_id){ db_query('DELETE FROM ?:images WHERE image_id=?i', $detailed_id); } db_query('DELETE FROM ?:images_links WHERE object_type=?s', 'product'); db_query('TRUNCATE ?:product_features_values'); db_query('TRUNCATE ?:product_popularity'); db_query('TRUNCATE ?:product_prices'); db_query('TRUNCATE ?:products'); db_query('TRUNCATE ?:products_categories'); db_query('TRUNCATE ?:product_descriptions'); E('DONE'); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.