Ejemplo n.º 1
0
			}

		}
	}

	$items = $cart->all();

	if(empty($items)){ //如果购物车为空,返回到首页
		header('location: index.php');
		exit;

	}


	//把购物车里的商品详细信息取出来,包括市场价,缩略图
	$items = $goods->getCartGoods($items);

	$total = $cart->getPrice(); //计算购物四中的商品总价格
	$market_total = 0.0;
	foreach($items as $v){ //计算市场总价
		$market_total += $v['market_price'] * $v['num'];
	}

	$discount = $market_total - $total; //计算差价
	$rate = round(100 * $discount / $total, 2); //节省计算百分比


	include(ROOT . 'view/front/jiesuan.html');

}else if($act == 'clear'){
	$cart->clear(); //清空购物车