示例#1
0
function insert_cart_data()
{
    $cart = get_cart_data();
    $list = $cart['goods_list'];
    $total = $cart_goods['total'];
    $str = '';
    if ($list) {
        $total_price = 0;
        $str .= '<ul id="JS_header_cart" class="cartUL">';
        foreach ($list as $item) {
            if ($item['extension_code'] == 'package_buy') {
                $index = 1;
                foreach ($item['package_goods_list'] as $packitem) {
                    if ($index == 1) {
                        $img_src = get_goods_thumb($packitem['goods_id']);
                    }
                    $index = $index + 1;
                }
            } else {
                $img_src = $item['goods_thumb'] == '' ? 'themes/meilele/images/blank.gif' : $item['goods_thumb'];
            }
            $str .= '<li id="JS_cart_list_index_0">
              <div class="tImg"><a href="goods.php?id=' . $item['goods_id'] . '" target="_blank" title="' . $item['short_name'] . '"><img src="' . $img_src . '" alt="' . $item['short_name'] . '" height="86" width="86"></a></div>
              <div class="gInfo">
                <p class="gn"><a href="goods.php?id=' . $item['goods_id'] . '" target="_blank" title="' . $item['short_name'] . '">' . $item['short_name'] . '</a></p>
                <p class="gt"><strong class="Left"><span class="cl yen"><span id="JS_danjia0">' . $item['goods_price'] . '</span></span>×' . $item['goods_number'] . '</strong><a class="Right" href="javascript:drop_cart_goods(\'' . $item['rec_id'] . '\');" data-index="0" data-recid="9136371" data-num="1">删除</a></p>

              </div>
            </li>';
            $total_price = $total_price + $item['total_price'];
        }
        $total_price = price_format($total_price, false);
        $str .= '</ul>
				<div class="cartDiv clearfix">
            <p class="totaoFee">共<strong class="red f14" id="JS_num">' . insert_cart_count() . '</strong>件商品,共计<strong class="yen red num"><span id="JS_total">' . $total_price . '</span></strong></p>
            <div class="clearfix"><a class="toPay" href="flow.php">立刻购买</a></div>
          </div>';
    } else {
        $str = '<div class="loadLay" style="color:#626262;">您的购物车中还没有商品,先去选购吧!</div>';
    }
    return $str;
}
示例#2
0
文件: flow.php 项目: qgz/ecshop
        }
        $result['total_price'] = $cart_goods['total']['goods_price'];
        die($json->encode($result));
    } else {
        $result['error'] = 100;
        $result['message'] = '';
        die($json->encode($result));
    }
} elseif ($_REQUEST['step'] == 'drop_cart_goods') {
    include_once 'includes/cls_json.php';
    $rec_id = intval($_GET['id']);
    flow_drop_cart_goods($rec_id);
    $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '');
    $json = new JSON();
    $result['message'] = insert_cart_data();
    $result['goods_num'] = insert_cart_count();
    die($json->encode($result));
    exit;
} elseif ($_REQUEST['step'] == 'add_to_cart1') {
    include_once 'includes/cls_json.php';
    $_POST['goods'] = json_str_iconv($_POST['goods']);
    if (!empty($_REQUEST['goods_id']) && empty($_POST['goods'])) {
        if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) {
            ecs_header("Location:./\n");
        }
        $goods_id = intval($_REQUEST['goods_id']);
        exit;
    }
    $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => '');
    $json = new JSON();
    if (empty($_POST['goods'])) {