本文整理汇总了PHP中get_package_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP get_package_goods函数的具体用法?PHP get_package_goods怎么用?PHP get_package_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_package_goods函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_cart_goods
/**
* 获得购物车中的商品
*
* @access public
* @return array
*/
function get_cart_goods()
{
/* 初始化 */
$goods_list = array();
$total = array('goods_price' => 0, 'market_price' => 0, 'saving' => 0, 'save_rate' => 0, 'goods_amount' => 0);
/* 循环、统计 */
$sql = "SELECT *, IF(parent_id, parent_id, goods_id) AS pid , goods_number " . " FROM " . $GLOBALS['ecs']->table('cart') . " " . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'" . " ORDER BY pid, parent_id";
// by Leah add goods_number
$res = $GLOBALS['db']->query($sql);
/* 用于统计购物车中实体商品和虚拟商品的个数 */
$virtual_goods_count = 0;
$real_goods_count = 0;
while ($row = $GLOBALS['db']->fetchRow($res)) {
$total['goods_price'] += $row['goods_price'] * $row['goods_number'];
$total['market_price'] += $row['market_price'] * $row['goods_number'];
$total['total_number'] += $row['goods_number'];
//by Leah
$row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false);
$row['goods_price'] = price_format($row['goods_price'], false);
$row['market_price'] = price_format($row['market_price'], false);
/* 统计实体商品和虚拟商品的个数 */
if ($row['is_real']) {
$real_goods_count++;
} else {
$virtual_goods_count++;
}
/* 查询规格 */
if (trim($row['goods_attr']) != '') {
$sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id " . db_create_in($row['goods_attr']);
$attr_list = $GLOBALS['db']->getCol($sql);
foreach ($attr_list as $attr) {
$row['goods_name'] .= ' [' . $attr . '] ';
}
}
/* 增加是否在购物车里显示商品图 */
if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy') {
$goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
$row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);
}
if ($row['extension_code'] == 'package_buy') {
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$goods_list[] = $row;
}
$total['goods_amount'] = $total['goods_price'];
$total['saving'] = price_format($total['market_price'] - $total['goods_price'], false);
if ($total['market_price'] > 0) {
$total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * 100 / $total['market_price']) . '%' : 0;
}
$total['goods_price'] = price_format($total['goods_price'], false);
$total['market_price'] = price_format($total['market_price'], false);
$total['real_goods_count'] = $real_goods_count;
$total['virtual_goods_count'] = $virtual_goods_count;
return array('goods_list' => $goods_list, 'total' => $total);
}
示例2: sprintf
$filename = ROOT_PATH . 'plugins/' . $row['extension_code'] . '/languages/common_' . $_CFG['lang'] . '.php';
if (file_exists($filename)) {
include_once $filename;
if (!empty($_LANG[$row['extension_code'] . '_link'])) {
$row['goods_name'] = $row['goods_name'] . sprintf($_LANG[$row['extension_code'] . '_link'], $row['goods_id'], $order['order_sn']);
}
}
}
$row['formated_subtotal'] = price_format($row['goods_price'] * $row['goods_number']);
$row['formated_goods_price'] = price_format($row['goods_price']);
$goods_attr[] = explode(' ', trim($row['goods_attr']));
//将商品属性拆分为一个数组
if ($row['extension_code'] == 'package_buy') {
$row['storage'] = '';
$row['brand_name'] = '';
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$goods_list[] = $row;
}
$attr = array();
$arr = array();
foreach ($goods_attr as $index => $array_val) {
foreach ($array_val as $value) {
$arr = explode(':', $value);
//以 : 号将属性拆开
$attr[$index][] = @array('name' => $arr[0], 'value' => $arr[1]);
}
}
$smarty->assign('goods_attr', $attr);
$smarty->assign('goods_list', $goods_list);
/* 取得能执行的操作列表 */
示例3: get_order_goods
function get_order_goods($order)
{
/* 取得订单商品及货品 */
$goods_list = array();
$goods_attr = array();
$sql = "SELECT o.*, IF(o.product_id > 0, p.product_number, g.goods_number) AS storage, o.goods_attr, o.goods_attr_id, g.suppliers_id, IFNULL(b.brand_name, '') AS brand_name, p.product_sn, a.attr_value,g.goods_thumb,g.goods_id \n FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o\n LEFT JOIN " . $GLOBALS['ecs']->table('products') . " AS p\n ON p.product_id = o.product_id\n LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g\n ON o.goods_id = g.goods_id\n LEFT JOIN " . $GLOBALS['ecs']->table('brand') . " AS b\n ON g.brand_id = b.brand_id\n\t\t\t\tLEFT JOIN " . $GLOBALS['ecs']->table('goods_attr') . " AS a\n ON o.goods_attr_id = a.goods_attr_id\n WHERE o.order_id = '{$order['order_id']}'";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
/* 虚拟商品支持 */
if ($row['is_real'] == 0) {
/* 取得语言项 */
$filename = ROOT_PATH . 'plugins/' . $row['extension_code'] . '/languages/common_' . $_CFG['lang'] . '.php';
if (file_exists($filename)) {
include_once $filename;
if (!empty($_LANG[$row['extension_code'] . '_link'])) {
$row['goods_name'] = $row['goods_name'] . sprintf($_LANG[$row['extension_code'] . '_link'], $row['goods_id'], $order['order_sn']);
}
}
}
$row['formated_subtotal'] = price_format($row['goods_price'] * $row['goods_number']);
$row['formated_goods_price'] = price_format($row['goods_price']);
$row['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$row['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods_attr[] = explode(' ', trim($row['goods_attr']));
//将商品属性拆分为一个数组
if ($row['extension_code'] == 'package_buy') {
$row['storage'] = '';
$row['brand_name'] = '';
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$goods_list[] = $row;
}
foreach ($goods_list as $goods_key => $goods_val) {
$sql_goods = "select bo.*,bg.product_id from " . $GLOBALS['ecs']->table('back_order') . " as bo " . " left join " . $GLOBALS['ecs']->table('back_goods') . " as bg " . " on bo.back_id = bg.back_id and bo.goods_id = bg.goods_id" . " where bo.order_id='{$order['order_id']}' and bo.goods_id='{$goods_val['goods_id']}' " . " and bg.product_id='{$goods_val['product_id']}' and bo.status_back < 6";
$back_order = $GLOBALS['db']->getRow($sql_goods);
$goods_list[$goods_key]['back_can'] = count($back_order['order_id']) > 0 ? '0' : '1';
switch ($back_order['status_back']) {
case '3':
$sb = "已完成";
break;
case '5':
$sb = "已申请";
break;
//case '6' : $sb = ""; break;
//case '7' : $sb = ""; break;
//case '6' : $sb = ""; break;
//case '7' : $sb = ""; break;
default:
$sb = "正在";
break;
}
switch ($back_order['back_type']) {
case '1':
$bt = "退货";
break;
case '3':
$bt = "申请维修";
break;
case '4':
$bt = "退款";
break;
default:
break;
}
$goods_list[$goods_key]['back_can_no'] = $sb . " " . $bt;
}
return $goods_list;
}
示例4: get_cart_goods
/**
* 获得购物车中的商品
*
* @access public
* @return array
*/
function get_cart_goods($other = '')
{
/* 初始化 */
$goods_list = array();
$total = array('goods_price' => 0, 'market_price' => 0, 'saving' => 0, 'save_rate' => 0, 'goods_amount' => 0);
/* 循环、统计 */
/* 代码增加_start By www.68ecshop.com */
$sql_where = $_SESSION['user_id'] > 0 ? "c.user_id='" . $_SESSION['user_id'] . "' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";
$sql = "SELECT c.*, g.supplier_id, IF(c.parent_id, c.parent_id, c.goods_id) AS pid " . " FROM " . $GLOBALS['ecs']->table('cart') . " AS c left join " . $GLOBALS['ecs']->table('goods') . " AS g " . " on c.goods_id=g.goods_id " . " WHERE {$sql_where} AND c.rec_type = '" . CART_GENERAL_GOODS . "' {$other} " . " ORDER BY pid, c.parent_id";
/* 代码增加_end By www.68ecshop.com */
$res = $GLOBALS['db']->query($sql);
/* 用于统计购物车中实体商品和虚拟商品的个数 */
$virtual_goods_count = 0;
$real_goods_count = 0;
while ($row = $GLOBALS['db']->fetchRow($res)) {
$total['goods_price'] += $row['goods_price'] * $row['goods_number'];
$total['market_price'] += $row['market_price'] * $row['goods_number'];
$row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false);
$row['goods_price'] = price_format($row['goods_price'], false);
$row['market_price'] = price_format($row['market_price'], false);
/* 统计实体商品和虚拟商品的个数 */
if ($row['is_real']) {
$real_goods_count++;
} else {
$virtual_goods_count++;
}
/* 查询规格 */
if (trim($row['goods_attr']) != '') {
$row['goods_attr'] = addslashes($row['goods_attr']);
$sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id " . db_create_in($row['goods_attr']);
$attr_list = $GLOBALS['db']->getCol($sql);
foreach ($attr_list as $attr) {
$row['goods_name'] .= ' [' . $attr . '] ';
}
}
/* 增加是否在购物车里显示商品图 */
if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy') {
$goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
$row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);
}
if ($row['extension_code'] == 'package_buy') {
$row['package_goods_list'] = get_package_goods($row['goods_id'], $row['package_attr_id']);
//修改 by www.ecshop68.com 增加一个变量
}
/* 代码增加_start By www.68ecshop.com */
$row['is_cansel'] = is_cansel($row['goods_id'], $row['product_id'], $row['package_buy']);
if ($row['supplier_id']) {
$supplier_name = $GLOBALS['db']->getOne("select supplier_name from " . $GLOBALS['ecs']->table('supplier') . " where supplier_id='" . $row['supplier_id'] . "' ");
$supplier_name = '供货商:' . $supplier_name;
} else {
$supplier_name = '网站自营';
}
$keyname = $row['supplier_id'] ? $row['supplier_id'] : '0';
$goods_list[$keyname]['goods_list'][] = $row;
$goods_list[$keyname]['supplier_name'] = $supplier_name;
ksort($goods_list);
//$goods_list[] = $row;
/* 代码修改_end By www.68ecshop.com */
}
$total['goods_amount'] = $total['goods_price'];
$total['saving'] = price_format($total['market_price'] - $total['goods_price'], false);
if ($total['market_price'] > 0) {
$total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * 100 / $total['market_price']) . '%' : 0;
}
$total['goods_price'] = price_format($total['goods_price'], false);
$total['market_price'] = price_format($total['market_price'], false);
$total['real_goods_count'] = $real_goods_count;
$total['virtual_goods_count'] = $virtual_goods_count;
return array('goods_list' => $goods_list, 'total' => $total);
}
示例5: db_create_in
}
if (!empty($goods)) {
$sql = "DELETE FROM " . $hhs->table('package_goods') . " WHERE package_id='{$package_id}' AND " . db_create_in($goods, 'goods_id');
if ($package_id == 0) {
$sql .= " AND admin_id = '{$_SESSION['admin_id']}'";
}
$db->query($sql);
}
if (!empty($g_p)) {
$sql = "DELETE FROM " . $hhs->table('package_goods') . " WHERE package_id='{$package_id}' AND " . db_create_in($g_p['goods_id'], 'goods_id') . " AND " . db_create_in($g_p['product_id'], 'product_id');
if ($package_id == 0) {
$sql .= " AND admin_id = '{$_SESSION['admin_id']}'";
}
$db->query($sql);
}
$arr = get_package_goods($package_id);
$opt = array();
foreach ($arr as $val) {
$opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => '');
}
clear_cache_files();
make_json_result($opt);
}
/**
* 获取活动列表
*
* @access public
*
* @return void
*/
function get_packagelist()
示例6: get_cart_goods
/**
* 获得购物车中的商品
*
* @access public
* @return array
*/
function get_cart_goods($type = '')
{
switch ($type) {
case 'buy_now':
$cart_table = 'cart_buy_now';
break;
default:
$cart_table = 'cart';
break;
}
/* 初始化 */
$goods_list = array();
$total = array('goods_price' => 0, 'market_price' => 0, 'saving' => 0, 'save_rate' => 0, 'goods_amount' => 0, 'goods_count' => 0);
/* 循环、统计 */
$sql = "SELECT *, IF(parent_id, parent_id, goods_id) AS pid " . " FROM " . $GLOBALS['ecs']->table($cart_table) . " " . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'" . " ORDER BY packageBuy_id asc, pid, parent_id";
$res = $GLOBALS['db']->query($sql);
/* 用于统计购物车中实体商品和虚拟商品的个数 */
$virtual_goods_count = 0;
$real_goods_count = 0;
$packageId = '';
$goodsListKey = 0;
while ($row = $GLOBALS['db']->fetchRow($res)) {
if ($row['packageBuy_id'] == $packageId && $row['packageBuy_id'] != 0) {
$row['packageBuy'] = 3;
if ($goodsListKey <= 0) {
die('error: array index is less than 0. location:lib_order.php ');
}
if ($goods_list[$goodsListKey - 1]['packageBuy'] == 3) {
$goods_list[$goodsListKey - 1]['packageBuy'] = 2;
}
} else {
if ($row['packageBuy_id'] != 0) {
$row['packageBuy'] = 1;
} else {
$row['packageBuy'] = 0;
}
}
$packageId = $row['packageBuy_id'];
$activityPrice = price_format(getGoodActivityPrice($row['goods_id']));
$row['goods_price'] = $activityPrice > 0 ? $activityPrice : $row['goods_price'];
$total['goods_price'] += $row['goods_price'] * $row['goods_number'];
$total['market_price'] += $row['market_price'] * $row['goods_number'];
$total['goods_count'] += $row['goods_number'];
$row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false);
$row['goods_price'] = price_format($row['goods_price'], false);
$row['market_price'] = price_format($row['market_price'], false);
/* 统计实体商品和虚拟商品的个数 */
if ($row['is_real']) {
$real_goods_count++;
} else {
$virtual_goods_count++;
}
/* 查询规格 */
if (trim($row['goods_attr']) != '') {
$sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id " . db_create_in($row['goods_attr']);
$attr_list = $GLOBALS['db']->getCol($sql);
foreach ($attr_list as $attr) {
$row['goods_name'] .= ' [' . $attr . '] ';
}
}
/* 增加是否在购物车里显示商品图 */
if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy') {
$goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
$row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);
}
if ($row['extension_code'] == 'package_buy') {
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$row['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
$goods_list[$goodsListKey++] = $row;
}
$total['goods_amount'] = $total['goods_price'];
$total['saving'] = price_format($total['market_price'] - $total['goods_price'], false);
if ($total['market_price'] > 0) {
$total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * 100 / $total['market_price']) . '%' : 0;
}
$total['goods_price'] = price_format($total['goods_price'], false);
$total['market_price'] = price_format($total['market_price'], false);
$total['real_goods_count'] = $real_goods_count;
$total['virtual_goods_count'] = $virtual_goods_count;
return array('goods_list' => $goods_list, 'total' => $total);
}
示例7: cart_goods_list
/**
* 取得购物车商品
* @param int $type 类型:默认普通商品
* @return array 购物车商品数组
*/
function cart_goods_list($type = CART_GENERAL_GOODS)
{
$sql = "SELECT a.rec_id, a.user_id, a.goods_id, a.goods_name, a.goods_sn, a.goods_number, " . "a.market_price, a.goods_price, a.goods_attr, a.is_real, a.extension_code, a.parent_id, a.is_gift, a.is_shipping, " . "a.goods_price * a.goods_number AS subtotal,b.goods_id,b.goods_thumb " . "FROM " . $GLOBALS['ecs']->table('cart') . "a," . $GLOBALS['ecs']->table('goods') . " b WHERE b.goods_id=a.goods_id and a.session_id = '" . SESS_ID . "' " . "AND a.rec_type = '{$type}'";
$arr = $GLOBALS['db']->getAll($sql);
/* 格式化价格及礼包商品 */
foreach ($arr as $key => $value) {
$arr[$key]['formated_market_price'] = price_format($value['market_price'], false);
$arr[$key]['formated_goods_price'] = price_format($value['goods_price'], false);
$arr[$key]['formated_subtotal'] = price_format($value['subtotal'], false);
if ($value['extension_code'] == 'package_buy') {
$arr[$key]['package_goods_list'] = get_package_goods($value['goods_id']);
}
}
return $arr;
}
示例8: GZ_order_goods
/**
* 取得订单商品
* @param int $order_id 订单id
* @return array 订单商品数组
*/
function GZ_order_goods($order_id)
{
$sql = "SELECT o.*, " . "o.goods_price * o.goods_number AS subtotal,g.goods_thumb,g.original_img,g.goods_img " . "FROM " . $GLOBALS['ecs']->table('order_goods') . " as o LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON o.goods_id = g.goods_id" . " WHERE o.order_id = '{$order_id}'";
$res = $GLOBALS['db']->query($sql);
while ($row = $GLOBALS['db']->fetchRow($res)) {
if ($row['extension_code'] == 'package_buy') {
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$goods_list[] = $row;
}
//return $GLOBALS['db']->getAll($sql);
return $goods_list;
}
示例9: get_order_list
public static function get_order_list($service_side = false)
{
//require(ROOT_PATH . 'includes/lib_order.php');
//require(ROOT_PATH . 'includes/lib_transaction.php');
$free_fork_pre_cake = 5;
$goods_list = array();
$total = array('goods_price' => 0, 'market_price' => 0, 'saving' => 0, 'save_rate' => 0, 'goods_amount' => 0);
/* 循环、统计 */
$sql = "SELECT *, IF(parent_id, parent_id, goods_id) AS pid " . " FROM " . $GLOBALS['ecs']->table('cart') . " " . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'" . " ORDER BY pid, parent_id";
$res = $GLOBALS['db']->query($sql);
/* 用于统计购物车中实体商品和虚拟商品的个数 */
$virtual_goods_count = 0;
$real_goods_count = 0;
while ($row = $GLOBALS['db']->fetchRow($res)) {
$total['goods_price'] += $row['goods_price'] * $row['goods_number'];
$total['market_price'] += $row['market_price'] * $row['goods_number'];
$row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false);
$row['goods_price'] = $row['goods_price'];
$row['market_price'] = price_format($row['market_price'], false);
$row['url'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
/* 统计实体商品和虚拟商品的个数 */
if ($row['is_real']) {
$real_goods_count++;
} else {
$virtual_goods_count++;
}
//增加是否在购物车里显示商品图
$goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'");
$row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true);
if ($row['extension_code'] == 'package_buy') {
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
//get number for weight!
$row['goods_attr_real'] = intval($row['goods_attr'], 10);
$row['free_fork'] = $row['goods_attr_real'] * $row['goods_number'] * $free_fork_pre_cake;
if ($_SESSION['extra_fork'][$row['goods_id']]) {
$row['extra_fork'] = $_SESSION['extra_fork'][$row['goods_id']];
} else {
$row['extra_fork'] = 0;
}
$goods_list[] = $row;
}
$total['goods_amount'] = $total['goods_price'];
$total['saving'] = price_format($total['market_price'] - $total['goods_price'], false);
if ($total['market_price'] > 0) {
$total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * 100 / $total['market_price']) . '%' : 0;
}
$total['goods_price'] = price_format($total['goods_price'], false);
$total['market_price'] = price_format($total['market_price'], false);
$total['real_goods_count'] = $real_goods_count;
$total['virtual_goods_count'] = $virtual_goods_count;
$cart_goods = array('goods_list' => $goods_list, 'total' => $total, 'order_total' => MES_Order::get_total_price_in_cart());
if ($service_side) {
return $cart_goods;
} else {
return json_encode($cart_goods);
}
}
示例10: get_cart_goodsex
function get_cart_goodsex()
{
$goods_list = array();
$total = array("goods_price" => 0, "market_price" => 0, "saving" => 0, "save_rate" => 0, "goods_amount" => 0);
$sql = "SELECT *, IF(parent_id, parent_id, goods_id) AS pid FROM " . $GLOBALS['ecs']->table("cart") . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "' ORDER BY pid, parent_id";
$res = $GLOBALS['db']->query($sql);
$virtual_goods_count = 0;
$real_goods_count = 0;
while ($row = $GLOBALS['db']->fetchRow($res)) {
$total['goods_price'] += $row['goods_price'] * $row['goods_number'];
$total['market_price'] += $row['market_price'] * $row['goods_number'];
$row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], FALSE);
$row['goods_price'] = price_format($row['goods_price'], FALSE);
$row['market_price'] = price_format($row['market_price'], FALSE);
if ($row['is_real']) {
++$real_goods_count;
} else {
++$virtual_goods_count;
}
if (trim($row['goods_attr']) != "") {
$sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table("goods_attr") . " WHERE goods_attr_id " . db_create_in($row['goods_attr']);
$attr_list = $GLOBALS['db']->getCol($sql);
foreach ($attr_list as $attr) {
$row['goods_name'] .= " [" . $attr . "] ";
}
}
if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != "package_buy") {
$goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table("goods") . (" WHERE `goods_id`='" . $row['goods_id'] . "'"));
$row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, TRUE);
}
if ($row['extension_code'] == "package_buy") {
$row['package_goods_list'] = get_package_goods($row['goods_id']);
}
$goods_list[] = $row;
}
$total['goods_amount'] = $total['goods_price'];
$total['saving'] = price_format($total['market_price'] - $total['goods_price'], FALSE);
if (0 < $total['market_price']) {
$total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * 100 / $total['market_price']) . "%" : 0;
}
$total['goods_price'] = price_format($total['goods_price'], FALSE);
$total['market_price'] = price_format($total['market_price'], FALSE);
$total['real_goods_count'] = $real_goods_count;
$total['virtual_goods_count'] = $virtual_goods_count;
return array("goods_list" => $goods_list, "total" => $total);
}