<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2008 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCart                      |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<table width="90%" border="0" cellpadding="0" cellspacing="0" class="manage_top" align="center">
	<tr><td><font color="#FF0000"><?php $session->flash(); ?></font></td></tr>
</table>
						<table width="90%"  border="0" cellpadding="5" cellspacing="0" class="listing" align="center">
                            <tr>
                              <td width="100%" align="center"><h2>My Cart</h2></td>
                            </tr>
							 <tr>
                              <td width="100%" align="center">
							  <?php if($cnfg["shipping_require"] == 'Y'){ ?>
							  		<table width="100%"  border="0" cellspacing="2" cellpadding="2" class="form_table">
									  <?php if(sizeof($itemlist) > 0){ ?>
									  <tr>
										<th>&nbsp;</th>
										<th align="center">Product Name</th>
										<th align="center">Quantity</th>
										<th align="center">Price</th>
										<th align="center">Option</th>
									  </tr>
									  <?php } ?>
									  <form name="cart" method="post" action="<?php echo $html->url('/carts/update');?>">			
									  <?php if(sizeof($itemlist) > 0){ ?>
									  <?php
									  $i=0;
									  $sum = 0;
									   foreach($itemlist as $item){ 
									   $i++;
									   ?>
									  <tr>
										<td class="bodytext1"><?php echo $i; ?></td>
										<td class="bodytext1"><?php echo $item["Product"]["pname"]; ?></td>
										<td class="bodytext1" align="center"><input type="hidden" value="<?php echo $item["Cart"]["id"]; ?>" name="id[]"><input type="text" value="<?php echo $item["Cart"]["quantity"]; ?>" name="qty[]" style="width:20px;"></td>
										<td class="bodytext1" align="right"><?php echo $curlogo."&nbsp;";echo $item["Cart"]["product_price"]*$item["Cart"]["quantity"]; 
										$sum = $sum + $item["Cart"]["product_price"]*$item["Cart"]["quantity"]; 
										?></td>
										<td class="bodytext1"><a href="<?php echo $html->url('/carts/delete/'.$item["Cart"]["id"]);?>">Remove</a></td>
									  </tr>
									  <?php } ?>
									   <tr>
									  	
										
										<td class="bodytext2" align="right" colspan="5" bgcolor="#F3F4F1"><strong>Total Price : <?php  echo $curlogo."&nbsp;".$sum; ?></strong></td>
										
									  </tr>
									  <?php }else{ ?>
									  		 <tr>
												<td>&nbsp;</td>
												<td class="bodytext2"><strong>&nbsp; </strong></td>
												<td class="bodytext2" colspan="2"><strong>Your cart is empty!</strong></td>
												
												<td class="bodytext1">&nbsp;</td>
											  </tr>
									  <?php } ?>
									  <tr>
									  	<td>&nbsp;</td>
										<td colspan="3" align="center"><?php if(sizeof($itemlist) > 0){ ?><input type="submit" value="Update Cart"> <?php }?>&nbsp;&nbsp;&nbsp;
										<?php if(sizeof($itemlist) > 0){ ?><input type="button" value="Checkout" onClick="javascript:window.location='<?php echo $html->url('/userAddresses/show_bill_ship');?>';"><?php }?>&nbsp;&nbsp;&nbsp;
										<input type="button" value="Continue shopping" onClick="javascript:window.location='<?php echo $html->url('/index.php');?>';"></td>
										
										<td class="bodytext1">&nbsp;</td>
									  </tr>
									  </form>
									</table>
									<?php }else{ ?>
									<table width="100%"  border="0" cellspacing="2" cellpadding="2" class="form_table">
									  <?php if(sizeof($itemlist) > 0){ ?>
									  <tr>
										<th>&nbsp;</th>
										<th align="center">Product Name</th>
										<th align="center">Quantity</th>
										<th align="center">Price</th>
										<th align="center">Shipping Cost</th>
										<th align="center">Option</th>
									  </tr>
									  <?php } ?>
									  <form name="cart" method="post" action="<?php echo $html->url('/carts/update');?>">			
									  <?php if(sizeof($itemlist) > 0){ ?>
									  <?php
									  $i=0;
									  $sum = 0;
									   foreach($itemlist as $item){ 
									   $i++;
									   ?>
									  <tr>
										<td class="bodytext1"><?php echo $i; ?></td>
										<td class="bodytext1"><?php echo $item["Product"]["pname"]; ?></td>
										<td class="bodytext1" align="center"><input type="hidden" value="<?php echo $item["Cart"]["id"]; ?>" name="id[]"><input type="text" value="<?php echo $item["Cart"]["quantity"]; ?>" name="qty[]" style="width:20px;"></td>
										<td class="bodytext1" align="right"><?php echo $curlogo."&nbsp;"; echo $item["Cart"]["product_price"]*$item["Cart"]["quantity"]; 
										$sum = $sum + (($item["Cart"]["product_price"]*$item["Cart"]["quantity"])+($item["Cart"]["shipping_charge"]*$item["Cart"]["quantity"])); 
										?></td>
										<td class="bodytext1" align="right"><?php echo $item["Cart"]["shipping_charge"]*$item["Cart"]["quantity"]; ?></td>
										<td class="bodytext1"><a href="<?php echo $html->url('/carts/delete/'.$item["Cart"]["id"]);?>">Remove</a></td>
									  </tr>
									  <?php } ?>
									   <tr>
									  	
										
										<td class="bodytext2" align="right" colspan="6" bgcolor="#F3F4F1"><strong>Total Price : <?php  echo $curlogo."&nbsp;".$sum; ?></strong></td>
										
									  </tr>
									  <?php }else{ ?>
									  		 <tr>
												<td>&nbsp;</td>
												<td class="bodytext2"><strong>&nbsp; </strong></td>
												<td class="bodytext2" colspan="3"><strong>Your cart is empty!</strong></td>
												
												<td class="bodytext1">&nbsp;</td>
											  </tr>
									  <?php } ?>
									  <tr>
									  	<td>&nbsp;</td>
										<td colspan="4" align="center"><?php if(sizeof($itemlist) > 0){ ?><input type="submit" value="Update Cart"> <?php }?>&nbsp;&nbsp;&nbsp;
										<?php if(sizeof($itemlist) > 0){ ?><input type="button" value="Checkout" onClick="javascript:window.location='<?php echo $html->url('/userAddresses/show_bill_ship');?>';"><?php }?>&nbsp;&nbsp;&nbsp;
										<input type="button" value="Continue shopping" onClick="javascript:window.location='<?php echo $html->url('/index.php');?>';"></td>
										
										<td class="bodytext1">&nbsp;</td>
									  </tr>
									  </form>
									</table>
									<?php }?>
							</td>
                            </tr>
                        </table>