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


PHP cw_query_first_cell函数代码示例

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


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

示例1: cw_gb_get_category_value

function cw_gb_get_category_value($category_id, $default_value)
{
    global $tables;
    if (empty($category_id)) {
        return empty($default_value) ? FALSE : $default_value;
    }
    $attr_val_id = cw_query_first_cell("SELECT av.value\n\t\t                    FROM {$tables['attributes_values']} av, {$tables['attributes']} a\n\t\t                    WHERE av.item_id={$category_id}\n\t\t                    \tAND av.item_type='C'\n\t\t                    \tAND a.attribute_id=av.attribute_id\n\t\t                    \tAND a.field='g:google_product_category'");
    if (empty($attr_val_id)) {
        // Get parent categories
        $parent_categories = array();
        cw_category_generate_path($category_id, $parent_categories);
        if (count($parent_categories)) {
            foreach ($parent_categories as $parent_category_id) {
                $attr_val_id = cw_query_first_cell("SELECT av.value\n\t\t                    FROM {$tables['attributes_values']} av, {$tables['attributes']} a\n\t\t                    WHERE av.item_id={$parent_category_id}\n\t\t                    \tAND av.item_type='C'\n\t\t                    \tAND a.attribute_id=av.attribute_id\n\t\t                    \tAND a.field='g:google_product_category'");
                if (!empty($attr_val_id)) {
                    break;
                }
            }
        }
    }
    if ($attr_val_id) {
        $attr_val = cw_query_first_cell("SELECT value FROM {$tables['attributes_default']} WHERE attribute_value_id = " . $attr_val_id);
        if (empty($attr_val)) {
            return empty($default_value) ? FALSE : $default_value;
        }
        return $attr_val;
    }
    return empty($default_value) ? FALSE : $default_value;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:29,代码来源:func.php

示例2: cw_config_update

function cw_config_update($category, $options)
{
    global $tables;
    $config_category_id = cw_query_first_cell("SELECT config_category_id FROM {$tables['config_categories']} WHERE category='{$category}'");
    $var_properties = cw_query_hash("SELECT name, type FROM {$tables['config']} WHERE config_category_id='{$config_category_id}'", "name", false, true);
    $section_data = array();
    foreach ($options as $key => $val) {
        if (isset($var_properties[$key])) {
            if ($var_properties[$key] == "numeric") {
                $val = doubleval(cw_convert_numeric($val));
            } elseif ($var_properties[$key] == "textarea") {
                $val = strtr($val, array("\r" => ''));
            } elseif ($var_properties[$key] == "multiselector") {
                $val = implode(";", $val);
            } elseif ($var_properties[$key] == "checkbox") {
                $val = in_array($val, array('on', '1', 'Y')) ? 'Y' : 'N';
            } elseif (in_array($var_properties[$key], array('shipping', 'memberships', 'doc_status'))) {
                $ret = array();
                if (is_array($val)) {
                    foreach ($val as $k => $v) {
                        $ret[$v] = 1;
                    }
                }
                $val = serialize($ret);
            }
            cw_array2update("config", array("value" => $val), "name='" . $key . "' AND config_category_id='" . $config_category_id . "'");
            $section_data[stripslashes($key)] = stripslashes($val);
        }
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:30,代码来源:cw.config.php

示例3: cw_barcode_print_doc

function cw_barcode_print_doc($doc_id, $options)
{
    global $tables, $user_account;
    $layout = cw_web_get_layout_by_id($options['template_id']);
    $doc = cw_doc_get($doc_id);
    $amount = $options['amount'];
    if (!$amount) {
        $amount = 1;
    }
    foreach ($doc['products'] as $product) {
        if (in_array($doc['type'], array('P', 'R', 'Q'))) {
            $product['supplier_code'] = $product['productcode'];
        } else {
            $product['supplier_code'] = cw_query_first_cell("select productcode from {$tables['products_supplied_amount']} where product_id='{$product_id}' order by date limit 1");
        }
        if ($layout['data']['use_tax']) {
            $taxes = $product['extra_data']['taxes'];
            cw_get_products_taxes($product, $user_account, false, $taxes, true);
            $_tmp_price = $product['price'];
            $product['price'] = $product['list_price'];
            cw_get_products_taxes($product, $user_account, false, $taxes, true);
            $product['list_price'] = $product['display_price'];
            $product['price'] = $_tmp_price;
        } else {
            $product['display_price'] = $product['price'];
        }
        for ($i = 0; $i < $product['amount'] * $amount; $i++) {
            $products[] = $product;
        }
    }
    cw_barcode_print($products, $layout, $options, 0);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:32,代码来源:cw.barcode.php

示例4: cw_serials_delete

function cw_serials_delete($customer_id, $product_id, $serial)
{
    global $tables;
    $count = cw_query_first_cell("select count(*) from {$tables['serial_numbers']} where sn='{$serial}' and product_id='{$product_id}' and doc_id=0" . ($customer_id ? " and warehouse_customer_id='{$customer_id}'" : ""));
    if ($count) {
        db_query("delete from {$tables['serial_numbers']} where sn='{$serial}' and product_id='{$product_id}'" . ($customer_id ? " and warehouse_customer_id='{$customer_id}'" : ""));
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:cw.serials.php

示例5: cw_mobile_get_mobile_host_attr_by_domain_id

function cw_mobile_get_mobile_host_attr_by_domain_id($domain_id)
{
    global $tables;
    $mobile_mobile_flag = cw_session_register('mobile_mobile_flag');
    cw_load('attributes');
    $current_language = cw_query_first_cell("SELECT value FROM {$tables['config']} WHERE name='default_customer_language'");
    $attributes = cw_func_call('cw_attributes_get', array('item_id' => $domain_id, 'item_type' => 'DM', 'language' => $current_language));
    return !empty($attributes['mobile_host']['value']) ? trim($attributes['mobile_host']['value']) : ($mobile_mobile_flag == 'on' && $_GET['mobile_version'] != 'off' ? cw_mobile_get_host() : '');
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:9,代码来源:func.mobile.php

示例6: cw_objects_check_exist

function cw_objects_check_exist($object, $type = 'P')
{
    global $tables, $customer_id;
    if (is_numeric($object)) {
        $query = "SELECT object_id \r\n\t\t\t\t\tFROM {$tables['objects_set']} \r\n\t\t\t\t\tWHERE object_id = {$object} \r\n\t\t\t\t\t\tAND customer_id = {$customer_id} \r\n\t\t\t\t\t\tAND set_type = '{$type}'";
        return cw_query_first_cell($query) !== FALSE;
    }
    return FALSE;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:9,代码来源:cw.export.php

示例7: cw_file_area_delete

function cw_file_area_delete($type, $file_id)
{
    global $tables;
    $file = cw_query_first_cell("select file_path from " . $tables[$type] . " where file_id='{$file_id}'");
    if (is_file($file)) {
        @unlink($file);
    }
    db_query("delete from " . $tables[$type] . " where file_id='{$file_id}'");
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:9,代码来源:cw.file_area.php

示例8: cw_pages_by_url

function cw_pages_by_url($url, $check_redirect = true)
{
    global $tables;
    $page_id = cw_query_first_cell("select * from {$tables['pages']} where url='{$url}'");
    $page_data = cw_pages_get_page_content($page_id);
    if ($check_redirect && $page_data['redirect']) {
        cw_header_location($page_data['redirect'], true, false, 301);
    }
    return $page_data;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:cw.pages.php

示例9: cw_add_class_data

function cw_add_class_data($data, $product_id)
{
    global $tables;
    # Update class data
    $comp = $data['class'];
    $comp['product_id'] = $product_id;
    cw_unset($comp, "product_option_id");
    $comp = cw_addslashes($comp);
    $product_option_id = cw_query_first_cell("SELECT product_option_id FROM {$tables['product_options']} WHERE class = '{$comp['class']}' AND product_id = '{$comp['product_id']}'");
    $is_new = empty($product_option_id);
    if (!empty($product_option_id)) {
        cw_array2update("product_options", $comp, "product_option_id = '{$product_option_id}'");
    } else {
        $product_option_id = cw_array2insert("product_options", $comp);
    }
    # Update class multilanguage data
    db_query("DELETE FROM {$tables['product_options_lng']} WHERE product_option_id = '{$product_option_id}'");
    foreach ($data['product_options_lng'] as $v) {
        $v['product_option_id'] = $product_option_id;
        $v = cw_addslashes($v);
        cw_array2insert("product_options_lng", $v, true);
    }
    # Update class options
    $ids = array();
    foreach ($data['product_options_values'] as $k => $opt) {
        $opt['product_option_id'] = $product_option_id;
        $old_option_id = $opt['option_id'];
        cw_unset($opt, "option_id");
        $opt = cw_addslashes($opt);
        $option_id = cw_query_first_cell("SELECT option_id FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND name = '{$opt['name']}'");
        if (empty($option_id)) {
            $option_id = cw_array2insert("product_options_values", $opt);
        } else {
            cw_array2update("product_options_values", $opt, "option_id = '{$option_id}'");
        }
        $ids[$old_option_id] = $option_id;
    }
    # Update class option multilanguage data
    db_query("DELETE FROM {$tables['product_options_values_lng']} WHERE option_id = '{$option_id}'");
    foreach ($data['product_options_values_lng'] as $v) {
        if (!isset($ids[$v['option_id']])) {
            continue;
        }
        $v['option_id'] = $ids[$v['option_id']];
        $v = cw_addslashes($v);
        cw_array2insert("product_options_values_lng", $v, true);
    }
    # Detect and delete old product option class options
    $ids = cw_query_column("SELECT option_id FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND option_id NOT IN ('" . implode("','", $ids) . "')");
    if (!empty($ids)) {
        db_query("DELETE FROM {$tables['product_options_values']} WHERE product_option_id = '{$product_option_id}' AND option_id IN ('" . implode("','", $ids) . "')");
        db_query("DELETE FROM {$tables['product_options_values_lng']} WHERE option_id IN ('" . implode("','", $ids) . "')");
        db_query("DELETE FROM {$tables['products_options_ex']} WHERE option_id IN ('" . implode("','", $ids) . "')");
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:55,代码来源:modify-options.php

示例10: cw_error_check_state

function cw_error_check_state($state, $section, &$full)
{
    global $tables;
    $display_states = cw_query_first_cell("select display_states from {$tables['map_countries']} where code = '{$section['country']}'") == 'Y';
    if (!$display_states) {
        return false;
    }
    if (empty($state) || !cw_user_check_state($state, $section['country'])) {
        return true;
    }
    return false;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:cw.error.php

示例11: cw_ebay_get_condition_value

function cw_ebay_get_condition_value($var, $default_value)
{
    global $tables;
    if (isset($var['ebay_condition_id']) && is_numeric($var['ebay_condition_id'])) {
        $condition_value = cw_query_first_cell("SELECT value_key FROM {$tables['attributes_default']} WHERE attribute_value_id = " . $var['ebay_condition_id']);
        if (empty($condition_value)) {
            return $default_value;
        }
    } else {
        return $default_value;
    }
    return $condition_value;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:13,代码来源:func.php

示例12: cw_map_get_state_by_zip

/**
 * State lookup by zip
 * Table is loaded from csv with fields ZipCode,City,StateCode
 * SQL: load data local infile '/tmp/zip.txt' replace into table cw_map_zip fields terminated by ',' lines terminated by "\r\n" Ignore 1 lines;
 **/
function cw_map_get_state_by_zip($zip)
{
    global $tables;
    if (empty($zip)) {
        return '';
    }
    for ($i = strlen($zip); $i >= 2; $i--) {
        $state = cw_query_first_cell("SELECT state FROM {$tables['map_zip']} WHERE zip like '" . substr($zip, 0, $i) . "%'");
        if (!empty($state)) {
            return $state;
        }
    }
    return '';
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:19,代码来源:cw.map.php

示例13: cw_ps_bundle_show

function cw_ps_bundle_show($product_id)
{
    global $smarty, $tables, $config;
    $product_id = (int) $product_id;
    if (empty($product_id)) {
        return;
    }
    if ($_SERVER['REQUEST_METHOD'] != 'GET') {
        cw_ps_bundle_redirect($product_id);
    }
    $offer_id = cw_query_first_cell("SELECT offer_id FROM {$tables['ps_offers']} WHERE pid='{$product_id}' AND active='1'");
    $product_offer = cw_call('cw_ps_offer', array($offer_id));
    unset($product_offer['conditions']['P']['products'][$product_id]);
    $smarty->assign('product_offer', $product_offer);
    return $product_offer;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:16,代码来源:product_modify.php

示例14: cw_session_start

function cw_session_start($sess_id = '')
{
    global $APP_SESSION_VARS, $APP_SESS_ID;
    global $tables, $config;
    # $sess_id should contain only '0'..'9' or 'a'..'z' or 'A'..'Z'
    if (strlen($sess_id) > 32 || !empty($sess_id) && !preg_match('!^[0-9a-zA-Z]+$!S', $sess_id)) {
        $sess_id = '';
    }
    $APP_SESSION_VARS = array();
    $l = 0;
    if (isset($_SERVER['REMOTE_PORT'])) {
        $l = $_SERVER['REMOTE_PORT'];
    }
    list($usec, $sec) = explode(' ', microtime());
    srand((double) $sec + (double) $usec * 1000000 + (double) $l);
    $curtime = cw_core_get_time();
    $expiry_time = $curtime + USE_SESSION_LENGTH;
    if ($sess_id) {
        $sess_data = cw_query_first("select * from {$tables['sessions_data']} where sess_id='{$sess_id}' and expiry>{$curtime}");
        if (!$sess_data) {
            $sess_id = '';
        }
    }
    if (empty($sess_id)) {
        do {
            $sess_id = md5(uniqid(rand()));
            $already_exists = false;
            $already_exists = cw_query_first_cell("select count(*) from {$tables['sessions_data']} where sess_id='{$sess_id}'") > 0;
        } while ($already_exists);
    }
    if ($sess_data) {
        $APP_SESSION_VARS = unserialize($sess_data['data']);
    } else {
        if (!defined("NEW_SESSION")) {
            define("NEW_SESSION", true);
        }
        db_query("REPLACE INTO {$tables['sessions_data']} (sess_id, start, expiry, data) VALUES('{$sess_id}', '{$curtime}', '{$expiry_time}', '')");
    }
    $APP_SESS_ID = $sess_id;
    global $app_config_file;
    setcookie(APP_SESSION_NAME, $APP_SESS_ID, 0, with_leading_slash_only($app_config_file['web']['web_dir'], true), $app_config_file['web']['http_host'], 0);
    if ($app_config_file['web']['http_host'] != $app_config_file['web']['https_host']) {
        setcookie(APP_SESSION_NAME, $APP_SESS_ID, 0, with_leading_slash_only($app_config_file['web']['web_dir'], true), $app_config_file['web']['https_host'], 0);
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:45,代码来源:cw.session.php

示例15: cw_ppd_doc_change_status_C

function cw_ppd_doc_change_status_C($doc_data, $return)
{
    global $tables, $config;
    if (empty($doc_data) || !is_array($doc_data)) {
        return $return;
    }
    $doc_data['doc_id'] = (int) $doc_data['doc_id'];
    $_download_exists = cw_query_first_cell('SELECT download_id FROM ' . $tables['ppd_downloads'] . ' WHERE order_id = \'' . $doc_data['doc_id'] . '\'');
    if (!empty($_download_exists) || empty($doc_data['products'])) {
        return $return;
    }
    $values_for_ins = array();
    $data = array();
    $data['order_id'] = $doc_data['doc_id'];
    $data['customer_id'] = $doc_data['userinfo']['customer_id'];
    $data['allowed_number'] = (int) $config['ppd']['ppd_loading_attempts'];
    $data['counter'] = 0;
    $data['expiration_date'] = cw_core_get_time() + (int) $config['ppd']['ppd_link_lifetime'] * 60 * 60;
    foreach ($doc_data['products'] as $product) {
        $files = cw_query('SELECT file_id FROM ' . $tables['ppd_files'] . ' WHERE product_id = \'' . $product['product_id'] . '\' AND active = 1 AND perms_owner >= 4 AND perms_all = 0 ORDER BY number');
        if (empty($files) || !is_array($files)) {
            continue;
        }
        $data['product_id'] = $product['product_id'];
        foreach ($files as $file) {
            $data['file_id'] = $file['file_id'];
            $_replace_data = cw_query_first_cell('SELECT download_id FROM ' . $tables['ppd_downloads'] . ' WHERE product_id = \'' . $data['product_id'] . '\' AND file_id = \'' . $data['file_id'] . '\'');
            if (!empty($_replace_data)) {
                $data['download_id'] = $_replace_data;
                $query = 'REPLACE INTO ' . $tables['ppd_downloads'] . ' (`' . implode('`, `', array_keys($data)) . '`) VALUES ' . '(\'' . implode('\', \'', $data) . '\')';
                db_query($query);
                unset($data['download_id']);
                continue;
            }
            $values_for_ins[] = '(\'' . implode('\', \'', $data) . '\')';
        }
    }
    if (empty($values_for_ins)) {
        return $return;
    }
    $query = 'INSERT INTO ' . $tables['ppd_downloads'] . ' (`' . implode('`, `', array_keys($data)) . '`) VALUES ' . implode(', ', $values_for_ins);
    db_query($query);
    return $return;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:44,代码来源:func.hooks.php


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