|
PAYPAL
SHOPPING CART
LESSON
TWO
EXPLAINING THE CODE
INTRODUCTION | EXPLAINING
THE CODE | THE DOWNFALLS | EXPANDING
THE SHOPPING CART | VIEWING THE SHOPPING CART | LAST
NOTE
Using
the PayPal code from the last lesson we'll take it line
by line and explain what is happening. The normal HTML code
regarding the TABLE generation is not explained as it is
assumed understood by the viewer or else you're not really
ready to sell stuff on-line.
The
following is basic HMTL coding in Gold.
The PayPal specific code is in Yellow and
the explanation is in White. Remember anything in white
is NOT part of the coding.
|
<form
target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
--Opens
the necessary FORM and tells you where it will go
and how.
<table>
<tr>
<td>
<input
type="hidden" name="on0" value="SHAPE">SHAPE
--Gives
the PayPal name "on0" the
value of SHAPE and not seen by the viewer.
</td>
<td>
<select name="on1">
--Creates
drop down menu called "on1" to hold selected
value of the three presented here.
<option value="Square">Square
<option value="Round">Round
<option value="Triangle">Triangle
</select>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="os0" value="COLOR">COLOR
--Gives
the PayPal name "os0" the value of COLOR and
not seen by the viewer.
</td>
<td>
<select name="os1">
--Creates
drop down menu called "os1" to hold selected
value of the three presented here.
<option value="White">White
<option value="Blue">Blue
<option value="Red">Red
</select>
</td>
</tr>
</table>
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0"
name="submit" alt="Make payments with PayPal - it's fast, free
and secure!">
--This
gets the 'ADD TO CART" button image from PayPal, assigns
the "submit" value to it and generates the proper alternate
text to it
<input type="hidden" name="add" value="1">
--This
is the number of items to be added to the Shopping
Cart
<input type="hidden" name="cmd" value="_cart">
--
This line tells PayPal it is for the Shopping Cart
<input type="hidden" name="business"
value="someone@somewhere.com">
--This
identifies who's PayPal business account this is for, always an
E-Mail address of yours.
<input type="hidden" name="item_name"
value="FLOWER POT">
--Defines
FLOWER POT as the name of the item
<input type="hidden" name="item_number"
value="14"">
--Defines
14" as the item number. (" is code for the "
character) This is a second item identification much like a part
number or anything you set.
<input type="hidden" name="amount" value="8.95">
--Sets
the amount as 8.95 (no dollar sign needed)
<input
type="hidden" name="return" value="http://www.yoursite.com/thankyou.html">
--This
is the path to the page your viewer will be sent to after the
transaction is complete.
<input type="hidden" name="cancel_return"
value="http://www.yoursite.com">
--This is the path to the
page your viewer will be sent to if they cancel the
transaction
<input type="hidden" name="no_note" value="1">
--I have no idea what this
means but you need it!
<input type="hidden" name="currency_code"
value="USD">
--Sets the currency to be
used for the transaction
</form>
|
It
may look complicated but it is very simple once you understand
what all of the required fields need and what they do. This
code can be used for virtually any items you may wish to
sell. As you can see for simple items like this example
it works well. For more somewhat complex items this code
will work just as easy and we will cover this further on.
A
potential client on your Site would be presented a choice
for the 14" FLOWER POT as to its Shape and Color. If
the $8.95 price was agreeable they would click the ADD TO
CART button and would be taken to PayPal's Shopping Cart
to review their tentative purchase. The Shopping Cart would
look like this:
You
can see the various values set in the code and plugged into
their proper places in the Shopping Cart. Take the time
to match each Shopping Cart data to the values set in the
code. You should be able to easily understand what is happening.
By changing different values in the code you should be able
to understand what will be changed in the Cart.
By
cutting and pasting this code into any catalog page, changing
required fields in the form, you are able to create a massive
catalog of items for sale. This is wonderful, but there
are downfalls and we'll cover them next. When you are ready
click HERE
|