Working with eBay Feeds
May 11, 2009
For our next major release we are planning an eBay auction plugin module that will allow you to access all details for an eBay auction but for now it still is possible to work with the basic information of an eBay feed. The feeds that eBay publishes are a bit non-standard so they do require a few extra steps to get them to work. Here is a quick tutorial on how to do this.
1. Create a Feed
The first step is to create an RSS feed for the keywords you are searching for. To do this, go to http://search.ebay.com/ws/search/AdvSearch?sofindtype=1 and enter the details you wish to filter on. Notice that near the bottom of the page is an option to enter affiliate tracking tracking information so that you can earn commissions from referrals.
Click on Search to get the results and look for the orange RSS icon on your browser’s address bar. Click on that icon to go to the RSS feed URL. This is the URL you will enter into AutoBlogged.
When you configure your feed in AutoBlogged, you will want to edit the default post template. Near the bottom of the feed settings screen is a post template box. Since the eBay feeds don’t provide a description, you may want to make your post template simply the title and show a thumbnail by entering this as your post template:
%thumbnail%<br />
%title%
2. Update Your Modules.php File
If you are using AutoBlogged 2.4.22 (the current release as of this writing) or earlier, you need to download the Modules.php file attached at the bottom of this article and upload it to your autoblogged directory. This file contains the namespace to access the special eBay fields.
3. Create Custom Fields
At this point you can use any of the following variables in your post template:
- %rx:CurrentPrice%
- %rx:EndTime%
- %rx:BidCount%
- %rx:AuctionType%
- %rx:ItemCharacteristic%
Although you can use these directly in your post template, you will find that the data in the CurrentPrice and EndTime fields aren’t properly formatted for display. For example, the CurrentPrice will not display decimal places so a value of $14.99 will appear as 1499. Furthermore, the End
Time appears as a number timestamp, not a formatted date. For that reason, the best solution is to save each field as a custom field on the post that we can access later.
To do this, at the bottom of the feed page in AutoBlogged, fill out the Custom Fields section as shown below:
Note that the Custom Fields section only provides two new entry boxes at a time so you will need to save the feed to get two more. Also note that if you don’t plan on using any of the above fields in your post, you may leave those out.
At this point AutoBlogged will not display any of this extra information but it will save the values to each post as custom fields. If you run AutoBlogged now and edit one of the posts, you will see these values as custom fields. To display this information on your site you will need to modify your WordPress theme.
4. Modify Your Theme
To view the eBay custom fields, you need to modify one or more files in your theme, depending on where you want these values displayed. For example, if you want them shown on your home page, you will need to modify index.php, or whatever file your theme uses for the main loop. If you want to modify single posts, edit the file single.php. Note that not all themes are the same, but these instructions will work for most themes.
When you edit the file, you can usually find the place where posts are displayed by searching for the_title(). Once you determine where to place the information, you can access the post’s custom fields with this code:
Current price:
<?PHP echo number_format((get_post_meta(get_the_ID(), ‘CurrentPrice’, true)/100), 2, ‘.’, ‘,’); ?>
End Time:
<?PHP echo date(‘M j g:i a’, doubleval( substr(get_post_meta(get_the_ID(), ‘EndTime’, true), 0, -3))); ?>
Bid Count:
<?PHP echo get_post_meta(get_the_ID(), ‘BidCount’, true); ?>
Auction Type:
<?PHP echo get_post_meta(get_the_ID(), ‘AuctionType’, true); ?>
Item Characteristic:
<?PHP echo get_post_meta(get_the_ID(), ‘ItemCharacteristic’, true); ?>
To see an example of this in action, we have attached to this post a modified index.php from the Default WordPress theme. Below is a an example of how this would appear:
Of course not all themes will be this simple so it may help to know HTML and/or PHP to tweak this how you need it.






Blog Posts