PROGRAMMING SHOP CART CHECKOUT BUTTON
PHP
$con = mysql_connect($hostname, $username, $password);
$sqlcart = “ SELECT * FROM ORDERCART “;
$sqlcart .= “ WHERE USERID=” . $userid;
$FORDERCART = mysql_query( $SQLCART, $CON );
$paypalurl = “https://www.paypal.com/cgi-bin/webscr”;
$ipn_listener = http://www.ECOMMERCEWEBSITE.com/ipn_listener.php;
$downloadurl = “http://www.ECOMMERCEWEBSITE.com/download.php”;
<form method=”post” action=”<?php $paypalurl ?>”>
While ($cart = mysql_fetch_object($FORDERCART)) {
$COUNTER = $COUNTER + 1;
$itemno = $cart->itemno;
$sqlitm = “ SELECT * FROM PRODUCT “;
$sqlitm .= “ WHERE ITEMNO=” . $itemno;
$FPRODUCT= mysql_query($sqlitm , $con);
$itmmst = mysql_fetch_object($FPRODUCT);
$description = $itmmst->description;
$qty = $cart->qty;
$sprice = $cart->sprice;
$amount = $cart->amount;
$item_name_fld = “item_name” .”_”.$COUNTER;
$quantity_fld = “quantity” .”_”.$COUNTER;
$amount_fld = “amount” .”_”.$COUNTER;
<input type=”hidden” name=”<?php $item_name_fld ?>” value=”<?php $description ?>”>
<input type=”hidden” name=”<?php $quantity_fld ?>”
Value=”<?php $qty ?>”>
<input type=”hidden” name=”<?php $amount_fld ?>” value=”<?php$sprice ?>”>
}
<input type=”hidden” name=”upload” value=”1”>
<input type=”hidden” name=”notify_url” value=”<?php $ipn_listener ?>”>
<input type=”hidden” name=”return_url” value=”<?php $download_url ?>“>
<input type=”hidden” name=”cmd” value=”_cart”>
<input type=”submit” value=”PROCEED TO CHECK OUT”>
</form>
ASP
SQLCART = “ SELECT * FROM ORDERCART “
SQLCART = SQLCART & “ WHERE USERID=” & SESSION.SESSIONID
SET FORDERCART = Server.CreateObject(“ADODB.RECORDSET”)
FORDERCART.OPEN SQLCART, CON
PAYPALURL =”http://www.paypal.com/cgi-bin/webscr”
IPN_LISTENER =”http://www.ecommercewebsite.com/ipn_listener.asp”
DOWNLOADURL =”http://www.ecommercewebsite.com/download.asp”
BUSINESS ="leahong2004@yahoo.com"
Response.Write(“<form method=’post’ action=’” & PAYPALURL & “’>”)
COUNTER =0
Do While Not FORDERCART.EOF
COUNTER = COUNTER + 1
Item_name_fld = “item_name” & “_” & COUNTER
Quantity_fld = “quantity” & “_” & COUNTER
Amount_fld = “amount” & “_” & COUNTER
If isnull(FORDERCART(“ITEMNO”)) Then
Else
End If
If isnull(FORDERCART(“QUANTITY”)) Then
Else
End If
If isnull(FORDERCART(“SPRICE”)) Then
Else
End If
Response.Write(“<input type=’hidden’ name=’business’ value=’” & BUSINESS & “’>”)
Response.Write(“<input type=’hidden’ name=’notify_url’ value=’” & IPN_LISTENER & “'>”)
Response.Write(“<input type=’hidden’ name=’notify_url’ value=’” & IPN_LISTENER & “'>”)
Response.Write(“<input type=’hidden’ name=’return_url’ value=’” & DOWNLOADURL & “’>”)
Response.Write(“<input type=’hidden’ name=’upload’ value=’1’>”)
Response.Write(“<input type=’hidden’ name=’cmd’ value=’_cart’>”)
Response.Write(“</form>”)
No comments:
Post a Comment