actions(); if (!method_exists($order_action->modules[$module_id], $actions[$module_id]['actions'][$action_id]['function'])) { throw new Exception(language::translate('error_method_doesnt_exist', 'The method doesn\'t exist')); } sort($_POST['orders']); ob_start(); if ($result = call_user_func([$order_action->modules[$module_id], $actions[$module_id]['actions'][$action_id]['function']], $_POST['orders'])) { echo $result; } // Backwards compatibility if ($output = ob_get_clean()) { echo $output; return; } header('Location: '. $_SERVER['REQUEST_URI']); exit; } catch (Exception $e) { notices::add('errors', $e->getMessage()); } } // Table Rows $orders = []; if (!empty($_GET['query'])) { $sql_where_query = [ "o.id = '". database::input($_GET['query']) ."'", "o.uid = '". database::input($_GET['query']) ."'", "o.reference like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.customer_email like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.customer_phone like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.customer_tax_id like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "concat(o.customer_company, '\\n', o.customer_firstname, ' ', o.customer_lastname, '\\n', o.customer_address1, '\\n', o.customer_address2, '\\n', o.customer_postcode, '\\n', o.customer_city) like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "concat(o.shipping_company, '\\n', o.shipping_firstname, ' ', o.shipping_lastname, '\\n', o.shipping_address1, '\\n', o.shipping_address2, '\\n', o.shipping_postcode, '\\n', o.shipping_city) like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.payment_option_id like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.payment_option_name like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.payment_transaction_id like '". addcslashes(database::input($_GET['query']), '%_') ."'", "o.shipping_option_id like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.shipping_option_name like '%". addcslashes(database::input($_GET['query']), '%_') ."%'", "o.shipping_tracking_id like '". addcslashes(database::input($_GET['query']), '%_') ."'", "o.id in ( select distinct order_id from ". DB_TABLE_PREFIX ."orders_items where name like '%". addcslashes(database::input($_GET['query']), '%_') ."%' or sku like '%". addcslashes(database::input($_GET['query']), '%_') ."%' )", "o.order_status_id in ( select distinct order_status_id from ". DB_TABLE_PREFIX ."order_statuses_info where language_code = '". database::input(language::$selected['code']) ."' and name like '%". addcslashes(database::input($_GET['query']), '%_') ."%' )", ]; } switch($_GET['order_status_id']) { case '': $sql_where_order_status = "and (o.order_status_id = 0 or os.is_archived = 0 or unread = 1)"; break; case 'archived': $sql_where_order_status = "and (os.is_archived = 1)"; break; case 'unprocessed': $sql_where_order_status = "and o.order_status_id = 0"; break; case 'all': break; default: $sql_where_order_status = "and o.order_status_id = ". (int)$_GET['order_status_id']; break; } switch($_GET['sort']) { case 'id': $sql_sort = "o.starred desc, o.id desc"; break; case 'country': $sql_sort = "o.starred desc, o.customer_country_code"; break; case 'customer': $sql_sort = "o.starred desc, if(o.customer_company, o.customer_company, concat(o.customer_firstname, ' ', o.customer_lastname)) asc"; break; case 'order_status': $sql_sort = "o.starred desc, osi.name asc"; break; case 'payment_method': $sql_sort = "o.starred desc, o.payment_option_name asc"; break; default: $sql_sort = "o.starred desc, o.date_created desc, o.id desc"; break; } $orders_query = database::query( "select o.*, os.color as order_status_color, os.icon as order_status_icon, osi.name as order_status_name from ". DB_TABLE_PREFIX ."orders o left join ". DB_TABLE_PREFIX ."order_statuses os on (os.id = o.order_status_id) left join ". DB_TABLE_PREFIX ."order_statuses_info osi on (osi.order_status_id = o.order_status_id and osi.language_code = '". database::input(language::$selected['code']) ."') where o.id ". (!empty($sql_where_query) ? "and (". implode(" or ", $sql_where_query) .")" : "") ." ". (!empty($sql_where_order_status) ? $sql_where_order_status : "") ." ". (!empty($_GET['date_from']) ? "and o.date_created >= '". date('Y-m-d H:i:s', strtotime($_GET['date_from'])) ."'" : '') ." ". (!empty($_GET['date_to']) ? "and o.date_created <= '". date('Y-m-d H:i:s', strtotime($_GET['date_to'])) ."'" : '') ." order by $sql_sort;" ); if ($_GET['page'] > 1) database::seek($orders_query, settings::get('data_table_rows_per_page') * ($_GET['page'] - 1)); $page_items = 0; while ($order = database::fetch($orders_query)) { if (empty($order['order_status_id'])) { $order['order_status_icon'] = 'fa-minus'; $order['order_status_color'] = '#cccccc'; } if (empty($order['order_status_icon'])) $order['order_status_icon'] = 'fa-circle-thin'; if (empty($order['order_status_color'])) $order['order_status_color'] = '#ccc'; $order['css_classes'] = []; if (empty($order['order_status_id'])) $order['css_classes'][]= 'semi-transparent'; if (!empty($order['unread'])) $order['css_classes'][]= 'bold'; $orders[] = $order; if (++$page_items == settings::get('data_table_rows_per_page')) break; } // Number of Rows $num_rows = database::num_rows($orders_query); // Pagination $num_pages = ceil($num_rows/settings::get('data_table_rows_per_page')); // Order Statuses $order_status_options = [ [ 'label' => language::translate('title_collections', 'Collections'), 'options' => [ [language::translate('title_current', 'Current Orders'), ''], [language::translate('title_archived_orders', 'Archived Orders'), 'archived'], [language::translate('title_unprocessed_orders', 'Unprocessed Orders'), 'unprocessed'], [language::translate('title_all_orders', 'All Orders'), 'all'], ], ], [ 'label' => language::translate('title_order_statuses', 'Order Statuses'), 'options' => [], ], ]; $order_statuses_query = database::query( "select os.*, osi.name, o.num_orders from ". DB_TABLE_PREFIX ."order_statuses os left join ". DB_TABLE_PREFIX ."order_statuses_info osi on (os.id = osi.order_status_id and language_code = '". database::input(language::$selected['code']) ."') left join ( select order_status_id, count(id) as num_orders from ". DB_TABLE_PREFIX ."orders group by order_status_id ) o on (o.order_status_id = os.id) order by field(state,'created','on_hold','ready','delayed','processing','completed','dispatched','in_transit','delivered','returning','returned','cancelled','other',''), os.priority, osi.name asc;" ); while ($order_status = database::fetch($order_statuses_query)) { $order_status_options[1]['options'][] = [$order_status['name'] . ' ('. language::number_format((int)$order_status['num_orders'], 0) .')', $order_status['id']]; } // Actions $order_actions = []; $mod_order = new mod_order(); if ($modules = $mod_order->actions()) { foreach ($modules as $module) { $order_actions[] = $module; } } ?>
-
('. language::translate('title_guest', 'Guest') .')' : ''; ?> name : ''; ?>
:
1) { ?>