Login   Register  
PHP Classes
elePHPant
Icontem

File: Checkout.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of RAZA  >  shopcart  >  Checkout.php  >  Download  
File: Checkout.php
Role: Example script
Content type: text/plain
Description: Checkout Page
Class: shopcart
Manage a shopping cart stored in a MySQL database
Author: By
Last change:
Date: 2009-08-10 02:49
Size: 2,914 bytes
 

Contents

Class file image Download
<?php
require('includes/application.php');
if(!isset(
$_SESSION['cart_active']))
    
header("location: index.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample PHP Paypal Shopping Cart - Checkout</title>
<link rel="stylesheet" type="text/css" href="css/site.css" />
</head>

<body onload="document.payment_provider_form.submit()">
                <h2>Please wait while redirecting to Paypal for payment </h2>
<!--
For Use in Paypal Sandbox or Live, do the following

    For Sandbox:
    ------------
    e.g.,
        <form name="somename" action="https://www.sandbox.paypal.com/us/cgi-bin/webscr">
            <input type="business" type="hidden" value="demo_biz@test.com" />
            --- Other Info here --
        </form>
        

    For Live:
    ------------
    e.g.,
        <form name="somename" action="https://www.paypal.com/cgi-bin/webscr">
            <input type="business" type="hidden" value="demo_biz@test.com" />
           -- Other Info here --
        </form>        
-->
        <form name="payment_provider_form" method="post" action="https://www.sandbox.paypal.com/us/cgi-bin/webscr">
            Click here if nothing happens... 
            <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit"
                alt="Make payments with PayPal - it's fast, free and secure!" /> 
            <input name="business" type="hidden" value="srmk_1238697971_biz@live.com" />
            <input name="cmd" type="hidden" value="_cart" />
            <input name="upload" type="hidden" value="1" />
            <input name="rm" type="hidden" value="2" />
            <input name="no_shipping" type="hidden" value="1" />
            <input name="no_note" type="hidden" value="1" />
            <input name="cs" type="hidden" value="0" />
            <input name="currency_code" type="hidden" value="USD" />
            <input name="return" type="hidden" value="<?php echo $_SERVER['HTTP_HOST'].'/CheckoutSuccess.php' ?>" />
            <input name="cancel_return" type="hidden" value="<?php echo $_SERVER['HTTP_HOST'].'/Cart.php' ?>" />
   <?php
       $count
=1;
    foreach(
$cart->Get_Cart_Contents() as $item) {
        echo(
'<input name="item_name_'.$count.'" type="hidden" value="'.$item['info'].' ('.$item['id'].')" />');
        echo(
'<input name="item_number_'.$count.'" type="hidden" value="'.$item['id'].'" />');
        echo(
'<input name="quantity_'.$count.'" type="hidden" value="'.intval($item['qty']).'" />');
        echo(
'<input name="amount_'.$count.'" type="hidden" value="'.number_format($item['price'],2).'" />'); 
        
$count++;    
    }
        
$count--;
        echo(
'<input name="num_cart_items" type="hidden" value="'.$count.'" />');
   
?>   
       </form>     
            
</body>
</html>