dsstlsqt696435 2018-05-29 04:43
浏览 48

购物车按钮不起作用

Hi I have some more issues in my coding.when i have to changed my coding structure from div to table add to cart button not working.when it is working when it is in div but i have change to table cart button not working please help me to resolve my issue..

Code below is the old one (div) thats working fine here..

 <?php if($microproduct['nr']){?>
               <div class="product-box">
                    <div class="list" id="micropro">
                            <?php foreach ($microproduct['result'] as $resultmicroproduct){ ?> 
                                <div class="row">
                                <div class="col-md-3">
                                  <img src="images/feature-two-one.png" class="img-fluid mx-auto d-block">
                                </div>
                              <div class="col-md-7">
                                  <div class="pro-desc">
                                    <h5><?php echo $conn->stripval($resultmicroproduct['microsoft_product_legalname']);?></h5>
                                    <p>Part number: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_partnumber']);?></p>
                                    <p>Item Name: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_name']);?></p>
                                    <p>Product family: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_family']);?></p>
                                    <h4><i class="fa fa-rupee"></i> <?php echo $conn->stripval($resultmicroproduct['microsoft_product_price']);?></h4>
                                  </div>
                                </div>
                                <div class="col-md-2">
                                  <div class="wrapper-div">
                                    <input min="1" type="number" name="quantity<?php echo $resultmicroproduct['microsoft_product_id'] ?>" class="form-control" id="quantity" value="1" autocomplete="off">
                                    <br>
                                    <?php $postvalue = base64_encode(json_encode($resultmicroproduct)); ?>
                                     <input type="hidden" name="type" value="microsoft_product">
                                    <button class="btn btn-dark btn-sm add_to_cart"  id="<?php echo $resultmicroproduct['microsoft_product_id'] ?>" >Add to Cart</button>
                                  </div>
                                </div> 
                            </div>
                            <?php } ?>
                    </div>
                </div>
                <?php } ?>

Code Below is the new one (table) cart button not working..

<table id="example" class="table table-striped table-bordered" style="width:100%">
                <thead>
                    <tr>
                        <th>Image</th>
                        <th>Product Description</th>
                        <th>Quantity & Cart</th>
                    </tr>
                </thead>
                <?php if($microproduct['nr']){?>
                <tbody>
                    <?php foreach ($microproduct['result'] as $resultmicroproduct){ ?>  
                    <tr class="product-box">  
                        <td><img src="images/feature-two-one.png" class="img-fluid mx-auto d-block"></td>
                        <td>
                          <div class="pro-desc">
                            <h5><?php echo $conn->stripval($resultmicroproduct['microsoft_product_legalname']);?></h5>
                            <p>Part number: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_partnumber']);?></p>
                            <p>Item Name: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_name']);?></p>
                            <p>Product family: <?php echo $conn->stripval($resultmicroproduct['microsoft_product_family']);?></p>
                            <h4><i class="fa fa-rupee"></i> <?php echo $conn->stripval($resultmicroproduct['microsoft_product_price']);?></h4>
                          </div>
                        </td>
                        <td>
                          <div class="wrapper-div">
                            <input min="1" type="number" name="quantity<?php echo $resultmicroproduct['microsoft_product_id'] ?>" class="form-control" id="quantity" value="1" autocomplete="off">
                            <br>
                             <input type="hidden" name="type" value="microsoft_product">
                            <button class="btn btn-dark btn-sm add_to_cart" id="<?php echo $resultmicroproduct['microsoft_product_id'] ?>">Add to Cart</button>
                          </div>
                        </td>
                    </tr>  
                    <?php } ?>
                </tbody>
                <?php } ?>
                <tfoot>
                    <th>Image</th>
                    <th>Product Description</th>
                    <th>Quantity & Cart</th>
                </tfoot>
        </table>
  • 写回答

1条回答 默认 最新

  • dongsheng6056 2018-05-29 07:18
    关注

    You don't even have a form.

    <form action ="?" method="?">
      //your inputs and submit
    </form>
    

    What do you expect to happen if you don't define what to do?

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line