ecshop 批量删除购物车商品

来源:互联网 发布:ug4.0杨师傅经典编程 编辑:程序博客网 时间:2024/05/01 02:40

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;}

转载自:http://www.9958.pw/post/ecshop_cart_delete

0 0
原创粉丝点击