Location: PHPKode > scripts > Hippo Shopping Cart > hippo-shopping-cart/shopping_cart_1-1.php
<?php
  session_start();
  
  require('classes/hippo_sql_query.php');
  require('classes/hippo_shopping_cart.php');
  require('shopping_cart_DBVar.php');
  require('shopping_cart_global_func.php');
  
  $my_shopping_cart = new hippo_shopping_cart();
  
  if(isset($_POST['Update'])){$my_shopping_cart->update_shopping_cart($_POST['quantity'], $_POST['if_delete']);$show_page_no = "2";}
  else{
    if(!session_is_registered('email')){session_register('email'); session_register('MemId');}
    if(isset($_GET['MemId'])){$_SESSION['MemId'] = $_GET['MemId'];}else{?><script language=javascript>history.go(-1);</script><?php exit();}
    if(isset($_GET['email'])){$_SESSION['email'] = $_GET['email'];}else{echo "NOT Found: without email info..."; exit();}
    if(check_if_user_exist($_GET['MemId'], $_GET['email'])){}else{echo "NOT Found: User Record...<br>"; exit();}
    if(isset($_GET['products_id'])){if(check_if_products_id_exist($_GET['products_id'])){}else{echo "NOT Found: products id"; exit();}$my_shopping_cart->add_item($_GET['products_id']);}
    $show_page_no = "1";
  }
  
  $my_shopping_cart->get_shopping_cart_detail($_SESSION['MemId'], $_SESSION['email']);
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $header_language;?>">
<meta http-equiv="Pragma" content="<?php echo SHOPPING_PRAGMA_CACHE; ?>">
<title><?php echo $header_name_shopping_cart_1_1;?></title>
<script language="javascript" src="js/shopping_cart.js"></script>
</head>

<?php
  // Add Item Result
  if($my_shopping_cart->num_of_products_id!=0 && $show_page_no=="1")
  {
?>
<form action=<?php echo ($_SERVER['PHP_SELF']); ?> method=post>
<table width="80%"  border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="3">
      <tr>
        <td class="txtb"> Dear<?php echo $my_shopping_cart->user_detail[0]['f_nickname'];?>: </td>
      </tr>
      <tr>
        <td bgcolor="#AA186A" class="txtw">Shopping Cart Detail</td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td><table width="520"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="520"  border="0" cellspacing="0" cellpadding="3">
                  <tr align="center" class="txt">
                    <td width="200"> Product Name </td>
                    <td width="100"> Price </td>
                    <td width="60"> Quantity </td>
                    <td width="100"> Subtotal </td>
                    <td width="60"> Remove </td>
                  </tr>
                </table></td>
              </tr>
              
<?php
    for($i=0;$i<$my_shopping_cart->num_of_products_id;$i++)
    {
?>
              <tr>
                <td><table width="520"  border="0" cellspacing="0" cellpadding="3">
                  <tr align="center" class="txt">
                    <td width="200" class="txtb"><?php echo $my_shopping_cart->product_detail[$i][0]['f_products_name'];?></td>
                    <td width="100"> <?php echo $my_shopping_cart->product_detail[$i][0]['f_products_price'];?> </td>
                    <td width="60"> <input name="quantity[<?php echo $i;?>]" type="text" value="<?php echo $my_shopping_cart->products_num_in_cart[$i];?>" size="5" maxlength="10"></td>
                    <td width="100"> <?php echo $my_shopping_cart->product_detail[$i][0]['f_products_price']*$my_shopping_cart->products_num_in_cart[$i]; ?> </td>
                    <td width="60"> <input type="checkbox" name="if_delete[]" value="<?php echo $i;?>"></td>
                  </tr>
                  <tr align="center" class="txt">
                    <td colspan="5" class="txtb"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="3" background="images/dot.gif"></td>
                      </tr>
                    </table></td>
                    </tr>
                </table></td>
              </tr>

<?php
    }
?>
            </table></td>
          </tr>
          <tr>
            <td align="center" class="txtb"> There are <span class="txtr"><?php echo $my_shopping_cart->num_of_products_id;?></span> products¡Aamount: NT$<span class="txtr"><?php echo $my_shopping_cart->final_price;?></span> dollar </td>
          </tr>
          <tr>
            <td align="center" valign="top" bgcolor="#757575"><span class="txtw"><?php if($my_shopping_cart->num_of_products_id!=0){echo "If you wanna change the quantity or remove products from shopping cart, please click on";}?>
            </span><?php if($my_shopping_cart->num_of_products_id!=0){echo "<INPUT NAME=Update TYPE=submit Value=Update Shopping Cart>";} ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center" class="txt"><input type="button" name="Continue_Shopping" value="Continue Shopping" onclick=javascript:redirectpage('<?php echo $url_continue_shopping;?>') >
          <?php if($my_shopping_cart->num_of_products_id!=0){echo "<input type=button name=Ready_to_Pay value=Checkout onclick=javascript:redirectpage('".$url_ready_to_pay."') >";} ?>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>

<?php
  }
  elseif($my_shopping_cart->num_of_products_id==0 && $show_page_no=="1")
  {
?>

<table width="80%"  border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="3">
      <tr>
        <td class="txtb">Dear<?php echo $my_shopping_cart->user_detail[0]['f_nickname'];?>: </td>
      </tr>
      <tr>
        <td bgcolor="#AA186A" class="txtw"><?php echo $string_name_shopping_cart_1_1;?></td>
      </tr>
      
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td><table width="520"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="520"  border="0" cellspacing="0" cellpadding="3">
                  <tr align="center" class="txt">
                    <td width="200"> Product Name </td>
                    <td width="100"> Price </td>
                    <td width="60"> Quantity </td>
                    <td width="100"> Subtotal </td>
                    <td width="60"> Remove </td>
                  </tr>
                </table></td>
              </tr>
              
            </table></td>
          </tr>
          <tr>
            <td align="center" class="txtb"> There are <span class="txtr"><?php echo $my_shopping_cart->num_of_products_id;?></span> products¡Aamount: NT$<span class="txtr"><?php echo $my_shopping_cart->final_price;?></span> dollar </td>
          </tr>
          <tr>
            <td align="center" valign="top" bgcolor="#757575"><span class="txtw"><?php if($my_shopping_cart->num_of_products_id!=0){echo "If you wanna change the quantity or remove products from shopping cart, please click on";}?>
            </span><?php if($my_shopping_cart->num_of_products_id!=0){echo "<INPUT NAME=Update TYPE=submit Value=Update Shopping Cart>";} ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center" class="txt"><input type="button" name="Continue_Shopping" value="Continue Shopping" onclick=javascript:redirectpage('<?php echo $url_continue_shopping;?>') >
        <?php if($my_shopping_cart->num_of_products_id!=0){echo "<input type=button name=Ready_to_Pay value=Checkout onclick=javascript:redirectpage('".$url_ready_to_pay."') >";} ?>
        </td>
      </tr>
    </table></td>
  </tr>
</table>

<?php
  }
  elseif($show_page_no=="2") // Update Cart Result
  {
?>
<form action=<?php echo ($_SERVER['PHP_SELF']); ?> method=post>
<table width="80%"  border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="3">
      <tr>
        <td class="txtb"> Dear<?php echo $my_shopping_cart->user_detail[0]['f_nickname'];?>: </td>
      </tr>
      <tr>
        <td bgcolor="#AA186A" class="txtw">Shopping Cart Detail</td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td><table width="520"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="520"  border="0" cellspacing="0" cellpadding="3">
                  <tr align="center" class="txt">
                    <td width="200"> Product Name </td>
                    <td width="100"> Price </td>
                    <td width="60"> Quantity </td>
                    <td width="100"> Subtotal </td>
                    <td width="60"> Remove </td>
                  </tr>
                </table></td>
              </tr>
<?php
    for($i=0;$i<$my_shopping_cart->num_of_products_id;$i++)
    {
?>
 <tr>
                <td><table width="520"  border="0" cellspacing="0" cellpadding="3">
                  <tr align="center" class="txt">
                    <td width="200" class="txtb"><?php echo $my_shopping_cart->product_detail[$i][0]['f_products_name'];?></td>
                    <td width="100"> <?php echo $my_shopping_cart->product_detail[$i][0]['f_products_price'];?> </td>
                    <td width="60"> <input name="quantity[<?php echo $i;?>]" type="text" value="<?php echo $my_shopping_cart->products_num_in_cart[$i];?>" size="5" maxlength="10"></td>
                    <td width="100"> <?php echo $my_shopping_cart->product_detail[$i][0]['f_products_price']*$my_shopping_cart->products_num_in_cart[$i]; ?> </td>
                    <td width="60"> <input type="checkbox" name="if_delete[]" value="<?php echo $i;?>"></td>
                  </tr>
                  <tr align="center" class="txt">
                    <td colspan="5" class="txtb"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="3" background="images/dot.gif"></td>
                      </tr>
                    </table></td>
                    </tr>
                </table></td>
              </tr>
<?php
    }
?>
        </table></td>
          </tr>
          <tr>
            <td align="center" class="txtb"> There are <span class="txtr"><?php echo $my_shopping_cart->num_of_products_id;?></span> products¡Aamount: NT$<span class="txtr"><?php echo $my_shopping_cart->final_price;?></span> dollar </td>
          </tr>
          <tr>
            <td align="center" valign="top" bgcolor="#757575"><span class="txtw"><?php if($my_shopping_cart->num_of_products_id!=0){echo "If you wanna change the quantity or remove products from shopping cart, please click on";}?>
            </span><?php if($my_shopping_cart->num_of_products_id!=0){echo "<INPUT NAME=Update TYPE=submit Value=Update Shopping Cart>";} ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center" class="txt"><input type="button" name="Continue_Shopping" value="Continue Shopping" onclick=javascript:redirectpage('<?php echo $url_continue_shopping;?>') >
        <?php if($my_shopping_cart->num_of_products_id!=0){echo "<input type=button name=Ready_to_Pay value=Checkout onclick=javascript:redirectpage('".$url_ready_to_pay."') >";} ?>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>

<?php
  }
?>

</html>
Return current item: Hippo Shopping Cart