ecshop 批量删除购物车商品

1.添加checkbox复选框:在商品图片前面加一个

<input type="checkbox" name="subBox" id="subBox" value="{$goods.rec_id}" />

2.加上一段获取复选框id的代码

function group_drop_goods(){
        var id ="";
        $("[name='subBox']").each(function(){
                if($(this).attr("checked"))
                {
                    if(id){
                      id+=","+$(this).val();  
                    }else{
                        id+=""+$(this).val();  
                    }
                }
         })
         if(id){
             if(confirm('{$lang.drop_goods_confirm}')){
                location.href='flow.php?step=group_drop_goods&id='+id;
             }
         }else{
             alert('请选择需要删除的商品!');
         }

    }

3.在页面适当的位置加一个删除链接

<a class="pldelete" href="javascript:group_drop_goods()">批量删除</a>

4.在flow.php中加入如下代码:加在elseif ($_REQUEST['step'] == 'drop_goods')的上一行

elseif ($_REQUEST['step'] == 'group_drop_goods')
{
    $rec_ids = explode(',', $_GET['id']);
    foreach($rec_ids as $v){
        flow_drop_cart_goods($v);
    }
    ecs_header("Location: flow.php\n");
    exit;
}