Exemplo n.º 1
0
    exit;
} elseif ($_REQUEST['step'] == 'clear') {
    $sql = "DELETE FROM " . $ecs->table('cart') . " WHERE session_id='" . SESS_ID . "'";
    $db->query($sql);
    ecs_header("Location:./\n");
} elseif ($_REQUEST['step'] == 'drop_to_collect') {
    if ($_SESSION['user_id'] > 0) {
        $rec_id = intval($_GET['id']);
        $goods_id = $db->getOne("SELECT  goods_id FROM " . $ecs->table('cart') . " WHERE rec_id = '{$rec_id}' AND session_id = '" . SESS_ID . "' ");
        $count = $db->getOne("SELECT goods_id FROM " . $ecs->table('collect_goods') . " WHERE user_id = '{$_SESSION['user_id']}' AND goods_id = '{$goods_id}'");
        if (empty($count)) {
            $time = gmtime();
            $sql = "INSERT INTO " . $GLOBALS['ecs']->table('collect_goods') . " (user_id, goods_id, add_time)" . "VALUES ('{$_SESSION['user_id']}', '{$goods_id}', '{$time}')";
            $db->query($sql);
        }
        flow_drop_cart_goods($rec_id);
    }
    ecs_header("Location: flow.php\n");
    exit;
} elseif ($_REQUEST['step'] == 'validate_bonus') {
    $bonus_sn = trim($_REQUEST['bonus_sn']);
    if (is_numeric($bonus_sn)) {
        $bonus = bonus_info(0, $bonus_sn);
    } else {
        $bonus = array();
    }
    //    if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0)
    //    {
    //        die($_LANG['bonus_sn_error']);
    //    }
    //    if ($bonus['min_goods_amount'] > cart_amount())
Exemplo n.º 2
0
 * ============================================================================
 * 版权所有 2005-2008 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: zblikai $
 * $Id: flow.php 15632 2009-02-20 03:58:31Z zblikai $
 */
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
include_once 'includes/cls_json.php';
$result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '');
$json = new JSON();
flow_drop_cart_goods($_POST['id']);
$sql = 'SELECT c.*,g.goods_name,g.goods_thumb,g.goods_id,c.goods_number,c.goods_price' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " AS c " . " LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.goods_id=c.goods_id " . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
$row = $GLOBALS['db']->GetAll($sql);
$arr = array();
foreach ($row as $k => $v) {
    $arr[$k]['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]['shop_price'] = $v['goods_price'];
    $arr[$k]['rec_id'] = $v['rec_id'];
}
$sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . ' FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND rec_type = '" . CART_GENERAL_GOODS . "'";
$row = $GLOBALS['db']->GetRow($sql);
if ($row) {