I've been working on a website/application that allows quotes to be requested for international removals. The quotes are added to the site by using a CCK form. Within this form, there are 2 fields that contain taxonomy terms. 1 fields is "current location" and 1 field is "new location". When clients fill in this form, they can enter where they move from, and where they move to.
These 2 fields are filled with taxonomy terms, ordered by region and country, like this:
Europe
- Netherlands
- Spain
- France
- ...
Australia
- Australia
- Fiji
- New Zealand
- ...
The people that fill in this form, can only select a country, not just a region.
Another content type I've got is "removers". This content type contains 2 Content Taxonomy fields that are filled with regions only, from the same vocabulary as the one described above, like this:
Europe
USA
Australia
Africa
...
So if a remover selects that he removes clients from region Europe to region Australia, and a client wants to move from The Netherlands to New Zealand there's a 'match'..! Here comes the part that's hard for me to understand....
I want to store the 'matches' in a separate database table, for different purposes. So I've created an extra table that contains:
mid (match ID)
mcriterium1 (first taxonomy term to match on)
mcriterium2 (first taxonomy term to match on)
nid1 (node ID from consumer that requested a quote)
nid2 (comma separated list with node ID('s) from remover(s) that matches the 2 terms)
I am able to create a query that searches for content matching the requested taxonomy terms, that's not a big problem. The problem is to get this query into a Drupal Module. I'd like to add a button above a View table that, when clicked, matches consumers to clients, but I have no idea how to get started.
I assume I need to write a function that matches Client to Consumer by terms, and display the output on a separate page, and while were at it, also copy the matched data into the separate table.
Can somebody point me to the right direction how to achieve this? Thanks in advance!
Comments
I always thought a
I always thought a not-responding community means a bad community, but in this case it was quite a bible of text I wrote, while the solution was rather simple. Not replying to my problem made me look even better and I found it at last. Thanks :)
Perform a query on the database, inner join node_term and filter out contents that has the same Terms attached as the current node. Rather easy :)
Solved :)