CCK Taxonomy field in Product content type

Posts: 50
Joined: 09/09/2007

Hi!

I'm building a store for antiques. I have enabled the Manufacturer module, that turns into a taxonomy category, but I need to set up a Designer - Artist category as well. I want to add a CCK field to the product content type where I can choose from a category. Do you recommend any one module in particular? Or can this be done in another way?

Posts: 50
Joined: 09/09/2007

Can anybody with programming knowledge let me know if it is possible to add a CCK field that prints the category terms for a product.

I want to add taxonomy terms to a product node the usual way, but also use that term in the description of the product like this:

CCK fields for Product
Designer - Artist: Arne Jacobsen (this is also a category term from the Artist - Designer category)
Product: Seven
Year: 1955
Technique: Laminated wood and steel
Manufacturer: Fritz Hansen, Denmark (this is also a category term from the Manufacturer category)

How can I add a CCK field kinda like this:

Designer : "taxonomy/term/1/" or something? Eye-wink

Posts: 50
Joined: 09/09/2007

I found a PHP field in the edit CCK field page. How do I print out the terms from a category? Need to learn PHP... sigh. Sad

Posts: 2008
Joined: 08/07/2007
AdministratoreLiTe!

Since you're working with nodes, the taxonomy terms should be available to you anyway. All the terms are stored in $node->taxonomy when the node is loaded.

Where do you want to print them out?

Posts: 50
Joined: 09/09/2007

I have added quite a few CCK fields to the product content type. I have created the taxonomy categories and added terms. I just don't want to add them manually again to the node CCK fields, but instead print the terms that are associated to the node.

There is a PHP field under "Default value" in a text field CCK. Can I add a snippet there to display the terms for a specified category?

Product node fields:

Artist: print term from category Artist (automatically generated)
Year: standard CCK field - editor specifies
Technique: list of techniques - editor specifies
Manufacturer: print term from category Manufacturer. automatically generated)

Do I make sense? Eye-wink

Posts: 2008
Joined: 08/07/2007
AdministratoreLiTe!

OK, I understand.

Instead of CCK, I think I recommend Contemplate which lets you theme your nodes and shows you all the different parts of the node that you can use. You still have to learn a little PHP, and Contemplate has annoying default values for its templates.

The main reason I recommend it is because I know it works. With CCK fields, I'm not so sure you have access to the $node object automatically.

Posts: 50
Joined: 09/09/2007

Contemplate? Ok... I'll give a serious try. A little PHP? Eye-wink Well...

Where can I find the values and variables I can use? I am a total noob on such matters.

Thanks! We'll donate if I ever get this store up and running. Smiling

Posts: 50
Joined: 09/09/2007

My, my, I feel stupid. Sad No luck. I read PHP like you read Swedish. Eye-wink

I have to do it the hard way then I guess. Double work, but at least I'll get going.

Posts: 8
Joined: 08/07/2007

Hi Lyle,
you said:
"Since you're working with nodes, the taxonomy terms should be available to you anyway. All the terms are stored in $node->taxonomy when the node is loaded.

Where do you want to print them out?"

How can i print out and theme the manufacturer link on products page? How can i get the right taxonomy term?
I know, with

<?php
print $terms
?>
i get all terms, but i want only the manufacturer term.
I tried such as
<a href="<?php print $node->taxonomy['term']['#value'] ?>" title="manufacturer info" class="manufacturer">manufacturer info</a>
on node-product.tpl.php. But it doesn't work and i'm not a php programmer.

In contemplate there is no variable for this on content-type "product".