Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的购物车产品加减功能无法正常工作_Php_Jquery_Html_Mysql_Css - Fatal编程技术网

Php 我的购物车产品加减功能无法正常工作

Php 我的购物车产品加减功能无法正常工作,php,jquery,html,mysql,css,Php,Jquery,Html,Mysql,Css,这是我购物车中用于添加和删除产品的jquery代码。但它并没有改变数量,我得到的另一个错误是在添加到购物车后,它会显示两个项目的数量。例如:如果我的物品的价格是45美元,那么它就表示我是90美元 <td class="ct-wishList-image"> <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<

这是我购物车中用于添加和删除产品的jquery代码。但它并没有改变数量,我得到的另一个错误是在添加到购物车后,它会显示两个项目的数量。例如:如果我的物品的价格是45美元,那么它就表示我是90美元

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>
这方面的任何线索都值得高度重视

<tbody>
  <tr id="product_1338_19903_0_0" class="cart_item last_item first_item address_0 odd">

    <td class="ct-wishList-image">
      <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
    </td>
    <td class="ct-wishList-description">
      <p class="boughItemId">
        <?php echo $row[ 'itemno']; ?>
      </p>
    </td>
    <td class="ct-wishList-description">
      <p class="product-name">
        <a href="">
          <?php echo $row[ 'model_name']?>
        </a>
      </p>
    </td>
    <td class="ct-wishList-price">
      <?php echo $row[ 'price'] ?>,00 kr</td>
    <td class="cart_quantity text-center">
      <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
      </br>
      <input type='button' onclick="subchange<?php echo $items_id; ?>()" name='subtract' value='-' />
      <input type='button' onclick="addchange<?php echo $items_id; ?>()" name='add' value='+' />
      <script>
        $(function() {
          var nTotalCount = 0;
          var szUrlString = "index.php?con=6&itemid=";

          $("span[itempricetag='1'").each(function(tag) {
            nTotalCount = Number($(this).html()) + Number(nTotalCount);

          });
          $(".boughItemId").each(function(tag) {
            szUrlString += $(this).html() + ",";
          });

          szUrlString += "&qty=";
          $(".itemBoughtQty").each(function(tag) {
            szUrlString += $(this).val() + ",";
          });
          $("#total_price").html(nTotalCount);
          $("#cart_price").html(nTotalCount);
          $("#cart_total").html(nTotalCount);
          $("#total_total").html(nTotalCount);
          $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
        });
         //document.getElementById("total_price").innerHTML= $total;
        function addchange <?php echo $items_id; ?> () {
          $item_value = document.getElementById("qty<?php echo $items_id; ?>").value++;
          document.getElementById("total_product_price_1338_19903_0<?php echo $items_id; ?>").innerHTML = ($item_value + 1) * <? php echo $row['price'] ?> ;

          //total_price
          var nTotalCount = 0;
          var szUrlString = "index.php?con=6&itemid=";
          $("span[itempricetag='1'").each(function(tag) {
            nTotalCount = Number($(this).html()) + Number(nTotalCount);
          });

          $(".boughItemId").each(function(tag) {
            szUrlString += $(this).html() + ",";
          });
          szUrlString += "&qty=";
          $(".itemBoughtQty").each(function(tag) {
            szUrlString += $(this).val() + ",";
          });
          $("#total_price").html(nTotalCount);
          $("#cart_price").html(nTotalCount);
          $("#cart_total").html(nTotalCount);
          $("#total_total").html(nTotalCount);
          $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
        }

        function subchange <? php echo $items_id; ?> () {
          $item_count = document.getElementById("qty<?php echo $items_id; ?>").value;
          if ($item_count > 1) {
            $item_value = document.getElementById("qty<?php echo $items_id; ?>").value--;
            document.getElementById("total_product_price_1338_19903_0<?php echo $items_id; ?>").innerHTML = ($item_value - 1) * <? php echo $row['price'] ?> ;
            var nTotalCount = 0;
            $("span[itempricetag='1'").each(function(tag) {
              nTotalCount = Number($(this).html()) + Number(nTotalCount);
            });
            $("#total_price").html(nTotalCount);
            $("#cart_price").html(nTotalCount);
            $("#cart_total").html(nTotalCount);
            $("#total_total").html(nTotalCount);
            $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
          }
        }
      </script>
    </td>
    <td id="cart_total" data-title="Total">
      <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
      <td class="ct-wishList-button">
        <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
        <script>
          $(".del_item<?php echo $items_id; ?>").click(function() {
            var delcartvalue = $(this).data('value');
            //alert(delcartvalue);
            $.ajax({
              type: "GET",
              url: "cancel_item.php",
              data: {
                cancelitem: delcartvalue
              },
            });
            $(this).closest('tr').fadeOut();
            window.location.reload();
          });
        </script>
      </td>

  </tr>

</tbody>
        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>

.jpg“alt=”“>

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>
,00韩元

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>

.jpg“alt=”“>

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>
,00韩元 ()*/ ?>

测试

项目编号

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>

        <td class="ct-wishList-image">
          <img style="width:100px;" src="admin/itempics/<?php echo $row['itemno']?>.jpg" alt="<?php echo $row['model_name']?>">
        </td>
        <td class="ct-wishList-description">
          <p class="boughItemId">
            <?php echo $row[ 'itemno']; ?>
          </p>
        </td>
        <td class="ct-wishList-description">
          <p class="product-name">
            <a href="">
              <?php echo $row[ 'model_name']?>
            </a>
          </p>
        </td>
        <td class="ct-wishList-price">
          <?=$row['price'] ?>,00 kr
          </td>
        <td class="cart_quantity text-center">
          <input class="itemBoughtQty" type='text' name='qty<?php echo $items_id; ?>' size="2" id='qty<?php echo $items_id; ?>' value="1" />
          </br>
          <input type='button' onclick="subchange(<?php echo $items_id; ?>)" name='subtract' value='-' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
          <input type='button' onclick="addchange(<?php echo $items_id; ?>,<?php echo $row['price']; ?>)" name='add' value='+' /><? /*subchange<?php echo $items_id; ?>()*/ ?>
        <script>
            $(function() {
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";

              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);

              });
              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });

              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            });
             //document.getElementById("total_price").innerHTML= $total;
            function addchange (item_id , price) { //  <-here add item_id , price
              var item_value = document.getElementById("qty"+item_id).value;// change var item_value = document.getElementById("qty"+item_id).value++;
              document.getElementById("qty"+item_id).value = Number(item_value)+1;// add

              document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_value)+1) * Number(price) ;
                // change "total_product_price_1338_19903_0"+item_id 
                // (Number(item_value)+1) * Number(price)

              //total_price
              var nTotalCount = 0;
              var szUrlString = "index.php?con=6&itemid=";
              $("span[itempricetag='1'").each(function(tag) {
                nTotalCount = Number($(this).html()) + Number(nTotalCount);
              });

              $(".boughItemId").each(function(tag) {
                szUrlString += $(this).html() + ",";
              });
              szUrlString += "&qty=";
              $(".itemBoughtQty").each(function(tag) {
                szUrlString += $(this).val() + ",";
              });
              $("#total_price").html(nTotalCount);
              $("#cart_price").html(nTotalCount);
              $("#cart_total").html(nTotalCount);
              $("#total_total").html(nTotalCount);
              $("#ptcl").attr("href", szUrlString + "&total=" + nTotalCount);
            }

            function subchange(item_id) {
              var item_count = document.getElementById("qty"+item_id).value;
              var price = "<?=$row['price'] ?>";
              if (item_count > 1) {
                document.getElementById("qty"+item_id).value = Number(item_count)-1;
                document.getElementById("total_product_price_1338_19903_0"+item_id).innerHTML = (Number(item_count)-1) * Number(price) ;
                var nTotalCount = 0;
                $("span[itempricetag='1'").each(function(tag) {
                  nTotalCount = Number($(this).html()) + Number(nTotalCount);
                });
                $("#total_price").html(nTotalCount);
                $("#cart_price").html(nTotalCount);
                $("#cart_total").html(nTotalCount);
                $("#total_total").html(nTotalCount);
                $("#ptcl").attr("href", "index.php?con=6&total=" + nTotalCount);
              }
            }
          </script>

        </td>
        <td id="cart_total" data-title="Total">
          <span itempricetag="1" class="cart_total" id="total_product_price_1338_19903_0<?php echo $items_id; ?>"> <?php echo $row['price'] ; ?>  </span> 
          <td class="ct-wishList-button">
            <a class="btn btn-default btn-md del_item<?php echo $items_id; ?>" data-value="<?php echo $key; ?>">X</a>
            <script>
              $(".del_item<?php echo $items_id; ?>").click(function() {
                var delcartvalue = $(this).data('value');
                //alert(delcartvalue);
                $.ajax({
                  type: "GET",
                  url: "cancel_item.php",
                  data: {
                    cancelitem: delcartvalue
                  },
                });
                $(this).closest('tr').fadeOut();
                window.location.reload();
              });
            </script>
          </td>

      </tr>
10000,00韩元
$(函数(){ var nTotalCount=0; var szUrlString=“index.php?con=6&itemid=”; $([itempricetag='1')。每个(函数(标记){ nTotalCount=Number($(this.html())+Number(nTotalCount); }); $(“.boughItemId”)。每个(函数(标记){ szUrlString+=$(this.html()+“,”; }); szUrlString+=“&qty=”; $(“.itemBoughtQty”)。每个(函数(标记){ szUrlString+=$(this.val()+“,”; }); $(“#总价”).html(nTotalCount); $(“#购物车价格”).html(nTotalCount); $(“#购物车总数”).html(nTotalCount); $(“#total_total”).html(nTotalCount); $(“#ptcl”).attr(“href”,szUrlString+”&total=“+nTotalCount); }); //document.getElementById(“总价”).innerHTML=$total; 函数addchange(项目id,价格){//1){ document.getElementById(“数量”+项目id)。值=编号(项目计数)-1; document.getElementById(“总产品价格”\u 1338\u 19903\u 0”+项目id).innerHTML=(编号(项目计数)-1)*编号(价格); var nTotalCount=0; $([itempricetag='1')。每个(函数(标记){ nTotalCount=Number($(this.html())+Number(nTotalCount); }); $(“#总价”).html(nTotalCount); $(“#购物车价格”).html(nTotalCount); $(“#购物车总数”).html(nTotalCount); $(“#total_total”).html(nTotalCount); $(“#ptcl”).attr(“href”,“index.php?con=6&total=“+nTotalCount”); } } 10000
您的$item\u count检查是否应>=1?因为1也是有效的项目数,所以我在购物车中将其设置为最小值1,这样客户就不会将其减少为0。实际上没有必要像这样将变量放入函数名中。变量应传递给函数。无论如何,函数名函数中似乎有多余的空格
addchange(){
。它仍然不能正常工作…它仍然在添加项目时返回相同的错误。它显示了两种产品的价格。