Hey everyone, I'm having trouble planning the best way to set this up:

I have three CSV files that I'm going to import into drupal using Feeds:

Products: (one to one)
-> Product ID
-> Attribute
-> Attribute
-> etc...

Material Groups: (one to one)
-> Material Group ID
-> Description

Product Material Groups Map (many to many)
-> Product ID
-> Material Group ID

I need to display products BASED on their Material Group - THEN based on values in the Products Attributes.

I can think in my head how it would layout using basic queries, but I need this to be all set up in drupal for a client. How would you set this up? Create content types for each CSV above? Use taxonomy?

I cant seem to get the results I need.

Any help would be great!

Comments

ludo1960’s picture

Have a look at http://drupal.org/project/hierarchical_select worth a shot me thinks!

steeph’s picture

You can either use taxonomy or a text field. The text field would have the advantage that you can associate a Material Group name with an ID. So the imported ID is what is saved in the database but the name gets displayed. Taxanomy would have the advantage that the terms (Material Groups) can have an order, so the Material Group with the ID 1 is not necessarily what gets displayed first when you sort them.

Then you can use the Views module to display/list the products. You can sort them by Material Group and then Product Attributes (if that's what you meant). Views is what you use in Drupal for custom queries.

mylocaltrades’s picture

You could import and categorise using taxonomy. Feeds and taxonomy modules are pretty clever. In you CSV file in the taxonomy fields you could use something like this:

Products/Material Groups/etc/etc1

When you import that product, feeds and taxonomy will understand to add that product to the end child taxonomy term. (in this case etc1) Also you do not need to create the taxonomy terms as these will automatically be created on import. If you have many categories you could use the taxonomy manager module to structure them more easily)

Once all your products are in the structure / taxonomy terms / child taxonomy terms you can then decide how you wish to provide this information / taxonomy catagory/s to the user.

Hope this helps

Offering Drupal website services to the UK - www.my-local-trades.co.uk

satchownz’s picture

I think I've figured out a solution... check this out:

Step one - import all material groups in a vocabulary:
-> Term name = MaterialID
-> Term Description = Material Description

Step two - import all products, using mostly text fields for the attributes. Note, I'm adding a term-reference field called "materialGroupId"

Step three - import my Product Material Group Mapping csv ... but here's my issue:

The product ID is stored in both the products and product-mapping csv. So, if I just use that as a unique field during import - I can update each product entry, adding a "tag" to the materialGroup field. Thus associating each product the correct material group(s).

But, can the Feeds import "update" a field and add a tag? Looks like it "replaces" all the tags rather than add one. Because the mapping table is a many-to-one, there will be multiple material groups for each product ID. I just need it to add each Material ID to the Product each time it comes up in the list.

Thanks for all your help! I'm seriously close.

ludo1960’s picture

Nice to see you are making progress, much smarter guys out there than me me, but can't you just use SQL to solve the "I just need it to add each Material ID to the Product each time it comes up in the list" issue?