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


PHP CGlobal::cart_sess_id方法代码示例

本文整理汇总了PHP中CGlobal::cart_sess_id方法的典型用法代码示例。如果您正苦于以下问题:PHP CGlobal::cart_sess_id方法的具体用法?PHP CGlobal::cart_sess_id怎么用?PHP CGlobal::cart_sess_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGlobal的用法示例。


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

示例1: isset

 function __construct()
 {
     Form::Form('HeaderForm');
     if (User::have_permit(ADMIN_LOGO)) {
         $this->link_css('style/aznet/ui.datepicker.css');
         $this->link_js('javascript/jquery/ui.datepicker.js');
     }
     if (User::is_login() && User::level()) {
         $this->link_header("<script>MM_preloadImages('style/images/newCart/icon_del.gif','style/images/newCart/Mua.png');</script>");
     }
     // session session_id()
     CGlobal::$cart_sess_id = isset($_COOKIE['cart_sess_id']) ? $_COOKIE['cart_sess_id'] : '';
     if (CGlobal::$cart_sess_id) {
         AZLib::my_setcookie('cart_sess_id', session_id(), time() + 3600 * 24 * 365);
     }
     $this->link_js(FOLDER_JS . 'jquery.min.js');
     $this->link_js(FOLDER_JS . 'jquery-ui.js');
     $this->link_js(FOLDER_JS . 'jcarousellite_1.0.1c4.js');
     $this->link_js(FOLDER_JS . 'ui/jquery.ui.core.js');
     $this->link_js(FOLDER_JS . 'ui/jquery.ui.widget.js');
     $this->link_js(FOLDER_JS . 'ui/jquery.ui.tabs.js');
     $this->link_js('static/lightbox/js/jquery.lightbox-0.5.js');
     $this->link_js('static/adgallery/jquery.ad-gallery.js');
     $this->link_css(FOLDER_CSS . 'menu.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'sanpham.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'style.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'style_new.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'tintuc.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'trangchu.css@lang=vi-vn.css');
     $this->link_css(FOLDER_CSS . 'custom.css');
     $this->link_css(FOLDER_CSS . 'home.css');
     $this->link_css(FOLDER_CSS . 'base/jquery.ui.all.css');
     $this->link_css('static/lightbox/css/jquery.lightbox-0.5.css');
     $this->link_css('static/adgallery/jquery.ad-gallery.css');
 }
开发者ID:duynhan07,项目名称:elink,代码行数:35,代码来源:header.php

示例2: Cart

 function Cart($row)
 {
     Module::Module($row);
     if (Url::get('cmd') == 'success') {
         require_once 'forms/CartSuccess.php';
         $this->add_form(new CartSuccessForm());
         return;
     }
     Cart::$cart_item_ids = isset($_COOKIE['cart_items']) ? $_COOKIE['cart_items'] : '';
     if (CGlobal::$cart_sess_id == '') {
         CGlobal::$cart_sess_id = session_id();
         AZLib::my_setcookie('cart_sess_id', session_id(), time() + 3600 * 24 * 365);
     }
     $cart_items = '';
     Cart::$cart = DB::select("cart", "session='" . CGlobal::$cart_sess_id . "' AND status=1 ORDER BY id DESC");
     $cart_price = 0;
     $cart_quantity = 0;
     if (Cart::$cart) {
         $items = array();
         if (Cart::$cart_item_ids != '') {
             $re = DB::query("SELECT * FROM item WHERE id IN(" . Cart::$cart_item_ids . ") AND status=1 AND price>0 ORDER BY find_in_set(id,'" . Cart::$cart_item_ids . "')");
             if ($re) {
                 while ($item = mysql_fetch_assoc($re)) {
                     $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
                     Cart::$items[$item['id']] = $item;
                 }
             }
             $items = Cart::$items;
             $re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . Cart::$cart['id'] . " ORDER BY find_in_set(item_id,'" . Cart::$cart_item_ids . "')");
         } else {
             $re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . Cart::$cart['id'] . " ORDER BY id DESC");
         }
         $cart_item_del = '';
         if ($re) {
             while ($cart_item = mysql_fetch_assoc($re)) {
                 if (isset(Cart::$items[$cart_item['item_id']])) {
                     if ($cart_item['price'] != Cart::$items[$cart_item['item_id']]['price'] || $cart_item['sku'] != Cart::$items[$cart_item['item_id']]['sku']) {
                         $cart_item['price'] = Cart::$items[$cart_item['item_id']]['price'];
                         $cart_item['sku'] = Cart::$items[$cart_item['item_id']]['sku'];
                         DB::update('cart_item', array('price' => $cart_item['price'], 'sku' => $cart_item['sku']), "id={$cart_item['id']}");
                     }
                     if ($cart_item['checked']) {
                         $cart_price += $cart_item['price'] * $cart_item['quantity'];
                         $cart_quantity += $cart_item['quantity'];
                     }
                     unset($items[$cart_item['item_id']]);
                     $cart_items .= ($cart_items != '' ? ',' : '') . $cart_item['item_id'];
                     Cart::$cart_items[$cart_item['id']] = $cart_item;
                 } else {
                     $cart_item_del .= ($cart_item_del != '' ? ',' : '') . $cart_item['id'];
                 }
             }
         }
         if ($items) {
             foreach ($items as $item) {
                 $cart_items .= ($cart_items != '' ? ',' : '') . $item['id'];
                 $cart_item = array('cart_id' => Cart::$cart['id'], 'item_id' => $item['id'], 'sku' => $item['sku'], 'price' => $item['price'], 'quantity' => 1, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'time_add' => TIME_NOW, 'time_change' => TIME_NOW, 'status' => 1, 'checked' => 1);
                 $cart_item['id'] = DB::insert("cart_item", $cart_item);
                 $cart_price += $cart_item['price'];
                 $cart_quantity += 1;
                 Cart::$cart_items[$cart_item['id']] = $cart_item;
                 Cart::$items[$item['id']] = $item;
             }
         }
         if ($cart_item_del != '') {
             DB::delete('cart_item', "id IN({$cart_item_del})");
         }
     } elseif (Cart::$cart_item_ids != '') {
         Cart::$cart = array('session' => CGlobal::$cart_sess_id, 'ip' => $_SERVER['REMOTE_ADDR'], 'time_create' => TIME_NOW, 'time_change' => TIME_NOW, 'time_finish' => 0, 'time_finish' => 0, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'customer_name' => '', 'customer_email' => '', 'customer_phone' => '', 'customer_address' => '', 'customer_note' => '', 'note' => '', 'price' => 0, 'quantity' => 0, 'mm_user_id' => 0, 'mm_time_modify' => '', 'mm_user_name' => '', 'status' => 1);
         Cart::$cart['id'] = DB::insert("cart", Cart::$cart);
         $re = DB::query("SELECT * FROM item WHERE id IN(" . Cart::$cart_item_ids . ") AND status=1 AND price>0 ORDER BY find_in_set(id,'" . Cart::$cart_item_ids . "')");
         if ($re) {
             while ($item = mysql_fetch_assoc($re)) {
                 $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
                 $cart_items .= ($cart_items != '' ? ',' : '') . $item['id'];
                 $cart_item = array('cart_id' => Cart::$cart['id'], 'item_id' => $item['id'], 'sku' => $item['sku'], 'price' => $item['price'], 'quantity' => 1, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'time_add' => TIME_NOW, 'time_change' => TIME_NOW, 'status' => 1, 'checked' => 1);
                 $cart_price += $item['price'];
                 $cart_quantity += 1;
                 $cart_item['id'] = DB::insert("cart_item", $cart_item);
                 Cart::$cart_items[$cart_item['id']] = $cart_item;
                 Cart::$items[$item['id']] = $item;
             }
         }
     }
     if (Cart::$cart['price'] != $cart_price || Cart::$cart['quantity'] != $cart_quantity) {
         Cart::$cart['price'] = $cart_price;
         Cart::$cart['quantity'] = $cart_quantity;
         DB::update("cart", array('price' => $cart_price, 'quantity' => $cart_quantity), 'id=' . Cart::$cart['id']);
     }
     if ($cart_items != Cart::$cart_item_ids) {
         Cart::$cart_item_ids = $cart_items;
         AZLib::my_setcookie('cart_items', Cart::$cart_item_ids, time() + 3600 * 24 * 365);
     }
     $cmd = Url::get('cmd');
     switch ($cmd) {
         case 'delete':
             $id = Url::get('id', 0);
             if ($id && Cart::$cart && isset(Cart::$cart_items[$id])) {
                 //echo Cart::$cart_item_ids,"<br /><br />";
                 //echo "$id";
//.........这里部分代码省略.........
开发者ID:duynhan07,项目名称:elink,代码行数:101,代码来源:class.php


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