當前位置: 首頁>>代碼示例>>PHP>>正文


PHP order::getUserCart方法代碼示例

本文整理匯總了PHP中order::getUserCart方法的典型用法代碼示例。如果您正苦於以下問題:PHP order::getUserCart方法的具體用法?PHP order::getUserCart怎麽用?PHP order::getUserCart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在order的用法示例。


在下文中一共展示了order::getUserCart方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 function __construct($params = array(), $get_assoc = true, $get_attached = false)
 {
     global $db, $user;
     if (!empty($params['id']) || is_numeric($params)) {
         parent::__construct($params, $get_assoc, $get_attached);
         $prodtype = $this->product_type;
         $this->product = new $prodtype($this->product_id, false, true);
     } elseif (isset($params['product_id']) && isset($params['product_type'])) {
         // see if this is an existing item in the cart
         if (isset($params['orderid'])) {
             $order = new order($params['orderid']);
         } else {
             $order = order::getUserCart();
         }
         //adding lookup on price to acocomdate quantity discounts
         $where = 'orders_id=' . $order->id . ' AND product_id=' . $params['product_id'] . ' AND products_price=' . $params['products_price'] . " AND product_type='" . $params['product_type'] . "'";
         $where .= empty($params['options']) ? '' : " AND options='" . $params['options'] . "'";
         $where .= empty($params['user_input_fields']) ? '' : " AND user_input_fields='" . $params['user_input_fields'] . "'";
         $item = $db->selectObject($this->table, $where);
         $this->product = new $params['product_type']($params['product_id'], false, true);
         if (empty($item)) {
             parent::__construct(array('orders_id' => $order->id, 'user_id' => $user->id, 'product_id' => $this->product->id, 'product_type' => $params['product_type'], 'products_name' => $this->product->title, 'products_price' => $this->product->getBasePrice()), $get_assoc, $get_attached);
         } else {
             parent::__construct($item->id, $get_assoc, $get_attached);
             //$this->quantity = $this->product->incrementQuantity($this->quantity);
         }
     } else {
         parent::__construct(null, $get_assoc, $get_attached);
     }
     if (isset($this->options)) {
         $this->opts = expUnserialize($this->options);
     }
     if (!empty($this->user_input_fields)) {
         //$this->user_input_fields = expUnserialize($this->user_input_fields);
     }
 }
開發者ID:notzen,項目名稱:exponent-cms,代碼行數:36,代碼來源:orderitem.php

示例2: explode

$microtime_str = explode(' ', microtime());
$i_start = $microtime_str[0] + $microtime_str[1];
// Initialize the Exponent Framework
require_once 'exponent.php';
//active global timer if in DEVELOPMENT mode
if (DEVELOPMENT) {
    $timer = new expTimer();
}
// if the user has turned on sef_urls then we need to route the request, otherwise we can just
// skip it and default back to the old way of doing things.
$router->routeRequest();
// initialize this users cart if they have ecom installed.
// define whether or not ecom is enabled
if ($db->selectValue('modstate', 'active', 'module="storeController"')) {
    define('ECOM', 1);
    $order = order::getUserCart();
    // Create a globle store config
    // We're forcing the location. Global store setting will always have this loc
    $cfg->mod = "ecomconfig";
    $cfg->src = "@globalstoresettings";
    $cfg->int = "";
    $storeConfig = new expConfig($cfg);
} else {
    define('ECOM', 0);
}
if (isset($_GET['id']) && !is_numeric($_GET['id'])) {
    $_GET['id'] = intval($_GET['id']);
}
$section = $router->getSection();
if ($db->havedb) {
    $sectionObj = $router->getSectionObj($section);
開發者ID:notzen,項目名稱:exponent-cms,代碼行數:31,代碼來源:index.php


注:本文中的order::getUserCart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。