Advertisement
Guest User

Help Please

a guest
Aug 27th, 2013
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. include ('database_connection.php');
  4.  
  5. ?>
  6.  
  7.  
  8. <html>
  9. <head>
  10.  
  11. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  12.     <meta charset="utf-8">
  13.     <title>MVRAM</title>
  14.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  15.     <meta name="description" content="">
  16.     <meta name="author" content="">
  17.  <!-- Le styles -->
  18.     <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
  19.     <link id="switch_style" href="bootstrap/css/united/bootstrap.css" rel="stylesheet">
  20.     <link href="css/main.css" rel="stylesheet">
  21.     <link href="css/jquery.rating.css" rel="stylesheet">
  22.  
  23.     <script language="javascript">
  24.         function validQuantity(id){
  25.             var qty=document.getElementById("id_input_qty_"+id).value;
  26.             window.location="cartquantityedit.php?id="+id+"&qty="+qty;
  27.         }
  28.     </script>
  29.  
  30. </head>
  31.  
  32.  
  33. <body>
  34.  
  35.     <div class="container">
  36.         <div class="row"><!-- start header -->
  37.             <div class="span4 logo">
  38.             <a href="index.php">
  39.                 <h1>MV RAM Trading</h1>
  40.             </a>
  41.             </div>
  42.             <div class="span8">
  43.            
  44.                 <div class="row">
  45.                     <div class="span1">&nbsp;</div>
  46.                     <div class="span2">
  47.                        
  48.                     </div>
  49.                     <div class="span2">
  50.                    
  51.                     </div>                 
  52.                     <div class="span3 customer_service">
  53.                         </div>
  54.                 </div>
  55.                 <br />
  56.                 <div class="row">
  57.                     <div class="links pull-right">
  58.                        
  59.                     </div>
  60.                
  61.                 </div>
  62.             </div>
  63.         </div><!-- end header -->
  64.        
  65.         <div class="row"><!-- start nav -->
  66.             <div class="span12">
  67.               <div class="navbar">
  68.                     <div class="navbar-inner">
  69.                       <div class="container" style="width: auto;">
  70.                         <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  71.                           <span class="icon-bar"></span>
  72.  
  73.                           <span class="icon-bar"></span>
  74.                           <span class="icon-bar"></span>
  75.                         </a>
  76.                         <div class="nav-collapse">
  77.                           <ul class="nav">
  78.                             <li><a href="index.php">Home</a></li>
  79.                             <li><a href="myaccount.php">My Account</a></li>
  80.                             <li><a href="">Shopping Cart</a></li>
  81.                             <li><a href="aboutus.php">About Us</a></li>
  82.                              <li><a href="contactus.php">Contact</a></li>
  83.  
  84.                           </ul>
  85.  
  86.                           <ul class="nav pull-right">
  87.                            <li class="divider-vertical"></li>
  88.                             <form class="navbar-search" method="post" action="searchresult.php">
  89.                                 <input type="text" class="search-query span2" id="keyword" name="keyword" placeholder="Search">
  90.                                 <button class="btn btn-primary btn-small search_btn" type="submit">Go</button>
  91.                             </form>
  92.                            
  93.                           </ul>
  94.                         </div><!-- /.nav-collapse -->
  95.                       </div>
  96.                     </div><!-- /navbar-inner -->
  97.                 </div><!-- /navbar -->
  98.             </div>
  99.         </div><!-- end nav -->   <div class="row">
  100.      <div class="span12">
  101.  
  102.  
  103.  
  104.      
  105.     <h1> Shopping Cart</h1><br />
  106.    
  107.    
  108.    <?php
  109. if(!isset($_SESSION['_myCart']))
  110.  
  111.         $_SESSION['_myCart']=array();
  112.  
  113. if(sizeof($_SESSION['_myCart'])==0)
  114. {
  115.     echo 'Your shopping cart is empty';
  116. }
  117. else
  118. {
  119.    
  120.    
  121.     $checkoutbtn .='
  122.     <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  123. <input type="hidden" name="cmd" value="_cart">
  124. <input type="hidden" name="upload" value="1">
  125. <input type="hidden" name="business" value="[email protected]">';
  126.    
  127.    
  128.    
  129.     echo ' <table class="table table-bordered table-striped">
  130.           <thead>
  131.               <tr>
  132.                 <th>Remove</th>
  133.                 <th>Image</th>
  134.                 <th>Product ID</th>
  135.                 <th>Product Name</th>
  136.                 <th>Model</th>
  137.                 <th>Quantity</th>
  138.                 <th>Unit Price</th>
  139.                 <th>Total</th>
  140.               </tr>
  141.             </thead>
  142.             ';
  143.    
  144.     $totalCart=0;
  145.     foreach($_SESSION['_myCart'] as $id=>$qty)
  146.     {
  147.         $rsCheckPrd=mysql_query("SELECT * FROM tbl_product WHERE productID=".$id) or die(mysql_error());
  148.        
  149.        
  150. if ($prd = mysql_fetch_assoc($rsCheckPrd)) {
  151.            
  152.         $productID = $prd["productID"];
  153.      $brand = $prd["brand"];
  154.     $model = $prd["model"];
  155.      $price = $prd["price"];
  156.     $prodimg = $prd["thumbimg"];
  157.            
  158.            
  159. $checkoutbtn .='           
  160. <INPUT TYPE="hidden" NAME="item_name_x" VALUE="'.$model.'">
  161. <INPUT TYPE="hidden" NAME="item_number_x" VALUE="'.$productID.'">
  162. <INPUT TYPE="hidden" NAME="amount_x" VALUE="'.$price.'">
  163. <INPUT TYPE="hidden" NAME="quantity_x" VALUE="'.$qty.'">';
  164.  
  165.         $total=$prd['price']*$qty;
  166.            
  167.             echo'<tr>
  168.             <tbody>
  169.                 <td class=""><a href="cartdelete.php?id='.$productID.'"> <button class="btn btn-primary">Delete </button> </a></td>
  170.                 <td class="muted center_text"><img src="'.$prodimg.'"></td>
  171.                 <td>'.$productID.'</td>
  172.                 <td>'.$brand.'</td>
  173.                 <td>'.$model.'</td>
  174.                 <td><form><input type="text"  id="id_input_qty_'.$productID.'" value="'.$qty.'" class="input-mini"> <input type="button" class="btn btn-primary" onclick="javascript:validQuantity('.$productID.');" value="Update"/> </a> </td>
  175.                 <td>&#8369;'.$price.'</td>
  176.                 <td>&#8369; '.$total.'</td>
  177.                 </tr>';
  178.              
  179.            
  180.            
  181.             $totalCart+=$total;
  182.            
  183.            
  184.            
  185.         }
  186.         else
  187.             unset($_SESSION['_myCart'][$id]);
  188.     }
  189.  
  190. $checkoutbtn .='
  191. <INPUT TYPE="hidden" NAME="notify_url" VALUE="www..com/ecomm/paypalIPN.php">
  192. <INPUT TYPE="hidden" NAME="return" VALUE="www..com/ecomm/ordersuccess.php">
  193. <INPUT TYPE="hidden" NAME="rm" VALUE="2">
  194. <INPUT TYPE="hidden" NAME="cbt" VALUE="Return to the Store">
  195. <INPUT TYPE="hidden" NAME="cancel_return" VALUE="www..com/ecomm/ordercancel.php">
  196. <INPUT TYPE="hidden" NAME="lc" VALUE="US">
  197. <INPUT TYPE="hidden" NAME="currency_code" VALUE="PHP">
  198. <button class="btn btn-primary" type="submit">Checkout</button>
  199. </form>
  200. ';
  201.  
  202.  
  203.  
  204. echo '
  205. <tr>
  206.                 <td>&nbsp;</td>
  207.                 <td>&nbsp;</td>
  208.                 <td>&nbsp;</td>
  209.                 <td>&nbsp;</td>
  210.                 <td>&nbsp;</td>
  211.                 <td>&nbsp;</td>
  212.                 <td>&nbsp;</td>
  213.                 <td><strong>&#8369;'.$totalCart.'</strong></td>
  214.               </tr>      
  215.             </tbody>
  216.           </table>';
  217.    
  218. }  
  219.  
  220.  
  221.  
  222. ?>
  223.  
  224.  
  225.  
  226.  
  227.          
  228.              
  229.          
  230.          
  231.          
  232.  
  233.           <div class="row">
  234.            
  235.             <div class="span5">
  236.             <button class="btn btn-primary" type="submit">Continue shopping</button>
  237.             </div>       
  238.             <div class="span7">
  239.             <?php echo $checkoutbtn; ?>
  240.            <!-- <a href="checkout.html" class="btn btn-primary pull-right">Checkout</a>-->
  241.             </div>
  242.           </div>
  243.          <footer>
  244.     <hr />
  245.     <div class="row well no_margin_left">
  246.  
  247. <div class="span3">
  248.         <h4></h4>
  249.         <ul>
  250.            
  251.         </ul>
  252.     </div>
  253.    
  254.     <div class="span3">
  255.         <h4>Information</h4>
  256.         <ul>
  257.             <li><a href="aboutus.php">About Us</a></li>
  258.             <li><a href="services.php">Services</a></li>
  259.             <li><a href="contactus.php">Contact Us</a></li>
  260.         </ul>
  261.     </div>
  262.    
  263.    
  264.     <div class="span2">
  265.         <h4>My Account</h4>
  266.         <ul>
  267.             <li><a href="myaccount.php">My Account</a></li>
  268.             <li><a href="myorder.php">Order History</a></li>
  269.         </ul>
  270.     </div>
  271.  
  272. </footer>
  273.  
  274. </div> <!-- /container -->
  275.  
  276.  
  277.  
  278. <!-- Le javascript
  279. ================================================== -->
  280. <!-- Placed at the end of the document so the pages load faster -->
  281. <script src="js/jquery.min.js"></script>
  282. <script src="bootstrap/js/bootstrap.js"></script>
  283. <script src="js/jquery.rating.pack.js"></script>
  284.  
  285.  
  286. </body>
  287.  
  288.  
  289. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement