<th></th> <th>สินค้า</th> <th style="text-align: center;">จำนวน</th> <th style="text-align: right;">ราคา/ชิ้น</th> <th style="text-align: right;">ราคารวม</th> </tr> </thead> <tbody> <?php $i = 0; $product = new Product(); $sum_price = 0; foreach ($basket as $rs): $i++; $sum_price = $sum_price + $rs['product_price_sum']; $img = $product->get_last_img($rs['product_id']); ?> <tr> <td><?php echo $i; ?></td> <td style=" width: 10%;"> <img src="<?php echo Yii::app()->baseUrl;?>/uploads/<?php echo $img?>" class="img-thumbnail img-responsive"/> </td> <td><?php echo $rs['product_name']; ?></td> <td style="text-align: center;"><?php echo $rs['product_num']; ?></td> <td style="text-align: right; color: #ffcc00;"><?php echo number_format($rs['product_price'], 2); ?></td> <td style="text-align: right; color: #ff0000; background: #22282e;"><?php echo number_format($rs['product_price_sum'], 2); ?></td> </tr> <?php endforeach; ?> </tbody> <tfoot> <tr>
<tr> <td>#</td> <td>รูป</td> <td>ชื่อสินค้า</td> <td style="text-align: center;">ราคา</td> <td style="text-align: center;">จำนวน</td> <td style="text-align: center;">ราคารวม</td> </tr> </thead> <tbody> <?php $totalall = 0; $i = 1; $product_model = new Product(); foreach ($basket as $products): $img = $product_model->get_last_img($products['product_id']); ?> <tr> <td><?= $i++ ?></td> <td style=" width: 10%;"> <img src="<?php echo Yii::app()->baseUrl; ?>/uploads/<?php echo $img; ?>" class="img-resize img-thumbnail" width="100%"/> </td> <td><?= $products['product_name']; ?></td> <td style=" text-align: right;"><?= number_format($products['product_price']); ?></td> <td style="text-align: center;"><?= $products['product_num']; ?></td> <td style="text-align: right;"><?= number_format(($products['product_price'] * $products['product_num']), 2); ?></td> <?php $total = (($products['product_price'] * $products['product_num'])); $totalall = $totalall + $total; ?> </tr>