2 replies [Last post]
clay_ton's picture
Offline
Joined: 07/07/2011
Juice: 44
Was this information Helpful?

Hey everyone,

I've spent a couple hours looking around for this to no avail and it seems like a really simple answer.

I want to be able to access the Product attributes in the node-product.tpl.php file. For instance, my products have attributes of which colors are available to them and which sizes. These are custom attributes created, and more will be added later. I want to custom print out a grid of options so a user can add multiple sizes and colors by filling in a number, similar to this site -- http://www.crownquality.com/2010/Product.aspx?pid=3422&qid=575 --. However, I am having issue gaining the ability to actually access this information from the script.

I have tried accessing $attributes, $content, and a couple other variables.

Thank you!

Clayton

Clayton

clay_ton's picture
Offline
Joined: 07/07/2011
Juice: 44
Partially figured out

I have kind of figured it out. Through var_dumping a lot of variables, ($attributes[1]->options[number_here]->name) gives me all of the option for one particular attribute.

Next time I add an attribute, is there a standard way to determine how to view it? I feel like I'm really close.

Thanks!

Clayton

Clayton

Cayenne's picture
Offline
Joined: 01/01/2009
Juice: 533
Re: Partially figured out

There are a few modules that have gone through the effort of extracting and parsing the attributes. They are stored as a serialized string, so there is some work to do. Feel free to cannibalize code from my own module "WHo Bought What", which identifies the attributes of a given product and then parses the order to get the values.

M