1.添加checkbox複選框:在商品圖片前面加一個javascript
<input type="checkbox" name="subBox" id="subBox" value="{$goods.rec_id}" />
2.加上一段獲取複選框id的代碼php
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.在頁面適當的位置加一個刪除連接java
<a class="pldelete" href="javascript:group_drop_goods()">批量刪除</a>
4.在flow.php中加入以下代碼:加在elseif ($_REQUEST['step'] == 'drop_goods')的上一行post
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; }