Default value as Ubercart attribute option

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
atomicbop's picture

I'm having a major problem with displaying Ubercart attributes. I need to get each attribute option's price to display in it's own cck field. I have tried using default value using the php input, and also using Computed Fields module. The values should display, but they are not.

This is the code for the value:

$node->attributes[1]->options[1]->price

If I print this in node.tpl.php, it shows. Why wouldn't it show in a cck field? I've also tried it in a view using the customfield module.
The variable shows in contemplate as an available value, as well as devel. Am I doing something wrong here, or is this a bug?

Comments

What do you mean by "display

Garrett Albright's picture

What do you mean by "display in its own CCK field?" How are you trying to do this?

I'm trying to store the value

atomicbop's picture

I'm trying to store the value in a cck field so that I can call on it in a View. Ubercart does not have Views support for attributes. There is an Ubercart Views module that has some support, but I can't access each individual option of an attribute.

I have had some luck using the dynamic cck field module, however, when I try to use it in a view, I get no result.

Ah, okay. Yeah, you're kind

Garrett Albright's picture

Ah, okay. Yeah, you're kind of in a tight spot, as unfortunately Ubercart wasn't really designed with CCK/Views in mind.

One way around it would be to have the View set up to display the nodes as Nodes instead of Fields, then use the theming layer to theme nodes in that View as you need them. It's a pain, but this sort of thing has worked in the past for me.

Thanks for the response. The

atomicbop's picture

Thanks for the response. The work around was to query the value directly. I used dynamic field and threw in an sql query. Not the most elegant solution, but it works. Better than spending more time trying to get one little value. What a pain!