更改大商创立即购买【仿淘宝】
修改如下
在
/js/common.js
function addToCar(){
//找到
goods.quick = quick;
goods.spec = spec_arr;
goods.goods_id = goodsId;
goods.number = number;
在其下面增加一行
goods.liji=1;//立即购买
}
修改flow.php
找到
$_REQUEST['step'] == 'add_to_cart'
在其逻辑里修改
将
if ($_CFG['one_step_buy']) {
clear_cart();
}
修改为
$go_id=$goods->liji;
if ($_CFG['one_step_buy'] == '1' || $go_id==1) {
clear_cart1($goods->goods_id);
}
找到
if (addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent, $warehouse_id, $area_id, $goods->stages_qishu, $goods->store_id,
$goods->end_time, $goods->store_mobile))
修改为
if (addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent, $warehouse_id, $area_id, $goods->stages_qishu, $goods->store_id,
$goods->end_time, $goods->store_mobile,$goods->liji)) //即增加一个参数
在/includes/lib_order.php
找到
function clear_cart($type = CART_GENERAL_GOODS, $cart_value = '')
{
}
在其函数下增加一个新函数
function clear_cart1($goods_id)
{
if (!empty($_SESSION['user_id'])) {
$sess_id = ' user_id = \'' . $_SESSION['user_id'] . '\' ';
}
else {
$sess_id = ' session_id = \'' . real_cart_mac_ip() . '\' ';
}
$goodsIn = '';
if (!empty($cart_value)) {
$goodsIn = ' and rec_id in(' . $cart_value . ')';
}
$sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('cart') . ' WHERE goods_id='.$goods_id.' and ' . $sess_id . (' AND rec_type = \'' . $type .
'\'') . $goodsIn;
$GLOBALS['db']->query($sql);
if (!empty($_SESSION['user_id'])) {
$sess_id = ' user_id = \'' . $_SESSION['user_id'] . '\' ';
}
else {
$sess_id = ' user_id = \'' . real_cart_mac_ip() . '\' ';
}
}