|
@@ -7,6 +7,8 @@
|
|
|
|
|
|
defined('InShopNC') or exit('Access Invalid!');
|
|
|
|
|
|
+require_once (BASE_ROOT_PATH . '/helper/goods_helper.php');
|
|
|
+
|
|
|
class cartControl extends mobileControl
|
|
|
{
|
|
|
public function __construct()
|
|
@@ -14,37 +16,76 @@ class cartControl extends mobileControl
|
|
|
parent::__construct();
|
|
|
}
|
|
|
|
|
|
- public function listOp()
|
|
|
+ public function listexOp()
|
|
|
{
|
|
|
$model_cart = Model('cart');
|
|
|
- $logic_buy_1 = logic('buy_1');
|
|
|
-
|
|
|
- $minest_cartid = intval(_GET['minest_cartid']);
|
|
|
+ $minest_cartid = intval($_GET['minest_cartid']);
|
|
|
|
|
|
$has_more = false;
|
|
|
- $page_size = $this->page_size();
|
|
|
+ $pages = 1;
|
|
|
+
|
|
|
if($_SESSION['is_login'] == 1)
|
|
|
{
|
|
|
+ $page_size = $this->page_size();
|
|
|
if($minest_cartid > 0) {
|
|
|
$condition = array('buyer_id'=>$_SESSION['member_id'],'cart_id' => array('lt',$minest_cartid));
|
|
|
+ $left = $model_cart->getCartListCount($condition);
|
|
|
+ $has_more = $left > $page_size;
|
|
|
+
|
|
|
+ $total = $model_cart->getCartListCount(array('buyer_id'=>$_SESSION['member_id']));
|
|
|
+ $pages = $this->pages($total);
|
|
|
} else {
|
|
|
$condition = array('buyer_id'=>$_SESSION['member_id']);
|
|
|
+ $total = $model_cart->getCartListCount(array('buyer_id'=>$_SESSION['member_id']));
|
|
|
+ $pages = $this->pages($total);
|
|
|
+ $has_more = $total > $page_size;
|
|
|
}
|
|
|
- $count = $this->getCartListCount($condition);
|
|
|
- $has_more = $count > $page_size;
|
|
|
+
|
|
|
$cart_list = $model_cart->listCart('db',$condition,$page_size);
|
|
|
} else {
|
|
|
$cart_list = $model_cart->listCart('Session');
|
|
|
}
|
|
|
|
|
|
- $cart_info = array();
|
|
|
+ $goods_ids = array();
|
|
|
+ $cart_infos = array();
|
|
|
foreach ($cart_list as $item) {
|
|
|
$cart_item['cart_id'] = intval($item['cart_id']);
|
|
|
$cart_item['goods_id'] = intval($item['goods_id']);
|
|
|
$cart_item['bl_id'] = intval($item['bl_id']);
|
|
|
$cart_item['goods_num'] = intval($item['goods_num']);
|
|
|
|
|
|
- $cart_info[] = $cart_item;
|
|
|
+ $goods_ids[] = intval($item['goods_id']);
|
|
|
+ $cart_infos[] = $cart_item;
|
|
|
+ }
|
|
|
+
|
|
|
+ $helper = new goods_helper();
|
|
|
+ $summaries = $helper->cart_summary($goods_ids,$related_goods);
|
|
|
+ $summary_list = $summaries['summary'];
|
|
|
+ if(!empty($related_goods)) {
|
|
|
+ $related_summary = $helper->cart_summary($goods_ids,$x);
|
|
|
+ $summary_list = array_merge($summary_list,$related_summary['summary']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $ret['cart_list'] = $cart_infos;
|
|
|
+ $ret['goods_list'] = $summary_list;
|
|
|
+ $ret['groupbuy'] = $summaries['groupbuy'];
|
|
|
+ $ret['limitime'] = $summaries['limitime'];
|
|
|
+ $ret['bundling'] = $summaries['bundling'];
|
|
|
+ $ret['mobile_page'] = array('hasmore' => $has_more,'page_total' => $pages);
|
|
|
+
|
|
|
+ return self::outsuccess($ret);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listOp()
|
|
|
+ {
|
|
|
+ $model_cart = Model('cart');
|
|
|
+ $logic_buy_1 = logic('buy_1');
|
|
|
+
|
|
|
+ //购物车列表
|
|
|
+ if($_SESSION['is_login'] == 1) {
|
|
|
+ $cart_list = $model_cart->listCart('db',array('buyer_id'=>$_SESSION['member_id']));
|
|
|
+ } else {
|
|
|
+ $cart_list = $model_cart->listCart('Session',array('buyer_id'=>$_SESSION['member_id']));
|
|
|
}
|
|
|
|
|
|
//购物车列表 [得到最新商品属性及促销信息]
|
|
@@ -145,28 +186,6 @@ class cartControl extends mobileControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function format_cart($store_cart_list,$store_list,$mansong_rule_list,$free_freight_list)
|
|
|
- {
|
|
|
- $ret = array();
|
|
|
- foreach($store_cart_list as $key => $val)
|
|
|
- {
|
|
|
- $store_goods = array();
|
|
|
- $store_goods['store_info'] = $store_list[$key];
|
|
|
- $store_goods['free_freight'] = $free_freight_list[$key];
|
|
|
- $store_goods['mansong_rule'] = $mansong_rule_list[$key];
|
|
|
-
|
|
|
- $store_goods['goods_info'] = array();
|
|
|
- foreach($val as $index => $goods) {
|
|
|
- $this->remove_goods($goods);
|
|
|
- array_push($store_goods['goods_info'],$goods);
|
|
|
- }
|
|
|
-
|
|
|
- array_push($ret,$store_goods);
|
|
|
- }
|
|
|
-
|
|
|
- return $ret;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 购物车列表
|
|
|
*/
|