简体   繁体   English

从magento的购物车中删除选定的项目

[英]remove selected items from shopping cart in magento

<script>
    function getValueUsingClass(){
       /* declare an checkbox array */
       var chkArray = [];

       /* look for all checkboes that have a class 'chk' attached to it and check if it was checked */
       $(".chk:checked").each(function() {
           chkArray.push($(this).val());
       });

       /* we join the array separated by the comma */
       var selected;
       selected = chkArray.join(',') + ",";

       /* check if there is selected checkboxes, by default the length is 1 as it contains one single comma */
       if(selected.length > 1){
          alert("You have selected " + selected);   
       }else{
          alert("Please at least one of the checkbox"); 
       }
    }
</script>

<input type="button" value="Remove Selected" id="buttonClass">
<input type="checkbox" class="chk" value="<?php echo $_item->getId(); ?>">

I have a shopping card with multiple items in it. 我有一张购物卡,里面有多个物品。
How do i delete the selected items from my shopping card? 如何从购物卡中删除所选项目?

在此处输入图片说明

在此处输入图片说明 Why don't you use this plugin Multiple Items Delete (Shopping Cart) 您为什么不使用此插件删除多个项目(购物车)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM