• Constructing Buy Now Buttons for PHP-eSeller

  • PHP-eSeller

    PHP-eSeller is a shopping cart in PHP where you can add "Buy now" buttons on to an existing web page to sell digital downloads as well as physical items.

    It is also possible to create standard PayPal buttons using PayPal's button factory system and integrate the buttons with PHP-eSeller. This will give PayPal type 'Add to Cart' and 'View Cart' buttons using the PayPal cart system.

    If you wish to use the full shopping cart system then refer to PHP shopping cart page.

  • PHP-eSeller

    Adding Buy Now Buttons

    Clicking on a 'Buy now' button immediately takes you to the PayPal checkout where you buy that single digital download or a single physical item.

    Buy now buttons are used where you only have a few items to sell and you do not expect purchasers to buy more than one item at a time.

    The button or buttons may be placed anywhere on an existing web page which makes it easy to integrate into an existing design. The web page can be of php extension or an ordinary htm page.

    <form action="http://www.yourservername/eseller/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="6">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>

    • The fields that you enter to create the button (those in bold text) are:
    • The 'action' url is http://www.yourservername/eseller/ipn/process.php assuming that you have installed PHP-eSeller at the root of your web site in a folder called 'eseller'.
    • The value of the hidden field is the record id of the product you wish to create the button for. This is the value that in the Products display in the admin pages.
    • The image can be any of the PayPal images or one of your own.
    • When the purchaser clicks on the buy now button, the php script will extract all the relevant data from the database and post it to the PayPal server.

  • PHP-eSeller

    Adding Add to Cart and View Cart Buttons

    Add to cart and view cart buttons can be created manually as shown below.

    These buttons are used where you only have a few items to sell and you do not expect purchasers to buy more than one item at a time.

    The button or buttons may be placed anywhere on an existing web page which makes it easy to integrate into an existing design. The web page can be of php extension or an ordinary htm page.

    Add to Cart Buttons

    <form action="https://www.yourserver.com/phpeseller/basket/yourbasket.php" method="post">
    <input type="hidden" name="recid" value="34">
    <input type="hidden" name="action" value="add">
    <input type="hidden" name="from" value="https://www.yourserver.com/phpeseller/basket/examples.php">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" alt="Add item to cart">
    </form>

    You need to enter the action url which is the full url of the yourbasket.php page. This is located in the installation folder which in the example above is https://www.yourserver.com/phpeseller and then followed by the location of yourbasket.php which is /basket/yourbasket.php

    You also need the record id of the product item. In the example above this is "34". You can get the record id of the item by looking at the product list in the admin area.

    You also need the action hidden field value, which will be "add".

    You can enter a "from" url which is the full url that you want the page to return to when you click on "Continue Shopping" link.

    The button image can be any image that you want. I have used a standard PayPal image.

    The following buttons are linked to my demo site.

    Physical Item 1

    Physical Item 2

    Digital Item 1


    View Cart Button

    And finally, a view cart button to display the shopping basket.

    <form action="https://www.yourserver.com/phpeseller/basket/yourbasket.php" method="post">
    <input type="hidden" name="from" value="https://www.yourserver.com/phpeseller/basket/examples.php">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/view_cart_02.gif" alt="view cart">
    </form>

    You need to enter the action url which is the full url of the yourbasket.php page. This is located in the installation folder which in the example above is https://www.yourserver.com/phpeseller and then followed by the location of yourbasket.php which is /basket/yourbasket.php

    You can enter a "from" url which is the full url that you want the page to return to when you click on "Continue Shopping" link.

    The button image can be any image that you want. I have used a standard PayPal image.

    The following button is linked to my demo site.

  • PHP-eSeller

    Drop Down List Selection

    Use this type of code to allow the selection of different options from a drop down list.

    <form action="http://www.yourservername/eseller/ipn/process.php" method="post">
    <select name="recid">
    <option value="">Select a product</option>
    <option value="1">item 1 $10.00</option>
    <option value="2">item 2 $20.00</option>
    <option value="3">item 3 $30.00</option>
    </select>
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>


  • PHP-eSeller

    Button with Hidden Custom Tag

    Use this to add a custom tag to the button. The custom field is sent to PayPal and then returns via the PayPal IPN where it is stored in the tblSalesHistory table. You might use this in situations where you want some extra information to be returned when the customer makes a purchase such as phone number.

    <form action="http://www.yourservername/eseller/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="1" />
    <input type="hidden" name="custom" value="ref-27" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>

  • PHP-eSeller

    Button with Input Box

    Use this to allow the customer to enter specific information into a text box. The information will be returned via IPN where it is stored in the custom field of the tblSalesHistory table.

    <form action="http://www.yourservername/eseller/ipn/process.php" method="post">
    <input type="hidden" name="recid" value="1" />
    <input type="text" name="custom" />
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>