示例#1
0
function fn_get_user_edp($params, $items_per_page = 0)
{
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $fields = array('?:order_details.product_id', '?:order_details.order_id', '?:order_details.extra', '?:orders.status', '?:products.unlimited_download', '?:product_descriptions.product');
    $where = db_quote(' AND ?:orders.status != ?s', STATUS_INCOMPLETED_ORDER);
    $orders_company_condition = '';
    $limit = '';
    if (fn_allowed_for('ULTIMATE')) {
        $orders_company_condition = fn_get_company_condition('?:orders.company_id');
    }
    if (!empty($params['order_ids'])) {
        if (!is_array($params['order_ids'])) {
            $params['order_ids'] = array($params['order_ids']);
        }
        $where = db_quote(" AND ?:orders.order_id IN (?n)", $params['order_ids']);
    } elseif (!empty($params['items_per_page'])) {
        $params['total_items'] = count(db_get_fields("SELECT COUNT(*)" . " FROM ?:order_details" . " INNER JOIN ?:orders ON ?:orders.order_id = ?:order_details.order_id AND ?:orders.is_parent_order != 'Y' {$orders_company_condition}" . " INNER JOIN ?:product_file_ekeys ON ?:product_file_ekeys.product_id = ?:order_details.product_id AND ?:product_file_ekeys.order_id = ?:order_details.order_id" . " INNER JOIN ?:product_files ON ?:product_files.product_id = ?:order_details.product_id" . " WHERE ?:orders.user_id = ?i AND ?:product_files.status = 'A'" . $where . " GROUP BY ?:order_details.product_id, ?:order_details.order_id", $params['user_id']));
        $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
    }
    $products = db_get_array("SELECT " . implode(', ', $fields) . " FROM ?:order_details" . " INNER JOIN ?:product_files ON ?:product_files.product_id = ?:order_details.product_id" . " INNER JOIN ?:orders ON ?:orders.order_id = ?:order_details.order_id AND ?:orders.is_parent_order != 'Y' {$orders_company_condition}" . " INNER JOIN ?:product_file_ekeys ON ?:product_file_ekeys.product_id = ?:order_details.product_id AND ?:product_file_ekeys.order_id = ?:order_details.order_id" . " LEFT JOIN ?:products ON ?:products.product_id = ?:order_details.product_id" . " LEFT JOIN ?:product_descriptions ON ?:product_descriptions.product_id = ?:order_details.product_id AND ?:product_descriptions.lang_code = ?s" . " LEFT JOIN ?:product_file_folders ON ?:product_file_folders.product_id = ?:order_details.product_id" . " WHERE ?:orders.user_id = ?i AND ?:orders.is_parent_order != 'Y' AND ?:product_files.status = 'A' AND (?:product_file_folders.status = 'A' OR ?:product_files.folder_id IS NULL)" . $where . " GROUP BY ?:order_details.order_id, ?:order_details.product_id" . " ORDER BY ?:orders.order_id DESC {$limit}", CART_LANGUAGE, $params['user_id']);
    if (!empty($products)) {
        foreach ($products as $k => $v) {
            $_params = array('product_id' => $v['product_id'], 'order_id' => $v['order_id']);
            list($product_file_folders) = fn_get_product_file_folders($_params);
            list($product_files) = fn_get_product_files($_params);
            $products[$k]['files_tree'] = fn_build_files_tree($product_file_folders, $product_files);
        }
    }
    return array($products, $params);
}
示例#2
0
        if (!empty($_REQUEST['file_id'])) {
            $params = array('product_id' => $_REQUEST['product_id'], 'file_ids' => $_REQUEST['file_id']);
            list($product_files) = fn_get_product_files($params);
            $product_file = reset($product_files);
            $product_file['company_id'] = db_get_field('SELECT company_id FROM ?:products WHERE product_id = ?i', $_REQUEST['product_id']);
            Tygh::$app['view']->assign('product_file', $product_file);
        }
        list($product_file_folders) = fn_get_product_file_folders(array('product_id' => $_REQUEST['product_id']));
        Tygh::$app['view']->assign('product_file_folders', $product_file_folders);
        Tygh::$app['view']->assign('product_id', $_REQUEST['product_id']);
    }
} elseif ($mode == 'update_folder') {
    if (!empty($_REQUEST['product_id'])) {
        if (!empty($_REQUEST['folder_id'])) {
            $params = array('product_id' => $_REQUEST['product_id'], 'folder_ids' => $_REQUEST['folder_id']);
            list($product_file_folders) = fn_get_product_file_folders($params);
            $product_file_folder = reset($product_file_folders);
            $product_file_folder['company_id'] = db_get_field('SELECT company_id FROM ?:products WHERE product_id = ?i', $_REQUEST['product_id']);
            Tygh::$app['view']->assign('product_file_folder', $product_file_folder);
        }
        Tygh::$app['view']->assign('product_id', $_REQUEST['product_id']);
    }
} elseif ($mode == 'get_features') {
    list($product_features, $features_search) = fn_get_paginated_product_features($_REQUEST, $auth, array(), DESCR_SL);
    Tygh::$app['view']->assign('product_features', $product_features);
    Tygh::$app['view']->assign('features_search', $features_search);
    Tygh::$app['view']->assign('product_id', $_REQUEST['product_id']);
    if (!empty($_REQUEST['over'])) {
        Tygh::$app['view']->assign('over', $_REQUEST['over']);
    }
    if (!empty($_REQUEST['data_name'])) {
示例#3
0
            return array(CONTROLLER_STATUS_DENIED);
        }
        list($_files) = fn_get_product_files(array('product_id' => $_REQUEST['product_id']));
        list($_folder) = fn_get_product_file_folders(array('product_id' => $_REQUEST['product_id']));
        if (empty($_files) && empty($_folder)) {
            Registry::get('view')->assign('product_id', $_REQUEST['product_id']);
        }
    }
    return array(CONTROLLER_STATUS_OK, fn_url('products.update?product_id=' . $_REQUEST['product_id'] . '&selected_section=files'));
} elseif ($mode == 'delete_folder') {
    if (!empty($_REQUEST['folder_id']) && !empty($_REQUEST['product_id'])) {
        if (fn_delete_product_file_folders($_REQUEST['folder_id'], $_REQUEST['product_id']) == false) {
            return array(CONTROLLER_STATUS_DENIED);
        }
        list($product_files) = fn_get_product_files(array('product_id' => $_REQUEST['product_id']));
        list($product_file_folders) = fn_get_product_file_folders(array('product_id' => $_REQUEST['product_id']));
        $files_tree = fn_build_files_tree($product_file_folders, $product_files);
        Registry::get('view')->assign('product_file_folders', $product_file_folders);
        Registry::get('view')->assign('product_files', $product_files);
        Registry::get('view')->assign('files_tree', $files_tree);
        Registry::get('view')->assign('product_id', $_REQUEST['product_id']);
    }
    return array(CONTROLLER_STATUS_OK, fn_url('products.update?product_id=' . $_REQUEST['product_id'] . '&selected_section=files'));
}
//get category for required products list
Registry::get('view')->assign('category_name', $category_name);
function getProductName($product_id)
{
    //$products_id=Registry::get('view')->getTemplateVars();
    $product_name = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id='{$product_id}' AND lang_code=?s", DESCR_SL);
    return $product_name;