public function cart () { /* 标记购物流程为普通商品 */ $_SESSION['flow_type'] = CART_GENERAL_GOODS; /* #如果是一步购物,跳到结算中心 if ($_CFG['one_step_buy'] == '1') { ecs_header("Location: flow.php?step=checkout\n"); exit; } */ #取得商品列表,计算合计 */ $cart_goods = get_cart_goods(); if(!$cart_goods) { $msg = rpcLang('flow.php', 'cartlist_empty'); jsonExit("{\"status\":\"$msg\",\"code\":\"1\"}"); } /* #显示收藏夹内的商品 if ($_SESSION['user_id'] > 0) { require_once(ROOT_PATH . 'includes/lib_clips.php'); $collection_goods = get_collection_goods($_SESSION['user_id']); $smarty->assign('collection_goods', $collection_goods); } */ #取得优惠活动 //$favourable_list = favourable_list($_SESSION['user_rank']); //usort($favourable_list, 'cmp_favourable'); #计算折扣 $discount = compute_discount(); /* #增加是否在购物车里显示商品图 $smarty->assign('show_goods_thumb', $GLOBALS['_CFG']['show_goods_in_cart']); #增加是否在购物车里显示商品属性 $smarty->assign('show_goods_attribute', $GLOBALS['_CFG']['show_attr_in_cart']); */ #购物车中商品配件列表,取得购物车中基本件ID $sql = "SELECT goods_id " ."FROM " . $GLOBALS['ecs']->table('cart') ." WHERE session_id = '" . SESS_ID . "' " . "AND rec_type = '" . CART_GENERAL_GOODS . "' AND is_gift = 0 AND extension_code <> 'package_buy' " . "AND parent_id = 0 "; $parent_list = $GLOBALS['db']->getCol($sql); $fittings_list = get_goods_fittings($parent_list); $cart_list = array( 'cart_goods' => $cart_goods, //'favourable_list' => $favourable_list, 'discount' => $discount, 'fittings_list' => $fittings_list ); //print_r($cart_list);die; jsonExit($cart_list); }
// 当前位置 $properties = get_goods_properties($goods_id); // 获得商品的规格和属性 $smarty->assign('properties', $properties['pro']); // 商品属性 $smarty->assign('specification', $properties['spe']); // 商品规格 $smarty->assign('attribute_linked', get_same_attribute_goods($properties)); // 相同属性的关联商品 $smarty->assign('related_goods', $linked_goods); // 关联商品 $smarty->assign('goods_article_list', get_linked_articles($goods_id)); // 关联文章 $smarty->assign('recommend_goods', get_recommend_goods('hot')); //获得相关推荐商品 $smarty->assign('fittings', get_goods_fittings(array($goods_id))); // 配件 $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price)); // 会员等级价格 $smarty->assign('pictures', get_goods_gallery($goods_id)); // 商品相册 //$smarty->assign('bought_goods', get_also_bought($goods_id)); // 购买了该商品的用户还购买了哪些商品 //$smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名 //$smarty->assign('related_cat', get_related_cat($goods['cat_id'])); //$smarty->assign('related_brand', get_related_brand($goods['cat_id'])); //$smarty->assign('top10_brand', get_top10_brand($goods['brand_id'])); //$smarty->assign('top10_category', get_top10($goods['cat_id'])); //$smarty->assign('top10_price', get_top10_price($goods['shop_price'])); //by mike start //组合套餐名 /*$comboTabIndex = array(' ','一', '二', '三','四','五','六','七','八','九','十');
usort($favourable_list, 'cmp_favourable'); $smarty->assign('favourable_list', $favourable_list); /* 计算折扣 */ $discount = compute_discount(); $smarty->assign('discount', $discount['discount']); $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); $smarty->assign('your_discount', sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount']))); /* 增加是否在购物车里显示商品图 */ $smarty->assign('show_goods_thumb', $GLOBALS['_CFG']['show_goods_in_cart']); /* 增加是否在购物车里显示商品属性 */ $smarty->assign('show_goods_attribute', $GLOBALS['_CFG']['show_attr_in_cart']); /* 购物车中商品配件列表 */ //取得购物车中基本件ID $sql = "SELECT goods_id " . "FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_type = '" . CART_GENERAL_GOODS . "' " . "AND is_gift = 0 " . "AND extension_code <> 'package_buy' " . "AND parent_id = 0 "; $parent_list = $GLOBALS['db']->getCol($sql); $fittings_list = get_goods_fittings($parent_list); $smarty->assign('fittings_list', $fittings_list); } $smarty->assign('currency_format', $_CFG['currency_format']); $smarty->assign('integral_scale', $_CFG['integral_scale']); $smarty->assign('step', $_REQUEST['step']); assign_dynamic('shopping_flow'); $smarty->display('flow.dwt'); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得用户的可用积分 * * @access private * @return integral
$smarty->assign('top10_brand', get_top10_brand($goods['brand_id'])); $smarty->assign('top10_category', get_top10($goods['cat_id'])); $smarty->assign('top10_price', get_top10_price($goods['shop_price'])); //by mike start //组合套餐名 $comboTabIndex = array(' ','一', '二', '三','四','五','六','七','八','九','十'); $smarty->assign('comboTab',$comboTabIndex); //组合套餐组 $fittings_list = get_goods_fittings(array($goods_id)); if(is_array($fittings_list)){ foreach($fittings_list as $vo){ $fittings_index[$vo['group_id']] = 1;//关联数组 } } ksort($fittings_index);//重新排序 $smarty->assign('fittings_tab_index', $fittings_index);//套餐数量 //by mike end //获取tag $tag_array = get_tags($goods_id); $smarty->assign('tags', $tag_array); // 商品的标记 //获取关联礼包 $package_goods_list = get_package_goods_list($goods['goods_id']);