首页 > 解决方案 > 如何将这些产品设置为具有相同的订单 ID、发票和付款方式?

问题描述

我的购物车结帐将所选产品提交到“我的订单页面”,其中产品被分成不同的行,并使用相同的发票编号进行单独付款。如何将这些行合并为一列,其中包含所有三种产品的总价格和总数量以及一种付款方式?

购物车截图


<div class="table-responsive">

    <table class="table table-bordered table-hover">

        <thead>

            <tr>

                <th> ON: </th>
                <th> Due Amount: </th>
                <th> Invoice No: </th>
                <th> Qty: </th>
                <th> Size: </th>
                <th> Order Date: </th>
                <th> Paid / Unpaid: </th>
                <th> Status: </th>

            </tr>

        </thead>

        <tbody>


            <?php 

                $customer_session = $_SESSION['customer_email'];

                $get_customer = "select * from customers where customer_email='$customer_session'";

                $run_customer = mysqli_query($con,$get_customer);

                $row_customer = mysqli_fetch_array($run_customer);

                $customer_id = $row_customer['customer_id'];

                $get_orders = "select * from customer_orders where customer_id='$customer_id'";

                $run_orders = mysqli_query($con,$get_orders);

                $i = 0;

                while($row_orders = mysqli_fetch_array($run_orders)){

                    $order_id = $row_orders['order_id'];

                    $due_amount = $row_orders['due_amount'];

                    $invoice_no = $row_orders['invoice_no'];

                    $qty = $row_orders['qty'];

                    $size = $row_orders['size'];

                    $order_date = substr($row_orders['order_date'],0,11);

                    $order_status = $row_orders['order_status'];

                    $i++;

                    if($order_status == 'Pending'){
                    
                        $order_status = 'Unpaid';
                        
                    }else{
                        
                        $order_status = 'Paid';
                        
                    }

            ?>

            <tr>

                <th> <?php echo $i; ?> </th>
                <td> AED<?php echo $due_amount; ?> </td>
                <td> <?php echo $invoice_no; ?> </td>
                <td> <?php echo $qty; ?> </td>
                <td> <?php echo $size; ?> </td>
                <td> <?php echo $order_date; ?> </td>
                <td> <?php echo $order_status; ?> </td>

                <td>
                    <a href="confirm.php?order_id=<?php echo $order_id; ?>" target="_blank" class="btn btn-primary btn-sm"> Confirm Payment </a>
                </td>

            </tr>

            <?php } ?>

        </tbody>

    </table>


</div>```

标签: phpmysql

解决方案


推荐阅读