本文整理汇总了PHP中get_cart_goods函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cart_goods函数的具体用法?PHP get_cart_goods怎么用?PHP get_cart_goods使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_cart_goods函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: die
die($json->encode($result));
} elseif ($_REQUEST['act'] = 'done') {
/*------------------------------------------------------ */
//-- 完成所有订单操作,提交到数据库
/*------------------------------------------------------ */
include_once 'includes/lib_clips.php';
/* 检查购物车中是否有商品 */
$sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND parent_id = 0 AND is_gift = 0 AND rec_type = '{$flow_type}'";
if ($db->getOne($sql) == 0) {
$tips = '您的购物车中没有商品';
exit($tips);
}
/* 检查商品库存 */
/* 如果使用库存,且下订单时减库存,则减少库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) {
$cart_goods_stock = get_cart_goods();
$_cart_goods_stock = array();
foreach ($cart_goods_stock['goods_list'] as $value) {
$_cart_goods_stock[$value['rec_id']] = $value['goods_number'];
}
flow_cart_stock($_cart_goods_stock);
unset($cart_goods_stock, $_cart_goods_stock);
}
$consignee = get_consignee($_SESSION['user_id']);
$_POST['how_oos'] = isset($_POST['how_oos']) ? intval($_POST['how_oos']) : 0;
$_POST['card_message'] = isset($_POST['card_message']) ? htmlspecialchars($_POST['card_message']) : '';
$_POST['inv_type'] = !empty($_POST['inv_type']) ? htmlspecialchars($_POST['inv_type']) : '';
$_POST['inv_payee'] = isset($_POST['inv_payee']) ? htmlspecialchars($_POST['inv_payee']) : '';
$_POST['inv_content'] = isset($_POST['inv_content']) ? htmlspecialchars($_POST['inv_content']) : '';
$_POST['postscript'] = isset($_POST['postscript']) ? htmlspecialchars($_POST['postscript']) : '';
$order = array('shipping_id' => intval($_POST['shipping']), 'pay_id' => isset($_POST['payment']) ? intval($_POST['payment']) : '0', 'pack_id' => isset($_POST['pack']) ? intval($_POST['pack']) : 0, 'card_id' => isset($_POST['card']) ? intval($_POST['card']) : 0, 'card_message' => trim($_POST['card_message']), 'surplus' => isset($_POST['surplus']) ? floatval($_POST['surplus']) : 0.0, 'integral' => isset($_POST['integral']) ? intval($_POST['integral']) : 0, 'bonus_id' => isset($_POST['bonus']) ? intval($_POST['bonus']) : 0, 'need_inv' => empty($_POST['need_inv']) ? 0 : 1, 'inv_type' => $_POST['inv_type'], 'inv_payee' => trim($_POST['inv_payee']), 'inv_content' => $_POST['inv_content'], 'postscript' => trim($_POST['postscript']), 'how_oos' => isset($_LANG['oos'][$_POST['how_oos']]) ? addslashes($_LANG['oos'][$_POST['how_oos']]) : '', 'need_insure' => isset($_POST['need_insure']) ? intval($_POST['need_insure']) : 0, 'user_id' => $_SESSION['user_id'], 'add_time' => gmtime(), 'order_status' => OS_UNCONFIRMED, 'shipping_status' => SS_UNSHIPPED, 'pay_status' => PS_UNPAYED, 'agency_id' => get_agency_by_regions(array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district'])));
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:order.php
示例2: stripslashes
$result['error'] = $err->error_no;
$result['package_id'] = stripslashes($package->package_id);
}
}
$result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
die($json->encode($result));
} else {
/* 标记购物流程为普通商品 */
$_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();
$smarty->assign('goods_list', $cart_goods['goods_list']);
$smarty->assign('total', $cart_goods['total']);
//购物车的描述的格式化
$smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']));
$smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']));
// 显示收藏夹内的商品
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');
$smarty->assign('favourable_list', $favourable_list);
开发者ID:will0306,项目名称:bianli100,代码行数:31,代码来源:flow.php
示例3: empty
if (is_array($discount)) {
$favour_name = empty($discount['name']) ? '' : join(',', $discount['name']);
$result['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount']));
}
//如果有优惠价格,获得商品最终价格
$shop_price = get_final_price($goods_id, $number, true, $attr_id);
$sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_price = '{$shop_price}' WHERE rec_id = {$rec_id}";
$GLOBALS['db']->query($sql);
$subtotal = $shop_price * $number;
$result['goods_price'] = price_format($shop_price, false);
//$subtotal = $GLOBALS['db']->getONE("select goods_price * goods_number AS subtotal from ".$GLOBALS['ecs']->table('cart')." where rec_id = $rec_id");
$result['subtotal'] = price_format($subtotal, false);
//$result['cart_amount_desc'] = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']);
/* 取得商品列表,计算合计 */
$id_ext = " AND rec_id in (" . $_GET['sel_goods'] . ") ";
$cart_goods = get_cart_goods($id_ext);
//$cart_goods = get_cart_goods();
$result['cart_amount_desc'] = $cart_goods['total']['goods_price'];
$shopping_money = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']);
$result['market_amount_desc'] = $shopping_money;
if ($_CFG['show_marketprice']) {
$market_price_desc = sprintf($_LANG['than_market_price'], $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']);
$result['market_amount_desc'] .= "," . $market_price_desc;
}
die($json->encode($result));
}
if ($_REQUEST['step'] == 'cart') {
$smarty->assign('template_dir', $GLOBALS['_CFG']['template']);
$hotgoods_list = cart_goods_recommend('is_hot');
$smarty->assign('hotgoods_list', $hotgoods_list);
$bestgoods_list = cart_goods_recommend('is_best');
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:flow.php
示例4: done
public function done () {
global $ecs,$db,$_CFG;
include_once(RPC_ROOT.'includes/lib_clips_ec.php');
include_once(RPC_ROOT.'includes/lib_payment.php');
/* 取得购物类型 */
$flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
/* 检查购物车中是否有商品 */
$sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') ." WHERE session_id = '" . SESS_ID . "' " .
"AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'";
if ($db->getOne($sql) == 0)
{
$msg = rpcLang('flow.php', 'no_goods_in_cart');
jsonExit("{\"status\":\"$msg\"}");
}
/* 检查商品库存,如果使用库存,且下订单时减库存,则减少库存 */
if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE)
{
$cart_goods_stock = get_cart_goods();
$_cart_goods_stock = array();
foreach ($cart_goods_stock['goods_list'] as $value)
{
$_cart_goods_stock[$value['rec_id']] = $value['goods_number'];
}
zy_flow_cart_stock($_cart_goods_stock);
unset($cart_goods_stock, $_cart_goods_stock);
}
/*
* 检查用户是否已经登录
* 如果用户已经登录了则检查是否有默认的收货地址
* 如果没有登录则跳转到登录和注册页面
*/
if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0)
{
/* 用户没有登录且没有选定匿名购物,转向到登录页面 */
$msg = rpcLang('user.php', 'nologin');
jsonExit("{\"status\":\"$msg\"}");
}
$consignee = get_consignee($_SESSION['user_id']);
/* 检查收货人信息是否完整 */
if (!check_consignee_info($consignee, $flow_type))
{
$msg = rpcLang('flow.php', 'user_address_not_full');
jsonExit("{\"status\":\"$msg\"}");
}
$_GET['how_oos'] = isset($_GET['how_oos']) ? intval($_GET['how_oos']) : 0;
$_GET['card_message'] = isset($_GET['card_message']) ? htmlspecialchars($_GET['card_message']) : '';
$_GET['inv_type'] = !empty($_GET['inv_type']) ? htmlspecialchars($_GET['inv_type']) : '';
$_GET['inv_payee'] = isset($_GET['inv_payee']) ? htmlspecialchars($_GET['inv_payee']) : '';
$_GET['inv_content'] = isset($_GET['inv_content']) ? htmlspecialchars($_GET['inv_content']) : '';
$_GET['postscript'] = isset($_GET['postscript']) ? htmlspecialchars($_GET['postscript']) : '';
$referer = empty($_GET['referer']) ? 'Android':trim($_GET['referer']);
$order = array(
//'shipping_id' => intval($_POST['shipping']),
'shipping_id' => intval($_GET['shipping']),//快递id
'pay_id' => intval($_GET['payment']),//支付方式id
'pack_id' => isset($_GET['pack']) ? intval($_GET['pack']) : 0,//包装
'card_id' => isset($_GET['card']) ? intval($_GET['card']) : 0,//贺卡
'card_message' => trim($_GET['card_message']),
'surplus' => isset($_POST['surplus']) ? floatval($_POST['surplus']) : 0.00,
'integral' => isset($_POST['integral']) ? intval($_POST['integral']) : 0,
'bonus_id' => isset($_GET['bonus']) ? intval($_GET['bonus']) : 0,
'need_inv' => empty($_POST['need_inv']) ? 0 : 1,
'postscript' => trim($_POST['postscript']),
'how_oos' => isset($_LANG['oos'][$_POST['how_oos']]) ? addslashes($_LANG['oos'][$_POST['how_oos']]) : '',
'need_insure' => isset($_POST['need_insure']) ? intval($_POST['need_insure']) : 0,
'user_id' => $_SESSION['user_id'],
'add_time' => gmtime(),
'order_status' => OS_UNCONFIRMED,
'shipping_status' => SS_UNSHIPPED,
'pay_status' => PS_UNPAYED,
'agency_id' => get_agency_by_regions(array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']))
);
if(EC_CHARSET == 'utf-8'){
$order['inv_type'] = gbktoutf8($_GET['inv_type']);
$order['inv_payee'] = gbktoutf8(trim($_GET['inv_payee']));
$order['inv_content'] = gbktoutf8($_GET['inv_content']);
}else{
$order['inv_type'] = utf8togbk($_GET['inv_type']);
$order['inv_payee'] = utf8togbk(trim($_GET['inv_payee']));
$order['inv_content'] = utf8togbk($_GET['inv_content']);
}
/* 扩展信息 */
if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS)
{
$order['extension_code'] = $_SESSION['extension_code'];
$order['extension_id'] = $_SESSION['extension_id'];
}
else
{
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:mdwp,代码行数:101,代码来源:flow.action.php
示例5: insert_right_cart_info
/**
* 调用购物车信息
*
* @access public
* @return string
*/
function insert_right_cart_info()
{
require_once ROOT_PATH . 'includes/lib_order.php';
$GLOBALS['smarty']->caching = false;
$GLOBALS['smarty']->force_compile = true;
$GLOBALS['smarty']->caching = false;
$GLOBALS['smarty']->force_compile = true;
$sql = 'SELECT SUM(goods_number) AS number' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
$cart_goods_number = $GLOBALS['db']->getOne($sql);
$GLOBALS['smarty']->assign('cart_goods_number', $cart_goods_number);
/* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
$GLOBALS['smarty']->assign('goods_list', $cart_goods['goods_list']);
$GLOBALS['smarty']->assign('total', $cart_goods['total']);
$val = $GLOBALS['smarty']->fetch('library/right_cart_info.lbi');
$GLOBALS['smarty']->caching = $need_cache;
$GLOBALS['smarty']->force_compile = $need_compile;
return $val;
}
开发者ID:songtaiwu,项目名称:m-cmsold,代码行数:25,代码来源:lib_insert.php
示例6: mt_rand
$smarty->assign('enabled_login_captcha', 1);
$smarty->assign('rand', mt_rand());
}
if ($captcha & CAPTCHA_REGISTER) {
$smarty->assign('enabled_register_captcha', 1);
$smarty->assign('rand', mt_rand());
}
/* 如果是一步购物,跳到结算中心 */
/*if ($_CFG['one_step_buy'] == '1')
{
ecs_header("Location: flow.php?step=checkout\n");
exit;
}*/
$buyType == ($_REQUEST['buyType'] == 'buy_now') ? 'buy_now' : '';
/* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods($buyType);
/******套餐购的折扣*******/
$packageBuyDiscountMoney = price_format(packageBuyDiscountMoney($cart_goods['goods_list']));
$smarty->assign('packageBuyDiscountMoney', $packageBuyDiscountMoney);
$getPackageBuyDiscount = intval(10 * getPackageBuyDiscount());
$smarty->assign('packageBuyDiscount', $getPackageBuyDiscount);
/******活动的折扣*******/
$smarty->assign('goods_list', $cart_goods['goods_list']);
$smarty->assign('total', $cart_goods['total']);
$smarty->assign('total_goods_price', $cart_goods['total']['goods_price']);
$smarty->assign('total_saving', $cart_goods['total']['saving']);
//购物车的描述的格式化
$smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']));
$smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']));
// 显示收藏夹内的商品
if ($_SESSION['user_id'] > 0) {
开发者ID:norain2050,项目名称:benhu,代码行数:31,代码来源:flow.php
注:本文中的get_cart_goods函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论