Advertisement
craygo

cart.php

Jul 18th, 2011
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <?php if(!$this->cart->contents()){
  2.     echo 'There are no items in your cart.';
  3. } else {
  4. ?>
  5. <?php echo form_open('pnp/update_cart'); ?>
  6. <table id="cart_table">
  7.     <thead>
  8.         <tr>
  9.             <td class="titles" >Qty</td>
  10.             <td class="titles" >Item Description</td>
  11.             <td class="titles" >Item Price</td>
  12.             <td class="titles" >Sub-Total</td>
  13.         </tr>
  14.     </thead>
  15.     <tbody>
  16.         <?php $i = 1; ?>
  17.         <?php foreach($this->cart->contents() as $items): ?>
  18.  
  19.         <?php echo form_hidden('rowid[]', $items['rowid']); ?>
  20.         <tr <?php if($i&1){ echo 'class="alt"'; }?>>
  21.             <td>
  22.                 <?php echo form_input(array('name' => 'qty[]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '2')); ?>
  23.             </td>
  24.  
  25.             <td><?php echo $items['name']; ?></td>
  26.  
  27.             <td>$<?php echo $this->cart->format_number($items['price']); ?></td>
  28.             <td>$<?php echo $this->cart->format_number($items['subtotal']); ?></td>
  29.         </tr>
  30.  
  31.         <?php $i++; ?>
  32.         <?php endforeach; ?>
  33.  
  34.         <tr>
  35.             <td>&nbsp;</td>
  36.             <td>&nbsp;</td>
  37.             <td><strong>Total</strong></td>
  38.             <td>$<?php echo $this->cart->format_number($this->cart->total()); ?></td>
  39.         </tr>
  40.     </tbody>
  41. </table>
  42.  
  43. <p id="buttons" >
  44. <?php
  45. echo form_submit('', 'Update Cart')."\n";
  46. //echo anchor('pnp/empty_cart', 'Empty Cart', 'class="empty"')."\n";
  47. ?>
  48. <button onclick="document.location.href='<?php echo base_url(); ?>pnp/empty_cart'; return false;" class="empty">Empty Cart</button>
  49. </p>
  50. <p><small>If the quantity is set to zero, the item will be removed from the cart.</small></p>
  51. <button onclick="document.location.href='<?php echo base_url(); ?>chout'; return false;" class="empty">Check Out</button>
  52. <?php
  53. echo form_close();
  54. }
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement