Using CCK & phpBay Pro in Drupal
So in the main Drupal/phpBay tutorial, I just walked you through setting up a new "page" or "story" with eBay auctions via phpBay Pro.
BUT, this probably isn't going to work for you if you have a blog, or are looking to supplement your existing content with a couple of auctions. Or, what if you want an easier way to create template pages with auction listings, but also want to add good, original content either above or below (or both) the auction listings?
CCK offers a great resourse for this. In fact, I used CCK in building one of the examples for this website (http://www.auctionsinsite.com/phpbay-and-drupal-example2.html).
How did I do it?
- Install CCK module in your Drupal installation
- Go to Admin>>Content Types
- Either create a new content type, or edit and existing type to add the auctions.
- Select "edit" in Admin>>Content Types for the content type you want to add the auctions
- Click on "Add Field"
- Fill out the "Add Field" form, selecting Text>>Text field (press submit)
- Select "Manage Fields" in the content type your editing.
- Change the weight. This will allow you to change where the auctions are going to be displayed on the page (either above or below the main content).
- Select "Configure" field
- Set up field as:
- a. Widget = Text Field
- b. Rows = 9 (you can use more or less, but 9 is what I prefer...this determines how big of a text box you have to work with for the new text field)
- c. Text Processing = Filtered Tex (this allows you to put the phpBay code in the field & show it as an auction.
- d - default value: optional - you can put the default phpBay API variables into the text field here. Then you could customize the variables on each page for the specific auctions to show. This is a great way to save some time and only have to change one or two words in the auction listings instead of adding the code for each page.
That's it! Now you can show your auctions in pages beneath or above your main page content!
A couple of helpful hints:
- Using the default value is great. It makes it a lot easier to add auctions to new pages in a snap.
- Don't forget to change the field filter value to "PHP" when creating/editing your listings for a page. Otherwise you'll just show the raw php code and no auctions.
- Teaser values for fields are set to default, which means they show on default. This can make it look wierd if you show the teasers of articles, followed buy the long auction listings. To get around this, go to admin>>content types>>(edit)>>display field>> and then you can toggle how the field will display. I personally change the teaser value here to and leave the others alone. That way the auctions don't show up in the teasers.

