Results 1 to 6 of 6

Thread: Adding Dynamic Paypal Cart Buttons

  1. #1
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adding Dynamic Paypal Cart Buttons

    Not sure if i should have posted this in the MYSQL forum but here it goes.

    I'm a designer by trade, but have recently started to train myself on backend stuff for sites. I'm not doing too bad either. I have a simple store I set up DWCS3 and had manually created each product description page for each item ()

    After learning basics of record sets and using myphpadmin, i was able to set up a Users table for logging in, and an Events page that the admin can update, insert, and delete records on, once logged in. Works like a charm!

    Now my goal is to tackle the product pages. I want to set up a dynamic page to display each product's information on, as well as an "Add to Cart" Paypal button.

    The first part of this I'm confident in handling. I'll set up a table with an auto-inc id, product id, name, description, price, etc. And I will be using the Record Set tools in DWCS3 to add, retrieve, and display these with no trouble at all.

    The problem I'm going to run into is how to dynamically create a Paypal button so that it is unique to the product displayed, with the correct product id and pricing.

    As of now, I've been using WebAssist's "Add to Cart" extension that writes the code for me by having me input the details in it's GUI. It opens a new window and adds the item to the paypal cart on their remote site. More on the extension and paypals cart feature:
    http://www.webassist.com/professiona...ls.asp?PID=118

    So by doing it this way, I could create fast product pages dynamically, but i would have to go back and add a custom "cart" button to each page. So what's the point right!?!?!

    Here is the code that the PayPal extension plops in. I would like to set this up dynamically. Any help would be appreciated. But remember, i'm a designer just getting into backend stuff so go easy on me!

    Code:
    <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <table><tr><td><input type="hidden" name="on0" value="Size">
     <span class="contact">Size</span></td>
    <td><select name="os0" class="contact">
     <option value="Small 4’7-5’3">Small 4’7-5’3<option value="Medium 5’2-5’10">Medium 5’2-5’10<option value="Large 5’10-6’6">Large 5’10-6’6</select>
    </td></tr><tr><td><input type="hidden" name="on1" value="Color">
       <span class="contact">Color</span></td>
    <td><select name="os1" class="contact">
     <option value="Royal Blue">Royal Blue<option value="Pink">Pink<option value="Blasted Black">Blasted Black<option value="Violet">Violet<option value="Red">Red<option value="Aqua">Aqua<option value="Forrest Green">Forrest Green<option value="Toxic Green">Toxic Green<option value="Lime Yellow">Lime Yellow</select>
    </td></tr></table>
    <br>
    <input type="image" src="http://images.paypal.com/images/x-click-but22.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    <input type="hidden" name="add" value="1">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="business" value="info@prettyhurt.com">
    <input type="hidden" name="item_name" value="Knight Crutches">
    <input type="hidden" name="item_number" value="CLKNT016">
    <input type="hidden" name="amount" value="170.00">
    <input type="hidden" name="no_shipping" value="0">
    <input type="hidden" name="return" value="http://prettyhurt.com/success.html">
    <input type="hidden" name="cancel_return" value="http://prettyhurt.com/cancel.html">
    <input type="hidden" name="logo_custom" value="http://images.paypal.com/images/x-click-but22.gif">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-ShopCartBF">
    </form>

  2. #2
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    You could use PHP's GD functions. I have no experience with them, but I believe there are tutorials allover the place for making butotns. Look at this page:

    http://phpbutton.sourceforge.net/

  3. #3
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, but its not a visual need I am requesting assistance with. It doesn't matter to me if the link is as simple as some html text saying "Add to Cart". What I need to do is dynamically place the correct information from the Product page into the Paypal shopping cart through the link.

    Maybe replacing the values of this part of the code?
    Code:
    <input type="hidden" name="item_name" value="Knight Crutches">
    <input type="hidden" name="item_number" value="CLKNT016">
    <input type="hidden" name="amount" value="170.00">
    I guess im looking for some script to replace these values with matching values of the record set.

  4. #4
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm telling you, im VERY new to this. I played around with it, and i plugged some PHP in the field value. And it worked!! I know I sound stupid, but for any other noobs wandering in the forum, simple retrieve your records in form value like so:

    Code:
    <input type="hidden" name="item_name" value="<?php echo $row_Products['productName']; ?>">
    That's it for now! But I guarantee I will be back with more questions!

  5. #5
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    If I had known what you menat I could have told you that lol sorry

  6. #6
    Join Date
    Aug 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Haha no prob. I don't expect everyone to understand a rook

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •