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 56 Insert Dynamic Images

figs/moderate.gif figs/hack56.gif

Include product images with your dynamic storefront and use it to activate the PayPal payment process.

Once you've added dynamic storefront details [Hack #55] to your site, you can include a product image that can be used as a PayPal button, as shown in Figure 5-10. The idea is that customers typically look for the most obvious object to click when they're interested in a product, and turning the product image into a PayPal button is an effective way to get more customers to complete purchases.

Figure 5-10. Displaying an image with your product information
figs/pph_0510.gif


5.13.1 Inserting the Image

Start by adding another database table column, image_file, to the tblProducts table created in [Hack #54] and populating it with the location (filename) of the image file to be displayed. So, for your widget, you might enter widget.jpg.

Next, take the code from [Hack #55] and add the image_file column to your SQL query:

"SELECT item_name, item_number, item_price, Id, description, image_file 

                FROM tblProducts WHERE Id = " & Id

See the "Database Coding and Platform Choices" section of the Preface for the additional information needed to put this SQL statement to work with this and the other hacks in this book.


Then add your image file reference code to display the image on your product details page using the following line:

<img src="images/products/<%=rsProducts("image_field")%>">

In this example, the product images are stored in /images/products. Insert this code in your page to include the dynamic image, just above the item name:

<img src="images/products/<%=rsProducts("image_field")%>">

Product: <%=rsProduct("item_name")%><br>

Price: <%=rsProduct("item_price")%><br>

<a href="detail.asp?id=<%=rsProducts("Id")%>>Product details, click here</a><br>

Click the button below to Buy<br>

<form target="paypal" action=

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

<input type="hidden" name="business" value="youremail@yourisp.com">

<input type="hidden" name="item_name" value="<%=rsProducts("item_name")%>">

<input type="hidden" name="item_number" 

                value="<%=rsProducts("item_number")%>">

<input type="hidden" name="amount" value="<%=rsProducts("item_price")%>">

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

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

<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif"

                border="0" name="submit">

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

</form>

<br>

<%=rsProducts("description")%>

5.13.2 Link the Image to PayPal

To use the product image as a PayPal payment button, duplicate the purchase button code and replace the Buy Now image with the location of your product image [Hack #29] . The resulting code should look something like this:

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

                method="post">

<input type="hidden" name="business" value="youremail@yourisp.com">

<input type="hidden" name="item_name" value="<%=rsProducts("item_name")%>">

<input type="hidden" name="item_number" 

                value="<%=rsProducts("item_number")%>">

<input type="hidden" name="amount" value="<%=rsProducts("item_price")%>">

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

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

<input type="image" src="images/products/<%=rsProducts("image_field")%>""

                border="0" name="submit">

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

</form>



Product: <%=rsProduct("item_name"%><br>

Price: <%=rsProduct("item_price"%><br>

<a href="detail.asp?id=<%=rsProducts("Id")%>>Product details, click here</a><br>

Click the button below to Buy<br>

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

                method="post">

<input type="hidden" name="business" value="youremail@yourisp.com">

<input type="hidden" name="item_name" value="<%=rsProducts("item_name")%>">

<input type="hidden" name="item_number" 

                value="<%=rsProducts("item_number")%>">

<input type="hidden" name="amount" value="<%=rsProducts("item_price")%>">

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

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

<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif"

                border="0" name="submit">

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

</form>

<br>

<%=rsProducts("description")%>

Of course, you might want to link the product image to a larger version of the image, a list of other products by the same manufacturer, or a page containing further details of the product. However, be careful not to discount the power of a big fat payment button on every product page: the easier it is for your customers to pay, the more likely they'll give you their business.

    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