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 45 Hack Shopping Cart Buttons

figs/beginner.gif figs/hack45.gif

Change code from the PayPal Button Factory to provide flexibility for your Shopping Cart.

PayPal's Shopping Cart allows merchants to provide the ability for customers to purchase a basket of goods rather than buy one item at a time with Buy Now buttons. The Shopping Cart system is ideal for stores with many items, but it doesn't make sense to use the PayPal Button Factory to create each and every button for your store. Instead, you can create a single generic Shopping Cart button and then use the HTML code as a template for all your items.

To generate the code for a simple Shopping Cart button, follow these steps:

  1. Go to http://www.paypal.com, log into your account, and click the Merchant Tools tab.

  2. Click on the Shopping Cart link under the Website Payments section to open the PayPal Shopping Cart Button Factory, as shown in Figure 5-1.

    Figure 5-1. Using the PayPal Button Factory to create Shopping Cart buttons
    figs/pph_0501.gif


  3. Create a basic Shopping Cart button by entering any information for the item name and item number.

  4. When you're done, click Create Button Now to generate the code.

The resulting code for the Add to Cart button should look like this:

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

<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!">

<input type="hidden" name="add" value="1">

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

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

2.  <input type="hidden" name="item_name" value="Widget">

3.  <input type="hidden" name="item_number" value="Wid-001">

4.  <input type="hidden" name="amount" value="1.00">

<input type="hidden" name="no_note" value="1">

<input type="hidden" name="currency_code" value="USD">

</form>

Lines 2-4 contain the three variables that define the details of the individual product, such as the product name, item number, and price. All the other variables remain the same for all of your products. Make sure to specify the email address for the account you want to use on line 1, although any button you create with the PayPal Button Factory includes your email address by default.

The Button Factory also provides code for a View Cart button:

<form target="paypal" action=

                "https://www.paypal.com/cgi-bin/webscr" method="post">

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

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

<input type="image" src="https://www.paypal.com/en_US/i/btn/view_cart_02.gif"

                border="0" name="submit" alt="Make payments with PayPal - it's 

                fast, free and secure!">

<input type="hidden" name="display" value="1">

</form>

Place this second block of code, as is, on all the pages of your web store to allow your customers to display the items they have added to their cart, as well as initiate the checkout process when they have finished shopping. The only variable you'll need to customize in this example is business, in which you specify your email address. Figure 5-2 shows the resulting page.

Figure 5-2. The Add to Cart and View Cart buttons: all you need to implement PayPal's Shopping Cart interface on your web site
figs/pph_0502.gif


5.2.1 Hacking the Hack

The PayPal Shopping Cart allows extensive customization using the additional variables supported by regular Buy Now buttons [Hack #28] . For example, the handling_cart variable allows you to define a cart-wide handling charge to be applied to the entire order, regardless of any individual handling charges you might have specified:

<input type="hidden" name="handling_cart" value="4.00">

The handling_cart charge takes effect when the first item is added to the cart.

    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