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


PHP cw_core_get_time函数代码示例

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


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

示例1: cw_file_area_save

function cw_file_area_save($type, $for_customer_id, $data)
{
    global $tables, $customer_id, $var_dirs, $app_dir;
    $insert = array('customer_id' => $for_customer_id, 'by_customer_id' => $customer_id, 'filename' => $data['filename'], 'date' => cw_core_get_time(), 'md5' => md5(file_get_contents($data['file_path'])));
    if ($data['descr']) {
        $insert['descr'] = $data['descr'];
    }
    if ($data['id']) {
        $insert['id'] = $data['id'];
    }
    $file_id = cw_array2insert($type, $insert);
    if ($file_id) {
        $file_info = explode('.', $data['filename'], 2);
        $stored_file_name = $file_info[0] . '_' . $file_id . '.' . $file_info[1];
        $files_dir = $var_dirs['documents'] . '/' . $type;
        if (!is_dir($files_dir)) {
            @mkdir($files_dir);
        }
        $new_file_path = $files_dir . '/' . $stored_file_name;
        @copy($data['file_path'], $new_file_path);
        @unlink($data['file_path']);
        $new_file_path = cw_relative_path($new_file_path, $app_dir);
        db_query("update " . $tables[$type] . " set file_path='" . addslashes($new_file_path) . "' where file_id='{$file_id}'");
    }
    return $file_id;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:26,代码来源:cw.file_area.php

示例2: cw_system_messages_add

function cw_system_messages_add($code, $msg, $type = SYSTEM_MESSAGE_COMMON, $severity = SYSTEM_MESSAGE_INFO)
{
    global $tables;
    $code = mysql_real_escape_string($code);
    $msg = mysql_real_escape_string($msg);
    $type = intval($type);
    $existing = cw_query_first("SELECT code, hidden FROM {$tables['system_messages']} WHERE code='{$code}'");
    $data = array('date' => cw_core_get_time(), 'message' => $msg, 'type' => $type, 'severity' => $severity);
    if ($existing) {
        $ret = cw_array2update('system_messages', $data, "code='{$code}'");
    } else {
        $data['code'] = $code;
        $data['hidden'] = 0;
        $ret = cw_array2insert('system_messages', $data);
    }
    return $ret;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:17,代码来源:cw.system_messages.php

示例3: cw_aom_get_doc_storage

function cw_aom_get_doc_storage($type, $info = array(), $prefix = '', $special_info = array())
{
    $display_id = cw_doc_get_display_id($type);
    $usertype = 'C';
    if (in_array($type, array('P', 'Q', 'R'))) {
        $usertype = 'S';
    } elseif ($type == 'D') {
        $usertype = 'D';
    }
    $ret = array('doc_id' => 0, 'display_id' => $prefix . $display_id, 'prefix' => $prefix, 'display_doc_id' => $display_id, 'type' => $type, 'date' => cw_core_get_time(), 'status' => 'Q', 'info' => array('total' => 0), 'userinfo' => array('customer_id' => 0, 'usertype' => $usertype, 'current_address' => array('same_as_main' => 1)));
    if ($info) {
        $ret['info'] = array_merge($ret['info'], $info);
    }
    foreach ($special_info as $tbl => $fields) {
        $ret[$tbl] = $fields;
    }
    return $ret;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:18,代码来源:cw.aom.php

示例4: 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

示例5: cw_sections_get_featured

function cw_sections_get_featured($featured_type, $cat = 0, $info_type = 128)
{
    global $tables, $smarty;
    global $user_account, $current_area;
    if (empty($featured_type)) {
        $featured_type = 'featured_products';
    }
    $data = array();
    $data['flat_search'] = 1;
    $data['all'] = 1;
    $data['status'] = array(1);
    $table = $tables[$featured_type];
    $data['sort_condition'] = $table . ".product_order";
    $current_time = cw_core_get_time();
    $add_params = array();
    $add_params['query_joins'][$featured_type] = array('on' => "{$tables['products']}.product_id=" . $table . ".product_id AND " . $table . ".avail=1 AND " . $table . ".category_id='" . $cat . "'" . ($featured_type == 'featured_products' ? " and ({$table}.from_time <= {$current_time} or {$table}.from_time = 0) and ({$table}.to_time >={$current_time} or {$table}.to_time = 0)" : ''), 'is_inner' => 1);
    $data['where'] = $featured_type == 'featured_products' ? "{$table}.min_amount <= {$tables['products_warehouses_amount']}.avail" : '';
    list($products, $navigation) = cw_func_call('cw_product_search', array('data' => $data, 'user_account' => $user_account, 'current_area' => $current_area, 'info_type' => $info_type), $add_params);
    return $products;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:20,代码来源:cw.sections.php

示例6: cw_messages_create_new_message

function cw_messages_create_new_message($customer_id, $sender_name, $recipient_id, $recipient_email, $subject, $body, $conversation_id)
{
    global $config, $current_location;
    cw_load('email');
    // sent message (incoming folder)
    $new_message_id = cw_array2insert('messages', array('subject' => $subject, 'body' => $body, 'sender_id' => $customer_id, 'recipient_id' => $recipient_id, 'sending_date' => cw_core_get_time(), 'conversation_id' => !empty($conversation_id) ? $conversation_id : 0, 'conversation_customer_id' => $recipient_id));
    // duplicate for sent folder
    $current_conversation_id = !empty($conversation_id) ? $conversation_id : $new_message_id;
    $duplicate_message_id = cw_array2insert('messages', array('subject' => $subject, 'body' => $body, 'sender_id' => $customer_id, 'recipient_id' => $recipient_id, 'sending_date' => cw_core_get_time(), 'read_status' => 1, 'conversation_id' => $current_conversation_id, 'conversation_customer_id' => $customer_id, 'type' => 2, 'link_id' => $new_message_id));
    // unite message if they have not been united
    $data = array('link_id' => $duplicate_message_id);
    if (empty($conversation_id)) {
        $data['conversation_id'] = $new_message_id;
    }
    cw_array2update('messages', $data, "message_id = '{$new_message_id}'");
    // send notification email to recipient
    // notification is sent from system email and says about new received message from Sender at <sitename>
    $from = $config['Company']['site_administrator'];
    /*
        $mail_subject = "The notification of a new message";
        $mail_body = '<b>You have received a new message from "' . $sender_name . '" at <a href="' . $current_location . '">';
        $mail_body .= $config['Company']['company_name'] . '</a></b><br />';
        $mail_body .= '<b>Subject:</b> ' . $subject . '<br />';
        $mail_body .= '<b>Body:</b> ' . nl2br($body) . '<br />';
        $mail_body .= '<a href="' . $current_location . '/index.php?target=message_box&mode=new';
        $mail_body .= '&contact_id=' . $customer_id . '&conversation_id=' . $current_conversation_id . '">Link to reply</a><br />';
        cw_send_simple_mail($from, $recipient_email, $mail_subject, $mail_body);
    */
    global $smarty;
    $smarty->assign('sender_name', $sender_name);
    $smarty->assign('current_location', $current_location);
    $smarty->assign('config', $config);
    $smarty->assign('subject', $subject);
    $smarty->assign('body', $body);
    $smarty->assign('customer_id', $customer_id);
    $smarty->assign('recipient_id', $recipient_id);
    $smarty->assign('current_conversation_id', $current_conversation_id);
    $smarty->assign('new_message_id', $new_message_id);
    cw_call('cw_send_mail', array($from, $recipient_email, 'addons/messaging_system/mail/new_message_subj.tpl', 'addons/messaging_system/mail/new_message.tpl'));
    return $new_message_id;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:41,代码来源:cw.messages.php

示例7: cw_commit_sitemap

function cw_commit_sitemap()
{
    global $site_map_counter;
    global $file_counter;
    global $smarty, $tables;
    global $app_catalogs, $var_dirs;
    # kornev, commit google sitemap
    $site_map_name = $smarty->compile_dir . '/sitemap.xml';
    $files = array();
    for ($i = 1; $i <= $file_counter; $i++) {
        $tmp_filename = $smarty->compile_dir . '/sitemap' . $i . '.xml';
        $sitemap_file = $var_dirs['sitemap'] . '/sitemap' . $i . '.xml.gz';
        if (is_file($tmp_filename)) {
            @unlink($sitemap_file);
            @rename($tmp_filename, $site_map_name);
            exec($sql = "gzip -c " . $site_map_name . " > " . $sitemap_file);
            //        @unlink($site_map_name);
            $files[] = $sitemap_file;
        }
    }
    $tmp_filename = $smarty->compile_dir . '/sitemap_index.xml';
    $fp = fopen($tmp_filename, "w+");
    $str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<sitemapindex xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n";
    fwrite($fp, $str);
    $date = date("Y-m-d", cw_core_get_time());
    foreach ($files as $file) {
        $str = "<sitemap>\n<loc>" . $app_catalogs['customer'] . "/" . basename($file) . "</loc>\n<lastmod>" . $date . "</lastmod>\n</sitemap>\n";
        fwrite($fp, $str);
    }
    $str = "</sitemapindex>";
    fwrite($fp, $str);
    @rename($tmp_filename, $var_dirs['sitemap'] . '/sitemap_index.xml');
    # kornev, commit yahoo sitemap
    $tmp_filename_yahoo = $smarty->compile_dir . '/urllist.txt';
    @rename($tmp_filename_yahoo, $var_dirs['sitemap'] . '/urllist.txt');
    db_query("UPDATE {$tables['config']} SET value='" . time() . "' WHERE name='google_sitemap_date'");
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:37,代码来源:cw.seo.php

示例8: switch

     switch ($data['basic']['created']) {
         case 'this_month':
             $start = mktime(0, 0, 0, date("n"), 1, date("Y"));
             $end = cw_core_get_time();
             $where[] = "{$tables['docs']}.date >= '" . $start . "'";
             $where[] = "{$tables['docs']}.date <= '" . $end . "'";
             break;
         case 'this_week':
             $start = mktime(0, 0, 0, date("n"), date("j") - date("w"), date("Y"));
             $end = cw_core_get_time();
             $where[] = "{$tables['docs']}.date >= '" . $start . "'";
             $where[] = "{$tables['docs']}.date <= '" . $end . "'";
             break;
         case 'today':
             $start = mktime(0, 0, 0, date("n"), date("j"), date("Y"));
             $end = cw_core_get_time();
             $where[] = "{$tables['docs']}.date >= '" . $start . "'";
             $where[] = "{$tables['docs']}.date <= '" . $end . "'";
             break;
     }
 }
 if (!empty($data['basic']['status'])) {
     if (is_array($data['basic']['status'])) {
         $where[] = "{$tables['docs']}.status in ('" . implode("','", $data['basic']['status']) . "')";
     } else {
         $where[] = "{$tables['docs']}.status = '" . $data['basic']['status'] . "'";
     }
 }
 if (!empty($data['basic']['doc_id_start'])) {
     $where[] = "{$tables['docs']}.display_doc_id >= '" . $data['basic']['doc_id_start'] . "'";
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:31,代码来源:profit_reports.php

示例9: cw_accounting_create_supplier_amount

function cw_accounting_create_supplier_amount($doc_id, $product, $variant_id, $warehouse_customer_id, $supplier_customer_id, $source_pwa_id = 0)
{
    global $tables;
    $supplier_type = cw_query_first_cell("select customer_id from {$tables['customers']} where customer_id='{$supplier_customer_id}' and usertype='S'");
    if (!$supplier_customer_id || $supplier_customer_id != $supplier_type) {
        $supplier_customer_id = cw_query_first_cell("select supplier_customer_id from {$tables['products_supplied_amount']} where productcode='" . $product['productcode'] . "' and product_id='{$product['product_id']}'");
    }
    if ($source_pwa_id) {
        $record = cw_query_first("select * from {$tables['products_supplied_amount']} where pwa_id='{$source_pwa_id}'");
        unset($record['pwa_id']);
    }
    if (!$record) {
        $record = array('product_id' => $product['product_id'], 'productcode' => $product['productcode'], 'supplier_price' => $product['net_price'], 'discount' => $product['discount_formula'] ? $product['discount_formula'] : $product['discount'], 'price' => $product['price'], 'variant_id' => $variant_id);
    }
    $record = array_merge($record, array('doc_id' => $doc_id, 'item_id' => $product['item_id'], 'warehouse_customer_id' => $warehouse_customer_id, 'supplier_customer_id' => $supplier_customer_id, 'avail' => 0, 'avail_ordered' => 0, 'avail_ordered' => 0, 'avail_sold' => 0, 'avail_reserved' => 0, 'is_auto_calc' => $product['is_auto_calc'], 'date' => cw_core_get_time()));
    return cw_array2insert('products_supplied_amount', $record);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:17,代码来源:cw.accounting.php

示例10: cw_get_langvar_by_name

         $antibot_err = true;
     }
     if ($antibot_err) {
         $top_message['type'] = "E";
         $top_message['content'] = cw_get_langvar_by_name("msg_err_antibot");
         cw_header_location("index.php?target={$target}&survey_id=" . $survey_id);
     }
 }
 # Check if survey results is empty
 if (cw_is_survey_result_empty($data) || !is_array($data)) {
     $top_message['type'] = 'W';
     $top_message['content'] = cw_get_langvar_by_name("txt_survey_is_empty_message");
     cw_header_location("index.php?target={$target}&survey_id={$survey_id}");
 }
 # Save common data
 $query_data = array('survey_id' => $survey_id, 'date' => cw_core_get_time(), 'ip' => $CLIENT_IP, 'customer_id' => $fill_customer_id, 'code' => $current_language, 'from_mail' => empty($fill_user) ? "N" : "Y", 'as_result' => empty($fill_user) ? "" : $fill_user['as_result']);
 $survey_result_id = cw_array2insert("survey_results", $query_data);
 $quids = cw_query_hash("SELECT question_id, answers_type FROM {$tables['survey_questions']} WHERE survey_id = '{$survey_id}'", 'question_id', false);
 foreach ($data as $qid => $v) {
     $question = $quids[$qid];
     if (!$question) {
         continue;
     }
     $query_data = array('survey_result_id' => $survey_result_id, 'question_id' => $qid);
     if ($question['answers_type'] == 'N') {
         $query_data['comment'] = $v['comment'];
         cw_array2insert('survey_result_answers', $query_data);
     } else {
         $answers = cw_query_hash("SELECT answer_id, textbox_type FROM {$tables['survey_answers']} WHERE question_id = '{$qid}'", 'answer_id', false);
         if (empty($v['answers'])) {
             continue;
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:31,代码来源:customer_survey.php

示例11: cw_faq_create_rubrik

function cw_faq_create_rubrik($title, $parent_id, $ars_id = 0, $ars_type = '')
{
    global $tables;
    $to_insert = array();
    $to_insert['title'] = $title;
    $to_insert['date'] = cw_core_get_time();
    $to_insert['parent_id'] = $parent_id;
    $to_insert['ars_id'] = $ars_id;
    $to_insert['ars_type'] = $ars_type;
    $rubrik_id = cw_array2insert('faq_rubrik', $to_insert);
    cw_faq_update_path($rubrik_id);
    cw_faq_recalc_counters($rubrik_id);
    return $rubrik_id;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:14,代码来源:cw.faq.php

示例12: cw_discount_coupons_is_valid

function cw_discount_coupons_is_valid($coupon, $products)
{
    global $tables, $customer_id, $config;
    $my_coupon = cw_query_first("select * from {$tables['discount_coupons']} where coupon='{$coupon}' and status=1 AND expire>" . cw_core_get_time());
    # kornev, may be it's salesman discount
    $salesman_discount = false;
    if (!$my_coupon) {
        $my_coupon = cw_query_first("select * from {$tables['discount_coupons']} where coupon='{$coupon}' and status=1 and salesman_customer_id='{$customer_id}'");
        $salesman_discount = true;
    }
    if (!$my_coupon) {
        return 1;
    }
    if ($my_coupon['per_user']) {
        if (empty($cutomer_id)) {
            return 1;
        }
        $_times_used = cw_query_first_cell("select times_used from {$tables['discount_coupons_cutomer_id']} where coupon='{$coupon}' and cutomer_id='{$cutomer_id}'");
        if ($_times_used >= $my_coupon['times']) {
            return 5;
        }
    }
    if ($my_coupon['coupon_type'] == "percent" && $my_coupon['discount'] > 100) {
        return 1;
    }
    if ($my_coupon['product_id'] > 0) {
        $found = false;
        foreach ($products as $value) {
            if ($value['product_id'] == $my_coupon['product_id']) {
                $found = true;
            }
        }
        return $found ? 0 : 4;
    } elseif ($my_coupon['category_id'] > 0) {
        $found = false;
        $category_ids[] = $my_coupon['category_id'];
        if ($my_coupon['recursive']) {
            $category_ids[] = cw_category_get_path($my_coupon['category_id']);
        }
        if (!is_array($products)) {
            return 4;
        }
        if ($config['Appearance']['categories_in_products'] == '1') {
            foreach ($products as $value) {
                $product_categories = cw_query("SELECT category_id FROM {$tables['products_categories']} WHERE product_id='{$value['product_id']}'");
                $is_valid_product = false;
                foreach ($product_categories as $k => $v) {
                    if (in_array($v['category_id'], $category_ids)) {
                        $is_valid_product = true;
                        break;
                    }
                }
                if ($is_valid_product) {
                    $found = true;
                    break;
                }
            }
        }
        return $found ? 0 : 4;
    } else {
        $total = 0;
        if (!empty($products) && is_array($products)) {
            foreach ($products as $value) {
                $total += $value['price'] * $value['amount'];
            }
        }
        if ($total < $my_coupon['minimum']) {
            return 3;
        } else {
            return 0;
        }
    }
    return 0;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:74,代码来源:func.discount_coupons.php

示例13: cw_ps_get_customer_offers

function cw_ps_get_customer_offers(&$cart, &$products, $_user_info = array())
{
    global $tables, $domain_attributes, $addons, $smarty;
    static $offers_hash;
    if (empty($cart) || empty($products)) {
        return array();
    }
    global $customer_id, $user_info;
    $customer_zone = null;
    if (isset($customer_id) && !empty($customer_id)) {
        if (!isset($user_info) || empty($user_info)) {
            $user_info = cw_user_get_info($customer_id, 1);
        }
    } else {
        $user_info = $_user_info;
        if (empty($_user_info)) {
            $user_info = $cart['userinfo'];
        }
    }
    $customer_zone = cw_func_call('cw_cart_get_zone_ship', array('address' => $user_info['current_address'], 'type' => 'D'));
    list($_products, $_categories, $_manufacturers) = cw_ps_normalize_products($products);
    if (empty($_products) || empty($_categories)) {
        return array();
    }
    //$hash_key = md5(serialize($_products) . serialize($user_info));
    $shipping_address = array();
    $shipping_address_fields = array('country', 'state', 'zipcode', 'city', 'address');
    if (!isset($user_info) || empty($user_info)) {
        foreach ($shipping_address_fields as $field) {
            if (isset($user_info['current_address'][$field])) {
                $shipping_address[] = $user_info['current_address'][$field];
            }
        }
    }
    $hash_key = md5(serialize($_products) . serialize($shipping_address));
    if (!isset($offers_hash[$hash_key])) {
        $offers_hash[$hash_key] = array();
    } else {
        return $offers_hash[$hash_key];
    }
    $fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
    $fields = array("{$tables['ps_offers']}.offer_id");
    $offers = array();
    $from_tbls[] = 'ps_offers';
    if (isset($addons['multi_domains'])) {
        $conditions = cw_md_get_available_domains();
        if ($conditions !== false) {
            $query_joins['attributes_values'] = array('on' => "{$tables['ps_offers']}.offer_id = {$tables['attributes_values']}.item_id and {$tables['attributes_values']}.item_type = '" . PS_ATTR_ITEM_TYPE . "' and {$tables['attributes_values']}.attribute_id='" . $domain_attributes[PS_ATTR_ITEM_TYPE] . "' and {$tables['attributes_values']}.value in " . $conditions, 'is_inner' => 1);
        }
    }
    $query_joins['ps_bonuses'] = array('on' => "{$tables['ps_offers']}.offer_id = {$tables['ps_bonuses']}.offer_id", 'is_inner' => 1);
    $query_joins['ps_conditions'] = array('on' => "{$tables['ps_offers']}.offer_id = {$tables['ps_conditions']}.offer_id", 'is_inner' => 1);
    $where[] = "{$tables['ps_offers']}.enddate >= '" . cw_core_get_time() . "'";
    $where[] = "{$tables['ps_offers']}.active = '1'";
    $having[] = "COUNT({$tables['ps_bonuses']}.bonus_id) > 0";
    $having[] = "COUNT({$tables['ps_conditions']}.cond_id) > 0";
    $groupbys[] = "{$tables['ps_offers']}.offer_id";
    $orderbys[] = 'priority DESC';
    $orderbys[] = 'position';
    $_query_joins = $query_joins;
    $_where = $where;
    $_having = $having;
    $_groupbys = $groupbys;
    $_fields = $fields;
    // let's take offers suitable by date and domain
    $search_query = cw_db_generate_query($fields, $from_tbls, $query_joins, $where, $groupbys, $having, $orderbys);
    $offers = cw_query_hash($search_query, 'offer_id', false);
    if (empty($offers) || !is_array($offers)) {
        return array();
    }
    // let's take offers with the subtotal condition defined
    $offers_condition = "{$tables['ps_cond_details']}.offer_id IN ('" . implode("', '", array_keys($offers)) . "')";
    $fields = $from_tbls = $query_joins = $where = $groupbys = $having = $orderbys = array();
    $fields = array('offer_id');
    $from_tbls[] = 'ps_conditions';
    //TODO: update the code below
    //echo '<pre>', print_r($tmp_cart), '</pre>';
    $discounted_subtotal = 0;
    //if (!isset($cart['info']['discounted_subtotal'])) {
    //$cart['discounted_subtotal'] = 10;
    $tmp_cart = array();
    $products_warehouses = cw_cart_get_products_warehouses($products);
    if (!empty($products_warehouses) && is_array($products_warehouses)) {
        foreach ($products_warehouses as $warehouse_id) {
            $tmp_products = cw_get_products_by_warehouse($products, $warehouse_id);
            $result = cw_func_call('cw_cart_calc_single', array('cart' => $cart, 'products' => $tmp_products, 'userinfo' => $user_info, 'warehouse_id' => $warehouse_id));
            //echo '<pre>result: ', print_r($result), '</pre>';
            $tmp_cart = cw_func_call('cw_cart_summarize', array('res' => $result, 'warehouse_id' => $warehouse_id), $tmp_cart);
        }
        unset($tmp_products);
    } else {
        $warehouse_id = 0;
        $result = cw_func_call('cw_cart_calc_single', array('cart' => $cart, 'products' => $products, 'userinfo' => $user_info, 'warehouse_id' => $warehouse_id));
        $tmp_cart = cw_func_call('cw_cart_summarize', array('res' => $result, 'warehouse_id' => $warehouse_id), $tmp_cart);
    }
    if (!empty($tmp_cart) && is_array($tmp_cart)) {
        if (isset($tmp_cart['info']['discounted_subtotal'])) {
            $discounted_subtotal = $tmp_cart['info']['discounted_subtotal'];
            if ($tmp_cart['info']['discounted_subtotal'] > $tmp_cart['info']['subtotal']) {
                $discounted_subtotal = $tmp_cart['info']['subtotal'];
//.........这里部分代码省略.........
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:101,代码来源:func.ps.php

示例14: cw_query

            }
        }
        if ($message) {
            $message['products1'] = cw_query("\n\t\t\t\tSELECT product_id as id, product as name FROM {$tables['newsletter_products']}\n\t\t\t\tWHERE list_id = '{$list_id}' AND product_num = 1\n\t\t\t");
            $message['products2'] = cw_query("\n\t\t\t\tSELECT product_id as id, product as name FROM {$tables['newsletter_products']}\n\t\t\t\tWHERE list_id = '{$list_id}' AND product_num = 2\n\t\t\t");
            $smarty->assign('message', $message);
            $smarty->assign('messageid', $message['news_id']);
        }
        $smarty->assign('main', 'management');
    } else {
        $smarty->assign('main', 'details');
    }
} else {
    if (!isset($vertical_response_data['news']) || empty($vertical_response_data['news'])) {
        if (empty($vertical_response_data['time'])) {
            $vertical_response_data['time'] = cw_core_get_time();
            // lifetime
        }
        $result = cw_vertical_response_get_newslists();
        $vertical_response_data['news'] = true;
        if ($result) {
            $exist_list_id = array();
            foreach ($result as $item) {
                $exist_list_id[] = $item['id'];
                // if list exist
                if (cw_query_first_cell("SELECT list_id FROM {$tables['newslists']} WHERE list_id = '" . $item['id'] . "'")) {
                    // update it
                    cw_array2update('newslists', array('name' => $item['name'], 'descr' => $item['descr']), "list_id = '" . $item['id'] . "'");
                } else {
                    // add new list
                    $data = array();
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:31,代码来源:news.php

示例15: cw_salesman_get_target

 $target = cw_salesman_get_target($customer_id);
 $smarty->assign('current_level', $current_level);
 $smarty->assign('salesman_target', $target);
 $smarty->assign('salesman_reach', $target['target'] - $current_level);
 $smarty->assign('salesman_reached', cw_salesman_is_reached($customer_id));
 $premiums_selected = cw_salesman_is_selected($customer_id);
 $smarty->assign('salesman_selected', $premiums_selected);
 $smarty->assign('salesman_premiums', cw_salesman_get_premiums($customer_id, $current_language, " and active=1" . ($premiums_selected ? " and selected=1" : "")));
 if ($action == 'premiums' && !$premiums_selected && is_array($choosed_premium)) {
     foreach ($choosed_premium as $id => $val) {
         db_query("update {$tables['salesman_premiums']} set selected=1 where id='{$id}' and customer_id='{$customer_id}'");
     }
 }
 # kornev, select orders
 $previous_customer_id_date =& cw_session_register('previous_customer_id_date');
 $curtime = cw_core_get_time();
 $start_dates[] = $previous_customer_id_date;
 # Since last customer_id
 $start_dates[] = mktime(0, 0, 0, date("m", $curtime), date("d", $curtime), date("Y", $curtime));
 $start_week = $curtime - date("w", $curtime) * 24 * 3600;
 # Week starts since Sunday
 $start_dates[] = mktime(0, 0, 0, date("m", $start_week), date("d", $start_week), date("Y", $start_week));
 $start_dates[] = mktime(0, 0, 0, date("m", $curtime), 1, date("Y", $curtime));
 foreach ($start_dates as $start_date) {
     $date_condition = "and d.doc_info_id=di.doc_info_id and d.date>='{$start_date}' and d.date<='{$curtime}' and di.salesman_customer_id='{$customer_id}'";
     $orders['P'][] = cw_query_first_cell("select count(*) from {$tables['docs']} as d, {$tables['docs_info']} as di where d.type='O' and d.status='P' {$date_condition}");
     $orders['F'][] = cw_query_first_cell("select count(*) from {$tables['docs']} as d, {$tables['docs_info']} as di where d.type='O' and (d.status='F' OR d.status='D') {$date_condition}");
     $orders['I'][] = cw_query_first_cell("select count(*) from {$tables['docs']} as d, {$tables['docs_info']} as di where d.type='O' and d.status='I' {$date_condition}");
     $orders['Q'][] = cw_query_first_cell("select count(*) from {$tables['docs']} as d, {$tables['docs_info']} as di where d.type='O' and d.status='Q' {$date_condition}");
     $gross_total[] = price_format(cw_query_first_cell("select sum(total) from {$tables['docs']} as d, {$tables['docs_info']} as di where 1 {$date_condition}"));
     $total_paid[] = price_format(cw_query_first_cell("select sum(total) from {$tables['docs']} as d, {$tables['docs_info']} as di where (status='P' OR status='C') {$date_condition}"));
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:31,代码来源:index.php


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