How to Display eBay Auctions in Drupal using phpBay Pro

How to Display eBay Auctions in Drupal using phpBay Pro

Posted by AuctionsInSite.com on Wed, 11/07/2007 - 22:59 in

NEW phpBay Pro API version 3.0!! Now there's no need to manipulate the API code for it to work in your Drupal site! All you need to do is follow these easy steps:

1. Buy the phpBay Pro API.

2. Unzip files and make changes in config.php according to the API features you want to enable.

3. Upload files into root directory of your site.

4. Add .htaccess lines provided in the API .htaccess file to your Drupal site's .htaccess file ABOVE the clean url lines you already have active.

5. Insert the following code and update for the specific auctions you want to add

<?php
require_once("phpbay/ebay.php");
phpBayAPI("apple tv", 15, "171", "");
?>

That's it!! However, if you're still using the older version of the API, you can follow along with the tutorial below.

+++++ Note the following DRUPAL tutorial is out of date due to the release of version 3.0 of the API. Only follow the below steps if you are using a version older than 3.0 +++++

If you haven't already configured phpBay to work with Drupal, please visit Configuring phpBay Pro to work in Drupal to make sure everything is set up properly.

Now that you have configured the phpBay Pro API to work with Drupal, it's time to learn how to display ads in your web site.

phpBay Pro comes with several examples and templates for showing auctions in your website. To display auctions in Drupal, we will be using the code samples provided by phpBay in content sections with the filter set to PHP. phpBay comes with 7 examples ready for use, and also contains instructions on displaying as much or as little information for auctions as you desire. Please refer to phpBay Pro's documentation for specific code references and snippets.

For displaying our first set of ebay listings on your website, we'll use the sample code provided by phpBay in "example4.php," and place this code in a new "page" for display in our Drupal site.

Step 1:

Open up "example4.php" (not in browser, in text or code editor) and copy the php code following The Result. You'll note that the php code begins with <? and ends with ?>(make sure you copy these beginning and ending markers).

Step 2:

Select "create content" in Drupal, and create a new "page."

Step 3:

Paste the code copied from "example4.php" into the "body" section of the "page" you are creating. Note that in Drupal, you'll need to begin the code with <?php instead of just <? .
Step 4:

Replace require_once("ebay.php") with require_once("ebay/ebay.php") . The ebay/ may vary depending on the folder in which you placed the phpBay Pro API.

Step 5:

Adjust the input filter for the "page" to "PHP Code"

Step 6:

Select either "Preview" or Submit" to view your new auction listings.

Congratulations! You should now see a list of ebay auctions in your site on the newly created page. If you do not see the auctions, or recieve an error message, please review steps 1 through 5 of Configuring phpBay with Drupal above, and make sure all changes have been accurately made.

If you do see the auctions, hover over the links for the auction image and auction titles. You should see AID= & PID= in the links, and the PID= should have your eBay Commission Junction or Mediaplex ID after it.

You now know how to incorporate live eBay auctions into your Drupal website! There are many different ways you can adjust the output of phpBay, and I recommend starting with the supplied documentation for the phpBay Pro API for more information on how to manipulate your query results.

Now anywhere you can insert php code in your Drupal site, you can now show live eBay auction listings and earn commissions for your website! The customization possibilities are endless!

New Forum Post: Using CCK

I've added a new forum post walking you through using CCK in Drupal to show auctions. This is a good trick that can save time by setting up the default phpBay API values on each page, and also provides some flexibility by separating the php code into a different content field.

http://www.auctionsinsite.com/using-cck-drupal-ebay-auctions.html

Posted by AuctionsInSite.com on Wed, 11/21/2007 - 17:43