PayPal Hacks. 100 Industrial-Strength Tips and Tools Free Open Book

PayPal Hacks. 100 Industrial-Strength Tips and Tools

Previous Section  < Day Day Up >  Next Section

Hack 46 Create Shopping Cart Links

figs/beginner.gif figs/hack46.gif

Convert Shopping Cart button code to single-line URLs that can be emailed or linked to images.

Although you can create Shopping Cart buttons [Hack #45] at the PayPal web site, you can also create buttons off-site. This gives web page designers more flexibility and gives programmers the ability to create buttons dynamically with programming code. One of the simplest and most flexible approaches involves creating URLs instead of HTML forms.

5.3.1 The Code

The HTML code for a simple Add to Cart button looks like this:

<form method="post" action="https://www.paypal.com/cgi-bin/webscr"

                target="paypal">

<input type="hidden" name="cmd" value="_cart">

<input type="hidden" name="business" value="pay@paypalhacks.com">

<input type="hidden" name="item_name" value="PayPal Hacks">

<input type="hidden" name="amount" value="24.95">

<input type="submit" name="add" value="Add to Cart">

</form>

The equivalent button in the form of an Add to Cart hyperlink looks like this:

<a href=https://www.paypal.com/cgi-bin/webscr?cmd=_cart&add=1&business=

                pay@paypalhacks.com&item_name=PayPal+Hacks&amount=24.95

                target="paypal">Add to Cart</a>

This link opens a window and displays the PayPal Shopping Cart with one item in it: PayPal Hacks for $24.95.

In both examples, note the presence of the important target="paypal" attribute, which causes the Shopping Cart to open in a new browser window. Without it, the cart will not display a Continue Shopping button. Always include this attribute in your Add to Cart buttons and also make sure paypal is all in lowercase.

5.3.2 Shortening the Link

Many PayPal URLs can be shortened, which can be useful (and sometimes necessary) when sending links in emails, because it prevents them from getting cut at the end of a line. The short link for the Shopping Cart begins with https://www.paypal.com/cart/. Just append all the fields you want to use to the end, as in this payment link:

https://www.paypal.com/cart/add=1&business=pay@paypalhacks.com&amount=20

This works for displaying the Shopping Cart as well:

https://www.paypal.com/cart/display=1&business=pay@paypalhacks.com

Patrick Breitenbach

    Previous Section  < Day Day Up >  Next Section
    Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y]


         Main Menu
    PayPal Hacks
    Table of Contents
    Copyright
    Credits
    Preface
    Chapter 1. Account Management
    Chapter 2. Making Payments
    Chapter 3. Selling with PayPal
    Chapter 4. Payment Buttons
    Chapter 5. Storefronts and Shopping Carts
    Introduction: Hacks #45-50
    Hack 45 Hack Shopping Cart Buttons
    Hack 46 Create Shopping Cart Links
    Hack 47 Specify the Size of the Shopping Cart Window
    Hack 48 Deal with Design and Layout Issues
    Hack 49 Put Both Cart Buttons in One Form
    Hack 50 Integrate a Third-Party Shopping Cart with PayPal
    Hack 51 Customize Checkout Pages
    Hack 52 Display the Merchant Transaction ID on Your Return Page
    Hack 53 Remember Your Customers
    Hack 54 Create a Dynamic Storefront
    Hack 55 Add Dynamic Storefront Details
    Hack 56 Insert Dynamic Images
    Hack 57 Build an Order-Tracking Page
    Hack 58 Offer Discount Coupons
    Hack 59 Increase Search Engine Exposure
    Hack 60 Sell Digital Goods with PayLoadz
    Chapter 6. Managing Subscriptions
    Chapter 7. IPN and PDT
    Chapter 8. The PayPal Web Services API
    Colophon
    Index


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele