示例#1
0
    if (!empty($_REQUEST['redirect_if_one']) && count($orders) == 1) {
        return array(CONTROLLER_STATUS_REDIRECT, 'orders.details?order_id=' . $orders[0]['order_id']);
    }
    $shippings = fn_get_shippings(true, CART_LANGUAGE);
    if (Registry::get('runtime.company_id')) {
        $company_shippings = fn_get_companies_shipping_ids(Registry::get('runtime.company_id'));
        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 status_id IN (?n)" . " AND param = 'remove_cc_info'" . " AND value = 'N'", array_keys(fn_get_statuses_by_type(STATUSES_ORDER)));
    $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);
示例#2
0
/**
 * Gets full information about particular statuses
 * @param string $type One letter status type
 * @param array $status_to_select Array of statuses that should be retrieved. If empty, all statuses will be retrieved
 * @param boolean $additional_statuses Flag that determines whether additional (hidden) statuses should be retrieved
 * @param boolean $exclude_parent Flag that determines whether parent statuses should be excluded
 * @param string $lang_code Language code
 * @param int $company_id Company identifier
 * @return array Statuses
 */
function fn_get_statuses($type = STATUSES_ORDER, $status_to_select = array(), $additional_statuses = false, $exclude_parent = false, $lang_code = DESCR_SL, $company_id = 0)
{
    fn_set_hook('get_statuses_pre', $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    $join = db_quote(" LEFT JOIN ?:status_descriptions ON ?:status_descriptions.status_id = ?:statuses.status_id AND ?:status_descriptions.lang_code = ?s", $lang_code);
    $condition = db_quote(" AND ?:statuses.type = ?s", $type);
    $condition .= !empty($status_to_select) ? db_quote(" AND ?:statuses.status IN (?a)", $status_to_select) : '';
    fn_set_hook('get_statuses', $join, $condition, $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    $statuses = db_get_hash_array("SELECT ?:statuses.*, ?:status_descriptions.*" . " FROM ?:statuses" . $join . " WHERE 1 {$condition}", 'status');
    $statuses_params = db_get_hash_multi_array("SELECT status_id, param, value" . " FROM ?:status_data" . " WHERE status_id IN (?n)", array('status_id', 'param'), array_keys(fn_get_statuses_by_type($type)));
    foreach ($statuses as $status => $status_data) {
        $statuses[$status]['params'] = array();
        if (isset($statuses_params[$status_data['status_id']])) {
            foreach ($statuses_params[$status_data['status_id']] as $param_name => $param_data) {
                $statuses[$status]['params'][$param_name] = $param_data['value'];
            }
        }
    }
    if ($type == STATUSES_ORDER && $additional_statuses && empty($status_to_select)) {
        $statuses[STATUS_INCOMPLETED_ORDER] = array('status' => STATUS_INCOMPLETED_ORDER, 'status_id' => null, 'description' => __('incompleted', '', $lang_code), 'type' => STATUSES_ORDER, 'params' => array('inventory' => 'I'));
        if (empty($exclude_parent)) {
            $statuses[STATUS_PARENT_ORDER] = array('status' => STATUS_PARENT_ORDER, 'status_id' => null, 'description' => __('parent_order', '', $lang_code), 'type' => STATUSES_ORDER, 'params' => array('inventory' => 'I'));
        }
    }
    fn_set_hook('get_statuses_post', $statuses, $join, $condition, $type, $status_to_select, $additional_statuses, $exclude_parent, $lang_code, $company_id);
    return $statuses;
}
示例#3
0
/**
 * Gets order paid statuses
 *
 * @return array Available paid statuses
 */
function fn_get_order_paid_statuses()
{
    $order_status_list = fn_get_statuses_by_type(STATUSES_ORDER);
    $paid_statuses = db_get_fields("SELECT status_id" . " FROM ?:status_data" . " WHERE status_id IN (?n)" . " AND param = ?s" . " AND value = ?s", array_keys($order_status_list), 'inventory', 'D');
    $paid_statuses = array_values(array_intersect_key($order_status_list, array_combine($paid_statuses, $paid_statuses)));
    /**
     * Get order paid statuses (at the end of fn_get_order_paid_statuses())
     *
     * @param array $paid_statuses List of order paid statuses
     */
    fn_set_hook('get_order_paid_statuses_post', $paid_statuses);
    return $paid_statuses;
}