Basically what I am trying to accomplish is dependent attributes in the store page. Meaning when someone chooses one option, a later option becomes available/unavailable. This is a must for the site but apparently there exists no module to accomplish this for drupal 7.x.

So I decided that I would write some javascript in the document.ready function to add event attributes to specific select statements and buttons. (Like onselect and onclick). But to my surprise when I tried this, after the changes made by the javascript are appended, the code is overwritten back to its original state.

I assume this is happening because there is some code being run after my changes are applied that customizes the form elements to ubercarts default.

So my question is; is there a way to run my code after ubercarts? I tried searching for a solution to this but could not find one. Also while I am asking is there an easier way to have dependent attributes that I am somehow missing?

Comments

tr’s picture

Category: task » support
longwave’s picture

Status: Active » Fixed

I just answered something very similar in #1990300: Trying to theme attributes with jQuery - you need to read up on how Drupal manages JavaScript, especially around Ajax calls, see http://drupal.org/node/756722#behaviors (and other sections on that page)

You may also be able to set up dependent attributes entirely server-side using the Ajax functionality provided by the "Update product display based on customer selections" feature.

end user’s picture

sittard’s picture

Perhaps this module might help:
http://drupal.org/project/uc_dropdown_attributes

BField’s picture

Thank you! This fits what I need perfectly!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.