Re: Chained Attributes and Options

WesleyTx's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 89
Re: Chained Attributes and Options

OK, I've been rooting around in the code and in an effort to enable the use of radio-button style attributes, I've made the following changes:

LINE 69
FROM:

if(uc_cano_is_parent_attribute($aid, $form['node']['#value']->type, element_children($attributes)) && $attr['#type'] == 'select') {

TO:

if(uc_cano_is_parent_attribute($aid, $form['node']['#value']->type, element_children($attributes)) && ($attr['#type'] == 'select' || $attr['#type'] == 'radios')) {

LINES 164-165
FROM:

//fetch only select box control attributes
$result = db_query("SELECT aid, label FROM {uc_attributes} WHERE display = '%d'", 1);

TO:

//fetch only select box or radio button control attributes
$result = db_query("SELECT aid, label FROM {uc_attributes} WHERE display = '%d' OR display = '%d'", 1, 2);

Of course, all I've done is essentially remove the restriction without understanding what the full consequences may be, but it does appear to work, at least for parent attributes.

The only glitch I see so far is under the following circumstance:
1. I have a parent attribute (radio style) where option A enables a child attribute and option B doesn't.
2. I select option A, which enables the child attribute. Said child attribute is required.
3. I do not make a selection in the child attribute and hit "Add to Cart" anyway.

I get the expected error telling me that the child attribute is required. However, although option A is still selected, the child attribute is no longer enabled. I have to click option B, then option A again to re-enable the child attribute. This doesn't happen when the parent attribute is a select box.

I imagine the solution is in uc_cano_add_to_cart_form_validate, but I haven't had much sleep and I get a little lost reading through it.

Anyone care to further my attempts to enable radio attributes?

Chained Attributes and Options By: robbie (169 replies) Wed, 06/23/2010 - 21:01
  • Shopping cart missing attributes By: pmlchan (11/17/2010 - 10:18)
  • Any chance of getting this on drupal.org? By: ergophobe (10/26/2010 - 14:06)
  • Anybody pls By: alexmalka@detografx.com (10/13/2010 - 10:06)
  • Got It To Work By: alexmalka@detografx.com (10/10/2010 - 12:13)
  • version 1.1 and uc_aac By: scot.self (10/06/2010 - 11:08)
  • Again By: alexmalka@detografx.com (10/06/2010 - 11:02)
  • @alex: I just looked at your By: vizteck (10/01/2010 - 03:22)
  • Still No Good By: alexmalka@detografx.com (09/30/2010 - 12:54)
  • Still No Good By: alexmalka@detografx.com (09/30/2010 - 12:54)
  • All Attibute show no mater if i enable or disable them By: alexmalka@detografx.com (09/28/2010 - 15:30)
  • [quote] Also I think this is By: mpkpm (09/28/2010 - 05:35)
  • Re: Chained Attributes and Options By: mpkpm (09/28/2010 - 03:55)
  • Hi, I could remove the By: mpkpm (09/27/2010 - 13:08)
  • Hi, I am able to hide the By: mpkpm (09/27/2010 - 03:05)
  • Hi folks I too cannot By: aireworth (09/24/2010 - 12:29)
  • Re: Chained Attributes and Options By: archer007 (09/23/2010 - 20:42)
  • Cano won't work By: archer007 (09/23/2010 - 15:45)
  • Re: Chained Attributes and Options By: mpkpm (09/23/2010 - 09:28)
  • No White Screen By: oncreative (09/23/2010 - 08:49)
  • Active By: vizteck (09/23/2010 - 05:43)
  • Re: Chained Attributes and Options By: robbie (09/22/2010 - 22:38)
  • How do I actually use this module? By: archer007 (09/22/2010 - 17:28)
  • Ver 1.2 fails to update price change from dependant attribute By: aireworth (09/19/2010 - 10:51)
  • Names rather than Labels for selecting dependant attribute By: aireworth (09/19/2010 - 10:45)
  • Re: Chained Attributes and Options By: fehin (09/15/2010 - 10:28)
  • Select Boxes vs. Check Boxes By: ixlr8 (09/06/2010 - 16:43)
  • Attribute Label Submit Bug By: oncreative (08/31/2010 - 13:10)
  • Re: Chained Attributes and Options By: oncreative (08/31/2010 - 12:56)
  • It's Working By: oncreative (08/30/2010 - 09:49)
  • Re: Chained Attributes and Options By: oncreative (08/30/2010 - 06:06)
  • Got past all the bugs but still doesnt work By: oncreative (08/24/2010 - 07:09)
  • Re: Chained Attributes and Options By: scot.self (07/09/2010 - 01:10)
  • Have to delete a point space in first line of uc_cano.module By: Yuri (07/01/2010 - 10:55)
  • Not compatible with Boost module 6.x-1.18 By: Yuri (07/01/2010 - 10:24)