Solved

How to handle relational data in drupal?

Posted on 2009-07-09
4
698 Views
Last Modified: 2012-05-07
Hi -

I'm new to drupal and coming from a heavy focus on relational databases.   I'm struggling to do things that I would find easy in a traditional database.

Here's an example of the kind of thing I'd like to solve.

I have a content type called "product image"

I want to classify those images by vendor.  I also have the vendor's address.

So I create another content type "vendor" and give it appropriate fields including state.

Then I create a node reference field in the product image type, referencing a vendor.

All seems well to this point.

But now I want to be able to create a view (views2, drupal 6.x) that shows the images along with the vendor's state.   No dice.  While I can see that state field when defining a view, it shows blank on the resulting view.

Ideally I'd like the user to pick the state and have the images come up that are classified with vendors in that state.    No dice there either.  It seems that the views module only knows how to show & filter the fields from the product image content type, not from the related vendor.

Any suggestions?  This seems so basic to me, so I'd imagine drupal can do it, but I've googled in vain for even basic information to get me started.  I'm wondering if I have to modify the SQL somehow a la http://drupal.org/node/409808, but that seems to be much harder than I'd expect for such a simple thing.


Any push in the right direction would be helpful.
0
Comment
Question by:savageanne
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:oliverpolden
ID: 24819041
use this module to create an automatic taxonomy from your vendors, add the taxonomy to your 'product image' and create the relationship using that: http://drupal.org/project/nat
0
 

Author Comment

by:savageanne
ID: 24819472
Thanks for the suggestion.   I don't fully understand what you are suggesting.  How could I use this to use the vendor's state?  (not the vendor's name)  Of course there could be more than just name and state.  The vendor could have lots of properties that would be of interest.    
0
 
LVL 9

Expert Comment

by:oliverpolden
ID: 24828223
You use the taxonomy to create the relationship and then you can use all the fields you want from the vendor
0
 

Accepted Solution

by:
savageanne earned 0 total points
ID: 25139347
Sorry about abandoning this question.  I've just gotten back to this project and realized that I had not fully understood the options in views.  You can set a "relationship" in a view which provides the ability to establish these kinds of connections.  I didn't get a chance to experiment with the module you suggested.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages. The main difference lies of course …
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now