Advertisement
Guest User

Paypal not working

a guest
Aug 27th, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.18 KB | None | 0 0
  1.  
  2.    
  3.    <?php
  4. if(!isset($_SESSION['_myCart']))
  5.  
  6.         $_SESSION['_myCart']=array();
  7.  
  8. if(sizeof($_SESSION['_myCart'])==0)
  9. {
  10.     echo 'Your shopping cart is empty';
  11. }
  12. else
  13. {
  14.    
  15.    
  16.     $checkoutbtn .='
  17.     <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  18. <input type="hidden" name="cmd" value="_cart">
  19. <input type="hidden" name="upload" value="1">
  20. <input type="hidden" name="business" value="[email protected]">';
  21.    
  22.    
  23.    
  24.     echo ' <table class="table table-bordered table-striped">
  25.           <thead>
  26.               <tr>
  27.                 <th>Remove</th>
  28.                 <th>Image</th>
  29.                 <th>Product ID</th>
  30.                 <th>Product Name</th>
  31.                 <th>Model</th>
  32.                 <th>Quantity</th>
  33.                 <th>Unit Price</th>
  34.                 <th>Total</th>
  35.               </tr>
  36.             </thead>
  37.             ';
  38.    
  39.     $totalCart=0;
  40.     foreach($_SESSION['_myCart'] as $id=>$qty)
  41.     {
  42.         $rsCheckPrd=mysql_query("SELECT * FROM tbl_product WHERE productID=".$id) or die(mysql_error());
  43.        
  44.        
  45. if ($prd = mysql_fetch_assoc($rsCheckPrd)) {
  46.            
  47.         $productID = $prd["productID"];
  48.      $brand = $prd["brand"];
  49.     $model = $prd["model"];
  50.      $price = $prd["price"];
  51.     $prodimg = $prd["thumbimg"];
  52.            
  53.            
  54. $checkoutbtn .='           
  55. <INPUT TYPE="hidden" NAME="item_name_x" VALUE="'.$model.'">
  56. <INPUT TYPE="hidden" NAME="item_number_x" VALUE="'.$productID.'">
  57. <INPUT TYPE="hidden" NAME="amount_x" VALUE="'.$price.'">
  58. <INPUT TYPE="hidden" NAME="quantity_x" VALUE="'.$qty.'">';
  59.  
  60.            
  61.             $total=$prd['price']*$qty;
  62.            
  63.             echo'<tr>
  64.             <tbody>
  65.                 <td class=""><a href="cartdelete.php?id='.$productID.'"> <button class="btn btn-primary">Delete </button> </a></td>
  66.                 <td class="muted center_text"><img src="'.$prodimg.'"></td>
  67.                 <td>'.$productID.'</td>
  68.                 <td>'.$brand.'</td>
  69.                 <td>'.$model.'</td>
  70.                 <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>
  71.                 <td>&#8369;'.$price.'</td>
  72.                 <td>&#8369; '.$total.'</td>
  73.                 </tr>';
  74.              
  75.            
  76.            
  77.             $totalCart+=$total;
  78.            
  79.            
  80.            
  81.         }
  82.         else
  83.             unset($_SESSION['_myCart'][$id]);
  84.     }
  85.  
  86. $checkoutbtn .='
  87. <INPUT TYPE="hidden" NAME="notify_url" VALUE="www.@@@@.com/ecomm/paypalIPN.php">
  88. <INPUT TYPE="hidden" NAME="return" VALUE="www.@@@@.com/ecomm/ordersuccess.php">
  89. <INPUT TYPE="hidden" NAME="rm" VALUE="2">
  90. <INPUT TYPE="hidden" NAME="cbt" VALUE="Return to the Store">
  91. <INPUT TYPE="hidden" NAME="cancel_return" VALUE="www.@@@@@.com/ecomm/ordercancel.php">
  92. <INPUT TYPE="hidden" NAME="lc" VALUE="US">
  93. <INPUT TYPE="hidden" NAME="currency_code" VALUE="PHP">
  94. <button class="btn btn-primary" type="submit">Checkout</button>
  95. </form>
  96. ';
  97.  
  98.  
  99.  
  100. echo '
  101. <tr>
  102.                 <td>&nbsp;</td>
  103.                 <td>&nbsp;</td>
  104.                 <td>&nbsp;</td>
  105.                 <td>&nbsp;</td>
  106.                 <td>&nbsp;</td>
  107.                 <td>&nbsp;</td>
  108.                 <td>&nbsp;</td>
  109.                 <td><strong>&#8369;'.$totalCart.'</strong></td>
  110.               </tr>      
  111.             </tbody>
  112.           </table>';
  113.    
  114. }  
  115.  
  116.  
  117.  
  118. ?>
  119.  
  120.  
  121.  
  122.  
  123.          
  124.              
  125.          
  126.          
  127.          
  128.  
  129.           <div class="row">
  130.            
  131.             <div class="span5">
  132.             <button class="btn btn-primary" type="submit">Continue shopping</button>
  133.             </div>       
  134.             <div class="span7">
  135.             <?php echo $checkoutbtn; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement