当前位置: 首页>>代码示例>>PHP>>正文


PHP cw_query函数代码示例

本文整理汇总了PHP中cw_query函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_query函数的具体用法?PHP cw_query怎么用?PHP cw_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cw_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_product_video

/**
 * Get video by product
 * 
 * @param int $product_id
 * @return array of rows from table cw_product_video
 */
function get_product_video($product_id)
{
    global $tables;
    $product_id = intval($product_id);
    $video = cw_query("SELECT * FROM {$tables['product_video']} WHERE product_id='{$product_id}' order by pos, title");
    return $video;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:13,代码来源:func.php

示例2: cw_speed_bar_search

function cw_speed_bar_search($params, $return = null)
{
    extract($params);
    global $tables, $current_language;
    $fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
    $orderbys[] = "{$tables['speed_bar']}.orderby";
    $from_tbls[] = 'speed_bar';
    $fields[] = "{$tables['speed_bar']}.*";
    # kornev, merge standart and additional variables
    if ($return) {
        foreach ($return as $saname => $sadata) {
            if (isset(${$saname}) && is_array(${$saname}) && empty(${$saname})) {
                ${$saname} = $sadata;
            }
        }
    }
    $language = $language ? $language : $current_language;
    $query_joins['speed_bar_lng'] = array('on' => "{$tables['speed_bar_lng']}.item_id = {$tables['speed_bar']}.item_id AND {$tables['speed_bar_lng']}.code = '{$language}'", 'only_select' => 1);
    $fields[] = "IFNULL({$tables['speed_bar_lng']}.title, {$tables['speed_bar']}.title) as title";
    if (isset($data['active'])) {
        $where[] = "{$tables['speed_bar']}.active='{$data['active']}'";
    }
    $search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
    return cw_query($search_query);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:25,代码来源:cw.speed_bar.php

示例3: cw_sections_get

function cw_sections_get($section, $data = array(), $where = '', $info_type = 264)
{
    global $tables, $current_area, $user_account;
    //    extract($params);
    $table = $tables[$section];
    if (!$info_type) {
        $info_type = 264;
    }
    if ($current_area == 'C') {
        $where .= ($where ? ' and ' : ' ') . $table . '.active=1 ';
        if (in_array($section, array('arrivals', 'hot_deals', 'clearance', 'super_deals'))) {
            $current_time = time();
            $where .= " and ({$table}.from_time <= {$current_time} or {$table}.from_time = 0) and ({$table}.to_time >={$current_time} or {$table}.to_time = 0) and ({$table}.min_amount <= {$tables['products_warehouses_amount']}.avail or {$table}.min_amount = 0)";
        }
        $add_data['query_joins'][$section] = array('on' => "{$tables['products']}.product_id={$table}.product_id", 'is_inner' => 1);
        $data['where'] = $where;
        if ($data['sort_field'] == 'orderby' || empty($data['sort_field'])) {
            $data['sort_field'] = "{$table}.pos";
        }
        $return = cw_func_call('cw_product_search', array('data' => $data, 'user_account' => $user_account, 'current_area' => $current_area, 'info_type' => $info_type), $add_data);
        if ($data['all']) {
            $return = $return[0];
        }
    } else {
        $return = cw_query("select {$table}.*, {$tables['products']}.product_id, {$tables['products']}.product from {$table}, {$tables['products']}, {$tables['products_warehouses_amount']} where {$tables['products_warehouses_amount']}.product_id = {$tables['products']}.product_id and {$tables['products_warehouses_amount']}.warehouse_customer_id = 0 and {$tables['products_warehouses_amount']}.variant_id=0 and {$tables['products']}.product_id={$table}.product_id {$where} order by {$table}.pos, {$tables['products']}.product");
    }
    return $return;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:28,代码来源:cw.sections.php

示例4: product_stages_view

function product_stages_view()
{
    global $smarty, $product_id, $tables;
    $product_stages = cw_call('cw\\' . addon_name . '\\cw_product_stages_get_product_settings', array($product_id));
    $lib_stages = cw_query("select * from {$tables['product_stages_library']} order by title");
    $smarty->assign('product_stages', $product_stages);
    $smarty->assign('lib_stages', $lib_stages);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:modify.php

示例5: cw_get_serial_numbers

function cw_get_serial_numbers($customer_id, $product_id, $full_info = false)
{
    global $tables, $current_area;
    $serials = cw_query($sql = "select * from {$tables['serial_numbers']} where doc_id=0 and product_id='{$product_id}'" . ($customer_id ? " and warehouse_customer_id='{$customer_id}'" : "") . " order by warehouse_customer_id");
    if (!$serials) {
        $serials = array();
    }
    return $serials;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:9,代码来源:cw.serials.php

示例6: cw_breadcrumbs_get_management_breadcrumbs

function cw_breadcrumbs_get_management_breadcrumbs($where = "", $orderby = "", $limit = "", $count_query = FALSE)
{
    global $tables;
    $result = cw_query("\n        SELECT " . ($count_query ? "count(b1.breadcrumb_id) as c" : "b1.*, b2.link as parent_link, b2.title as parent_title") . "\n        FROM {$tables['breadcrumbs']} b1\n        LEFT JOIN {$tables['breadcrumbs']} b2 ON b2.breadcrumb_id = b1.parent_id\n        LEFT JOIN {$tables['addons']} as a ON a.addon = b1.addon\n        WHERE (a.active OR a.addon IS NULL) {$where}\n        " . ($count_query ? "" : $orderby) . "\n        {$limit}\n    ");
    if ($count_query) {
        return $result[0]['c'];
    }
    return $result;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:9,代码来源:func.breadcrumbs.php

示例7: cw_flexible_import_get_profiles

function cw_flexible_import_get_profiles($params)
{
    global $tables;
    extract($params);
    $sort_field = $sort_field && $sort_field != "" ? " ORDER BY " . $sort_field . " " : "";
    $sort_direction = $sort_direction != 0 ? " DESC " : " ASC ";
    $limit .= 'LIMIT ' . ($items_per_page * $page - $items_per_page) . ', ' . $items_per_page;
    $profiles = cw_query("SELECT * FROM {$tables['flexible_import_profiles']} {$sort_field} {$sort_direction}  {$limit}");
    return $profiles;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:func.flexible_import.php

示例8: cw_system_messages

function cw_system_messages($type, $with_hidden = false)
{
    global $tables;
    $type = intval($type);
    $sign = '=';
    if ($with_hidden) {
        $sign = '>=';
    }
    return cw_query("SELECT * FROM {$tables['system_messages']} WHERE type='{$type}' AND hidden {$sign} 0 \n        ORDER BY (severity = 'C') DESC, date DESC");
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:cw.system_messages.php

示例9: cw_ab_check_clean_url

function cw_ab_check_clean_url($url, $attr_ids)
{
    global $tables;
    $data = cw_query("SELECT item_id FROM {$tables['attributes_values']} WHERE value = '{$url}' AND attribute_id IN (" . implode(", ", $attr_ids) . ") ");
    if (!$data) {
        return 0;
    } else {
        return 1;
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:func.php

示例10: cw_file_area_get_list

function cw_file_area_get_list($type, $customer_id, $where = '')
{
    global $tables;
    $files = cw_query("select * from " . $tables[$type] . " where customer_id='{$customer_id}' {$where} order by orderby, file_id");
    if ($files) {
        foreach ($files as $k => $val) {
            $files[$k] = cw_file_get_info($type, $val);
        }
    }
    return $files;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:11,代码来源:cw.file_area.php

示例11: cw_get_salesman_pending_orders

function cw_get_salesman_pending_orders($salesman = '')
{
    global $tables;
    $data = cw_query("select * from {$tables['salesman_orders']} where status=0" . ($salesman ? " and salesman_customer_id='{$salesman}'" : ""));
    if (is_array($data)) {
        foreach ($data as $k => $v) {
            $data[$k]['products'] = unserialize($v['cart']);
            unset($data[$k]['cart']);
        }
    }
    return $data;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:cw.salesman_orders.php

示例12: get

function get($product_id = null, $category_id = null, $main = null)
{
    global $tables;
    $where = (!is_null($product_id) ? ' AND product_id = "' . intval($product_id) . '"' : '') . (!is_null($category_id) ? ' AND category_id = "' . intval($category_id) . '"' : '') . (!is_null($main) ? ' AND category_id = "' . intval($main) . '"' : '');
    $result = cw_query('SELECT * FROM ' . $tables['products_categories'] . ' WHERE 1 ' . $where);
    // if certain prod<=>cat link requested, then return only this row
    if (!is_null($product_id) && (!is_null($category_id) || !is_null($main)) && count($result) == 1) {
        return array_pop($result);
    }
    // otherwise return array of rows
    return $result;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:product.base.php

示例13: cw_objects_get_list_ids

function cw_objects_get_list_ids($type = 'P')
{
    global $tables, $customer_id;
    $objects = array();
    $result = cw_query("SELECT object_id \r\n\t\t\t\t\t\t\tFROM {$tables['objects_set']} \r\n\t\t\t\t\t\t\tWHERE customer_id = {$customer_id} \r\n\t\t\t\t\t\t\t\tAND set_type = '{$type}'");
    if (is_array($result) && count($result)) {
        foreach ($result as $object) {
            $objects[] = $object['object_id'];
        }
    }
    return $objects;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:cw.export.php

示例14: cw_cron_invoice_check_params

function cw_cron_invoice_check_params($time, $prev_time)
{
    global $tables, $config, $smarty;
    $expired_invoices = array();
    $notify_invoices = array();
    $days_notify = intval($config['General']['days_notify_expiration_invoice']);
    $result = cw_query("SELECT d.doc_id, d.display_id, ui.customer_id, di.expiration_date\n\t\t\t\t\t\t\tFROM {$tables['docs']} d\n\t\t\t\t\t\t\tLEFT JOIN {$tables['docs_info']} di ON di.doc_info_id = d.doc_info_id\n\t\t\t\t\t\t\tLEFT JOIN {$tables['docs_user_info']} ui ON ui.doc_info_id = d.doc_info_id\n\t\t\t\t\t\t\tWHERE di.expiration_date <> 0 AND d.type = 'I' AND status <> 'C' AND status <> 'F'");
    if (!empty($result)) {
        foreach ($result as $value) {
            if (!empty($value['customer_id'])) {
                $expiration_date = $value['expiration_date'];
                $days_left = floor(($expiration_date - $time) / SECONDS_PER_DAY);
                // invoice is expired
                if ($days_left <= 0) {
                    cw_load('mail', 'doc');
                    $doc_id = $value['doc_id'];
                    $status = 'F';
                    $expired_invoices[] = "ID:" . $doc_id . " NUMBER:" . $value['display_id'];
                    cw_call('cw_doc_change_status', array($doc_id, $status));
                } elseif ($days_notify > 0 && $days_left == $days_notify) {
                    cw_load('mail', 'doc', 'web');
                    $doc_id = $value['doc_id'];
                    $doc_data = cw_call('cw_doc_get', array($doc_id, 8192));
                    $notify_invoices[] = "ID:" . $doc_id . " NUMBER:" . $value['display_id'];
                    if (empty($doc_data)) {
                        continue;
                    }
                    if ($doc_data['info']['layout_id']) {
                        $layout = cw_web_get_layout_by_id($doc_data['info']['layout_id']);
                    } else {
                        $layout = cw_web_get_layout('docs_' . $doc_data['type']);
                    }
                    $smarty->assign('layout_data', $layout);
                    $smarty->assign('info', $doc_data['info']);
                    $smarty->assign('products', $doc_data['products']);
                    $smarty->assign('order', $doc_data);
                    $smarty->assign('doc', $doc_data);
                    cw_call('cw_send_mail', array($config['Company']['orders_department'], $doc_data['userinfo']['email'], 'mail/docs/customer_subj.tpl', 'mail/docs/customer.tpl', null, false, true));
                }
            }
        }
    }
    $message = "";
    if (count($expired_invoices)) {
        $message = "\n Expired invoices: '" . implode(", ", $expired_invoices) . "'";
    }
    if (count($notify_invoices)) {
        $message .= "\n Notify invoices: '" . implode(", ", $notify_invoices) . "'";
    }
    return $message;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:51,代码来源:cw.cron.php

示例15: ab_show

function ab_show($product_id)
{
    global $smarty, $tables, $config;
    global $current_language;
    $product_id = (int) $product_id;
    if (empty($product_id)) {
        return;
    }
    if ($_SERVER['REQUEST_METHOD'] != 'GET') {
        ab_redirect($product_id);
    }
    $contentsections = cw_query("SELECT ab.contentsection_id, ab.service_code, ab.name, ab.type, abp.object_id as selected FROM {$tables['cms']} ab\n            LEFT JOIN {$tables['cms_restrictions']} abp ON ab.contentsection_id = abp.contentsection_id AND abp.object_id='{$product_id}' AND abp.object_type='P'\n            ORDER BY ab.service_code");
    $smarty->assign('contentsections', $contentsections);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:14,代码来源:product_modify.php


注:本文中的cw_query函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。