12 replies [Last post]
tekad's picture
Offline
Joined: 10/21/2008
Juice: 160
Was this information Helpful?

I've been trying to track down a way to have dynamic attributes on products. I want to hide certain attributes that do not apply if you make a certain radio selection.

I've searched the forums and modules looking for a solution, but have not found one. I could write the javascript myself, but I'm not sure where to start overriding the attributes so I can add an action like onSelect to the radio buttons. Any pointers?

cha0s's picture
Offline
Getting busy with the Ubercode.
Joined: 08/22/2008
Juice: 416
Re: Dynamic Attributes

You're thinking something like a hierarchy for attributes? Like attribute A controls whether or not you see B or C. It's an interesting concept but there's nothing like that in the code right now. I do like the idea.

Try FreeBASIC!
My game Lynn's Legacy

tekad's picture
Offline
Joined: 10/21/2008
Juice: 160
Re: Re: Dynamic Attributes

Yes, this is exactly what I have to do. It is the last think I need to figure out for my first site before it is ready.

I have seen what I thought was jQuery being attached to buttons and elements after a page has been loaded. i.e. without actually including an onMouseOver event in an element, an onMouseOver event was attached to this element after the page loaded.

Anyway, I'm trying to track down the lines of code that I would need to customize in a module/theme override to include certain onClick events to certain radio buttons. Any pointers to this?

p0wderburn's picture
Offline
Joined: 11/21/2008
Juice: 30
Re: Re: Re: Dynamic Attributes

A mod of this would be very handy. I have played with it on some of my hand rolled sites but never in Drupal/Ubercart. A "Dynamic Linked Form Element" module would be a nice feature, but I do not know where to start either.

doubledoh's picture
Offline
Joined: 01/26/2009
Juice: 2
conditional attributes

I just want to add that this is a fairly important feature, especially for apparel shops.

Example: If I have t-shirt designs and I want to sell shirts...I want to sell shirts by the design (not the article of clothing).

The product selection process would go like this:

1. Design selection
2. Attribute: Male or Female?
3. If Female, display female choices (ex: Ladies Scoop Neck T, Ladies Crewneck T, etc).
If Male, display male choices (ex: Men's Beefy Tee, Long Sleeve T-Shirt, etc)
4. If we choose "Mens" then "Long Sleeve T-Shirt" we would have a 3rd attribute field that asks us for size (S, M, L, XL, XXL, etc).
5. And again, from there, we might be able to choose from different colors (or choose colors first, then size)

The reasoning behind this is that some styles only have certain sizes.

An excellent example of this functionality can be found here: http://www.tshirthell.com/funny-shirts/talk-nerdy-to-me/?fdo=n (not a drupal site, but excellent at selling shirts).

So what's the best way to implement this functionality?

1. After we create our generic attribute sets, we should be able to create another object called an "attribute tree."
2. Attribute trees allow you to assign conditional attribute sets to EACH option within the parent attribute set. Once an attribute tree is created and saved, it will be available to use with any products.
3. An important ancillary feature would be the ability to mass-edit particular taxonomies inside our catalogues with these attribute trees (or perhaps just simple attribute groups).

And here is how I imagine the workflow:

1. Create attribute sets as usual:
a. Style (Men's Tshirt, Women's V-neck, toddler's bib)
b. Color Sets (Black), (Black, Red, Blue, White) (Tan/Blue, Taupe/Purple, Beige/Brown) etc.
b. Size sets: (women's v-neck sizes: S, M, L) (Men's T-Shirt Sizes: S, M, L, XL, XXL, XXXL), (Toddler Bibs: XS, S, M) etc...NOTE: these size sets are each distinctive attribute sets

2. Once my sets have been created, I can then create an attribute tree:
a. Assign a color set to each style.
b. Assign a size set to each color underneath the style set (yes, in a hierarchical fashion). (NOTE: I envision being able to even assign existing attribute trees (and not just attribute sets) to options as well)
c. Repeat for EVERY attribute option within the tree.
d. Save this attribute tree with a unique name.

3. That's it. Assign the previously created attribute tree to a product just like normal attributes.

4. When a user selects a style, they will then see the correct color set, and when they select a color, they will then see the correct size set (or however the store admin set it up).

I hope this sort of clarifies what we are asking for and how one might achieve it in theory...

wbclassics's picture
Offline
Joined: 01/25/2009
Juice: 55
Dynamic Conditional Attributes

I too will add my voice to those who would be interested in this type of module.

Other markets like automotive parts and computer sales would require this. Obviously you can't install an AMD processor on an Intel based motherboard, so conditional attributes would be helpful in displaying only attributes that are compatible with previous choices. Likewise with the auto parts... a single car model may have different trim or engine choices that then impacts certain parts down the line.

KMR

richard's picture
Offline
Joined: 07/17/2009
Juice: 5
Would be Great

Yes, me too would find this etremely usefull.
At the moment it seems I am going to have to create and maintain a far messier collection of products/classes/terms than I would have if dynamic attributes were possible.

Hoping we will see something along these lines at some point?

kala's picture
Offline
Joined: 07/16/2009
Juice: 10
Re: Would be Great

+1 for this feature request. We are also looking for a similar feature. Can this be achieved with hook_form_alter or over riding the theme and including the javascript validation in theme?

jahaswel's picture
Offline
Joined: 07/21/2009
Juice: 64
More votes

+ 1 for this as well.

no clean solution exists.

It ends up making the store look very amateur.

cYu
cYu's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 11/19/2007
Juice: 850
Re: More votes

I wrote a module which applies this sort of relationship defining and trimming logic to cck select fields for cck content types. It could probably be translated to select field attribute options for ubercart attributes. http://drupal.org/project/option_trim

It would need slimmed down and adjusted for UC, but it might be somewhere to start for those with some drupal/ubercart/jquery chops or if someone wants to sponsor a contrib, PM me and I could look at coding it up.

jgubata's picture
Offline
Joined: 09/17/2009
Juice: 11
Similar requests

More...

So many want this functionality - any takers? I'd be willing to help fund, though I'm a poor startup :-< and can't afford a lot. But it seems like there may be others willing to help fund it, too.

http://www.ubercart.org/forum/support/11631/there_solution_attributes_depend_other_attributes#comment-44177

justageek's picture
Offline
Bug Finder
Joined: 10/29/2008
Juice: 189
all this sounds cool

and very useful, but one caveat, if not executed properly it seems like it could make product searches hell.

robbie's picture
Offline
Joined: 03/17/2010
Juice: 107
Re: Dynamic Attributes

for folks who are still searching for a solution for this type of issues, the Chained Attributes and Options module is exactly what you'll need:
http://www.ubercart.org/project/uc_cano