if (fn_allowed_for('ULTIMATE')) { $company_shippings = db_get_fields('SELECT shipping_id FROM ?:shippings'); } foreach ($shippings as $shipping_id => $shipping) { if (!in_array($shipping_id, $company_shippings)) { unset($shippings[$shipping_id]); } } } $remove_cc = db_get_field("SELECT COUNT(*) FROM ?:status_data WHERE type = 'O' AND param = 'remove_cc_info' AND value = 'N'"); $remove_cc = $remove_cc > 0 ? true : false; Tygh::$app['view']->assign('remove_cc', $remove_cc); Tygh::$app['view']->assign('orders', $orders); Tygh::$app['view']->assign('search', $search); Tygh::$app['view']->assign('totals', $totals); Tygh::$app['view']->assign('display_totals', fn_display_order_totals($orders)); Tygh::$app['view']->assign('shippings', $shippings); $payments = fn_get_payments(array('simple' => true)); Tygh::$app['view']->assign('payments', $payments); } elseif ($mode == 'get_custom_file') { if (!empty($_REQUEST['file']) && !empty($_REQUEST['order_id'])) { $file_path = 'order_data/' . $_REQUEST['order_id'] . '/' . $_REQUEST['file']; if (Storage::instance('custom_files')->isExist($file_path)) { $filename = !empty($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; Storage::instance('custom_files')->get($file_path, $filename); } } } // // Calculate gross total and totally paid values for the current set of orders //
if (fn_allowed_for('ULTIMATE')) { $company_shippings = db_get_fields('SELECT shipping_id FROM ?:shippings'); } foreach ($shippings as $shipping_id => $shipping) { if (!in_array($shipping_id, $company_shippings)) { unset($shippings[$shipping_id]); } } } $remove_cc = db_get_field("SELECT COUNT(*) FROM ?:status_data WHERE type = 'O' AND param = 'remove_cc_info' AND value = 'N'"); $remove_cc = $remove_cc > 0 ? true : false; Registry::get('view')->assign('remove_cc', $remove_cc); Registry::get('view')->assign('orders', $orders); Registry::get('view')->assign('search', $search); Registry::get('view')->assign('totals', $totals); Registry::get('view')->assign('display_totals', fn_display_order_totals($orders)); Registry::get('view')->assign('shippings', $shippings); $payments = fn_get_payments(array('simple' => true)); Registry::get('view')->assign('payments', $payments); } elseif ($mode == 'get_custom_file') { if (!empty($_REQUEST['file']) && !empty($_REQUEST['order_id'])) { $file_path = 'order_data/' . $_REQUEST['order_id'] . '/' . $_REQUEST['file']; if (Storage::instance('custom_files')->isExist($file_path)) { $filename = !empty($_REQUEST['filename']) ? $_REQUEST['filename'] : ''; Storage::instance('custom_files')->get($file_path, $filename); } } } // // Calculate gross total and totally paid values for the current set of orders //
} elseif ($mode == 'manage') { if (!empty($params['status']) && $params['status'] == STATUS_INCOMPLETED_ORDER) { $params['include_incompleted'] = true; $view->assign('incompleted_view', true); } list($orders, $search, $totals) = fn_get_orders($params, Registry::get('settings.Appearance.admin_orders_per_page'), true, CART_LANGUAGE, 1); $orders = fn_UserFieldToArray(44, $orders, 'metro'); $orders = fn_UserFieldToArray(65, $orders, 'firma'); //var_dump($orders); if (!empty($_REQUEST['redirect_if_one']) && count($orders) == 1) { return array(CONTROLLER_STATUS_REDIRECT, "orders.details?order_id={$orders[0]['order_id']}"); } $view->assign('orders', $orders); $view->assign('search', $search); $view->assign('totals', $totals); $view->assign('display_totals', fn_display_order_totals($orders)); $view->assign('shippings', fn_get_shippings(true, CART_LANGUAGE)); } elseif ($mode == 'google') { // In this action we loop the script until google data is changed if ($action == 'wait_response') { $current_time = TIME; echo "Waiting for a Google response. Please be patient."; fn_flush(); do { echo ' .'; $google_info_new = db_get_field("SELECT data FROM ?:order_data WHERE order_id = ?i AND type = ?s", $_REQUEST['order_id'], GOOGLE_ORDER_DATA); if ($google_info_new != $_SESSION['google_info']) { unset($_SESSION['google_info']); return array(CONTROLLER_STATUS_REDIRECT, "orders.details?order_id={$_REQUEST['order_id']}"); } sleep(1);