Recipe for Classifieds in Drupal 4.7

If you are an Active Farming member or visitor, I'm sorry but this page has nothing to do with farming. This is a technical page about the platform we use.

Recipe for Classifieds in Drupal 4.7.

This is a recipe on how to get Classifieds in Drupal 4.7 like: http://www.activefarming.org/classifieds

Overview: This recipe uses these (up to date) items:

  • Drupal 4.7
  • Views.module
  • flexinode.module
  • style.css (for your theme)

1) The first thing you need to do is create a custom flexinode. Create the fields that you want people to be able to enter. Some recommendations are: Title, Description, Name, Email, Phone Number, Price, and Pictures. Do not create fields that you would want people to be able to filter the classifieds by (state, category etc).

2) Create Categories (taxonomy) with the terms you want people to choose from and assign your flexinode as "type". I would suggest having at least:

  • Regions (state, country etc)
  • Category (Real estate, clothes, cars, trailers etc...)
  • Type of ad (for sale, wanted, rent, etc)

3) Create a custom template.php file in order to use a custom node-flexinode-*.tpl.php file.

4) Customize your node-flexinode-*.tpl.php file where * is your flexinode number. Be sure to add your taxonomy "categories" to the node in a way that will make sense to the end user.

5) Create a custom "view" using views.module. Make it a "Page" and "table view." Next, choose the "fields" you want shown on the classified table view. Next, choose the filters you want the type to be able to be filtered by. Choose which filters you want to "expose" to the end user. Next modify all the permission and misc view settings to get it to appear the way you want.

6) Next, edit your style.css file to get the classifieds to look the way you want them to. You can adjust the tabs, colors, padding, etc...

7) Visit "access control" and make sure you set role permission for creating your classified ads.

8) That's about it!

This is my first attempt at creating a "recipe" for drupal. If you have any questions or if I'm not clear enough on a point, please let me know. I'm sure I'll have to make some changes to this once I get some feedback from other users. Once I get a more final copy, I'll submit this to the Drupal Handbook.

I may also be willing to install a classified on your site if you need help for a fee. Contact me for information.

icenogle's picture

In step #2, I take it that

In step #2, I take it that you when you say "Create Categories (taxonomy)" you actually mean "Create Vocabularies and Categories?" For example, Regions would be one vocabulary, Category another, etc.

I'm implementing your scheme and want to make sure I'm doing it right.

Admin's picture

Yes, you want to create a

Yes, you want to create a multiple main vocabularies with multiple terms in each. For example, in "Regions" you want a term for each state etc... Then make another "vocabulary" for "Category" and create terms inside of "Category" such as general merchandise, clothes, cars, trucks, etc...

icenogle's picture

A couple more

A couple more questions...

1) I only just became aware of the "Content Creation Kit" (CCK). Have you looked at this? (I'm a little worried that it may be "the next big thing," particularly if it replaces flexinodes.)

2) If one wanted to do a conventional classifieds section, a la craigslist, then different ad types would require different forms. For example, you would have different fields in a "jobs" listing than you would in a "for sale" listing, etc. Is there room in your scheme for different forms?

I appreciate what you have done here. Forgive me if I ask too much?

Admin's picture

From what I've read in the

From what I've read in the past about CCK is that they are working on a module to go with it that will update a site from flexinodes to CCK. I'll look to see if I can find where I read this at.

icenogle's picture

Good... Right now, CCK

Good... Right now, CCK seems pretty raw. I can't find much on the way of documentation for it. And I really like the idea of having a picture field, and CCK doesn't appear to have one. Otherwise, I might give it a shot. I'm at the point now of trying to grok how to lay out the fields in a flexinode. (Seems ripe for some kind of js layout applet.) Then it's on to the views piece. This is pretty interesting for a relative newbie...

icenogle's picture

Be sure to add your


Be sure to add your taxonomy "categories" to the node in a way that will make sense to the end user.

Do you happen to have a code snippet for extracting "category" and "type" taxonomy selections for display in the flexinode?

Admin's picture

Just following the

Just following the instructions in this section of the Drupal Handbook:
http://drupal.org/node/45475

It's fairly simple to customize your layouts. Just create your template file and then custome flexinode tpl files.

Admin's picture

To add specific taxonomy to

To add specific taxonomy to a custom flexinode tpl file use something like:


$terms14 = taxonomy_node_get_terms_by_vocabulary($node->nid, 14);
 if ($terms14) {
  print 'Type Of Classified Ad: ';
     foreach ($terms14 as $key => $term14) {
     $lterm14 = l($term14->name, 'taxonomy/term/'.$term14->tid);
  print $lterm14.'  ';
     }
  print '';
 }

Enclose in PHP tags. Replace "14" with your vocab id # and replace "Type Of Classified Ad:" with the label you want

Jabzebedwa's picture

I am stumped. I am unable

I am stumped. I am unable to find Flexinode for 4.7. I have searched and it appears to me that the most recent module is for 4.6. I've had bad experiences in the past with not using the right module for the Drupal version.

Gracias!

Ben

Jabzebedwa's picture

Any thoughts on how I can

Any thoughts on how I can install Flexinode in 4.7?

Thanks,

Ben

Admin's picture

Hi Ben, We are using a

Hi Ben,
We are using a patched CVS version of Flexinode. I believe the "patch" has been committed and you can use the current CVS version.

icenogle's picture

I have succeeded in

I have succeeded in implementing your scheme, though I had some difficulties working things out with taxonomy access, and with getting the filter settings just right.

Have you thought about how to handle deletion of items? It would be really nice to have edit/delete buttons in their own column, to the right of items that the current user has edit control over, but I'm not sure how to approach that.

Thanks for doing this! It's wonderful!

sdyson's picture

Thanks for this recipe. Any

Thanks for this recipe. Any idea how to filter the view to only show classified from the last 2 weeks (or similar time period)?

vincent's picture

I am using CCK + Taxonomy

I am using CCK + Taxonomy for my classified ads.
I have this configured nicely with 2 categories: Type of Ads (offer/demand) and category: book, tv, car...

I have set-up the views and this works fine.

However there is something I cannot do seem to configure:
In the result of a view, the table contains for each row:
title of the ads
text of the ad,
date,
type of the ad (taxonomy term)
category of the ad (taxonomy term)

Those last 2 fields are linked to the a url: taxonomy/term/ when clicking on a link I have a list of my ads for that category containing teasers for the ad.
On your site however you have another table...how did you manage to do that?

Admin's picture

Create another view for

Create another view for terms pages. This also prevents search engines from seeing 404 errors if the category is empty.

vincent's picture

So the view for the terms

So the view for the terms then override the defaut taxonomy/term/ view in that case?

Admin's picture

Yes it will override the

Yes it will override the default view. There are some examples of this in the view's project issues section of the drupal website.

cation555's picture

Hi, I am a newbie to drpal

Hi,

I am a newbie to drpal and a bit confused about creating the custom tpl file. I would greatly appreciate it if you could shed some light on my dilemma.

I have created custom content types title, name, address which are 3 different flexinodes.

I have also created vocabulary (e.g. Region) with terms (like north, south). When I preview the vocabulary "Region" form the drop down menu contains the "" option but not any "" option. How can I fix this?

Secondly,

In http://drupal.org/node/45475

Do I just edit the "flexinode_9", ....,"flexinode_12" portions of the code and point them to the the 3 flexinodes I have created while leaving the rest of the code unchanged? How will this be linked to the vocabulary I have created?

Thanks in advance,

darobu's picture

Thanks for sharing this. I

Thanks for sharing this. I think I'm close to getting it set up on my site. What did you use for getting images into your flexinodes?

drb

netceo's picture

Hi i am trying to implement

Hi i am trying to implement similar functionality on my site, but am not able to grasp as to how to implement custom view for terms. Can you please elaborate a bit? I'd be highly obliged.

and how do you put these on top of the page?? are they diff views or what?

* Classifieds
* Hay Directory
* Animal Directory
* Farms For Sale

thanks in advance,

Sham

netceo's picture

ok this much done.. only

ok this much done.. only thing.. how do you populate the drop boxes with "all" by default?