7 Star 19 Fork 7

王东祥/HongYuDSC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
delete_wholesale_cart_goods.php 3.39 KB
一键复制 编辑 原始数据 按行查看 历史
鸿宇科技 提交于 2018-03-02 10:52 . Initial commit
<?php
/**
* ECSHOP 购物流程
* ============================================================================
* 版权所有 2005-2016 鸿宇科技有限公司,并保留所有权利。
* 网站地址: http://www.hongyuvip.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: markzhou $
*/
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
include_once('includes/cls_json.php');
require(dirname(__FILE__) . '/includes/lib_wholesale.php');
//ecmoban鸿宇 --zhuo start
if(!empty($_SESSION['user_id'])){
$sess_id = " user_id = '" . $_SESSION['user_id'] . "' ";
$c_sess = " c.user_id = '" . $_SESSION['user_id'] . "' ";
}else{
$sess_id = " session_id = '" . real_cart_mac_ip() . "' ";
$c_sess = " c.session_id = '" . real_cart_mac_ip() . "' ";
}
//ecmoban鸿宇 --zhuo end
$result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '','index'=>-1);
$result['index']=!empty($_POST['index'])?intval($_POST['index']):'0';
$json = new JSON;
if($_POST['id'])
{
$sql = 'DELETE FROM '.$GLOBALS['ecs']->table('wholesale_cart')." WHERE rec_id=".$_POST['id'];
$GLOBALS['db']->query($sql);
}
$sql = 'SELECT c.*,g.goods_thumb,g.goods_id,c.goods_number,c.goods_price, c.extension_code ' .
' FROM ' . $GLOBALS['ecs']->table('wholesale_cart') ." AS c ".
" LEFT JOIN ".$GLOBALS['ecs']->table('goods')." AS g ON g.goods_id=c.goods_id ".
" WHERE " .$c_sess;
$row = $GLOBALS['db']->GetAll($sql);
$arr = array();
foreach($row AS $k=>$v)
{
$arr[$k]['goods_thumb'] =get_image_path($v['goods_id'], $v['goods_thumb'], true);
$arr[$k]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($v['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $v['goods_name'];
$arr[$k]['url'] = build_uri('goods', array('gid' => $v['goods_id']), $v['goods_name']);
$arr[$k]['goods_number'] = $v['goods_number'];
$arr[$k]['goods_name'] = $v['goods_name'];
$arr[$k]['goods_price'] = price_format($v['goods_price']);
$arr[$k]['warehouse_id'] = $v['warehouse_id'];
$arr[$k]['area_id'] = $v['area_id'];
$arr[$k]['rec_id'] = $v['rec_id'];
$arr[$k]['goods_attr'] = array_values(get_goods_attr_array($v['goods_attr_id']));
}
$sql = 'SELECT COUNT(rec_id) AS cart_number, SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' .
' FROM ' . $GLOBALS['ecs']->table('wholesale_cart') .
" WHERE " . $sess_id;
$row = $GLOBALS['db']->GetRow($sql);
if ($row)
{
$cart_number = intval($row['cart_number']);
$number = intval($row['number']);
$amount = price_format(floatval($row['amount']));
}
else
{
$cart_number = 0;
$number = 0;
$amount = 0;
}
$result['cart_num'] = $cart_number;
$GLOBALS['smarty']->assign('str',$cart_number);
$GLOBALS['smarty']->assign('goods',$arr);
$GLOBALS['smarty']->assign('number', $number);
$GLOBALS['smarty']->assign('amount', $amount);
$result['content'] = $GLOBALS['smarty']->fetch('library/wholesale_cart_info.lbi');
$result['cart_content'] = $GLOBALS['smarty']->fetch('library/wholesale_cart_menu_info.lbi');
die($json->encode($result));
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/doney/HongYuDSC.git
git@gitee.com:doney/HongYuDSC.git
doney
HongYuDSC
HongYuDSC
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385