Forums / Setting Up Categories, Products, Attributes / dropdown changes to radio if only one attribute option

dropdown changes to radio if only one attribute option

Locked

Views: 1,994

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
14 Mar 2009, 7:56 PM
#1
ivanc avatar

ivanc

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

dropdown changes to radio if only one attribute option

where can this be disabled?

thx

14 Mar 2009, 8:32 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: dropdown changes to radio if only one attribute option

You would need to customize the attributes.php module to change that, as it is designed to not make the customer have to click the dropdown to discover there are no choices ...

The case statement controlling this is at lines 559 - 569 and reads:

                  // dropdown menu auto switch to selected radio button display
                  case ($products_options->RecordCount() == 1):
                  if ($show_attributes_qty_prices_icon == 'true') {
                    $options_name[] = '<label class="switchedLabel ONE" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'] . '</label>';
                  } else {
                    $options_name[] = $products_options_names->fields['products_options_name'];
                  }
                  $options_menu[] = zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', $products_options_value_id, 'selected', 'id="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '"') . '<label class="attribsRadioButton" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options_details . '</label>' . "\n";
                  $options_comment[] = $products_options_names->fields['products_options_comment'];
                  $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
                  break;

If that were commented out, then it will fall through to the default just below it and run like a standard dropdown with just the one choice ...

Personal note, I hate clicking on a dropdown to find out there isn't another choice ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

14 Mar 2009, 9:33 PM
#3
ivanc avatar

ivanc

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

Re: dropdown changes to radio if only one attribute option

Ajeh:

Personal note, I hate clicking on a dropdown to find out there isn't another choice ... :cool:

thank you very much!

yes..I see how that can be annoying...but I can't find any way to align the radio button/option value (when theres only one) to the option name

option name and option value aren't in line, option name is always about a line or two higher, which doesn't look especially nice:

      * Red

Color:

I have managed to get it almost inline when using dropdown, so this is why I would prefer it...radio just won't budge

14 Mar 2009, 10:22 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: dropdown changes to radio if only one attribute option

Most of the parts of the attribute display have tags that can be used to adjust them. I didn't like the default alignment of radiobuttons either. Try something like this in your stylesheet:```
#productAttributes input {
position: relative;
bottom: -.4em;
}

15 Mar 2009, 8:41 PM
#5
ivanc avatar

ivanc

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

Re: dropdown changes to radio if only one attribute option

that was an excellent advice, it did the trick, I had to expand it a little to align the label and the dropdown also

#productAttributes input { 
	position: relative;
	bottom: -1.4em;
}

#productAttributes label { 
	position: relative;
	bottom: -1.2em;
}

#productAttributes select { 
	position: relative;
	bottom: -2.8em;
}

BUT now IE is not inline!

it turns out that when this is not applied firefox is not inline, IE is ok, and vice versa when applied.... :wacko:

15 Mar 2009, 9:19 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: dropdown changes to radio if only one attribute option

Sounds like a situation for a conditional comment or IE-specific stylesheet.
The quick & dirty way for IE6 or earlier would be the * html hack:

* html #productAttributes input, * html #productAttributes label, * html #productAttributes select { 
	position: static;
}
```Put this after the previous rules. Since IE6 (erroneously) thinks there is an element that contains the overall html container, this rule will apply only to IE6.
15 Mar 2009, 11:21 PM
#7
ivanc avatar

ivanc

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

Re: dropdown changes to radio if only one attribute option

I don't know about IE6, but this unfortunately doesn't work for IE7 (which is the one I have the problem with)...

also tried adding bottom:1em and bottom:none to see if something will be different, but no luck

15 Mar 2009, 11:37 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: dropdown changes to radio if only one attribute option

You didn't say which version of IE you had the problem with, so I gave the easy hack I know. I haven't worked with IE conditional comments, but there is plenty of info about them on the web - google to see it.

There is also a mod in Free Addons to allow you to apply them to Zen Cart.

26 Mar 2009, 8:43 PM
#9
ivanc avatar

ivanc

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

Re: dropdown changes to radio if only one attribute option

It seems that the new IE8 took care of almost all design differences with firefox, it reads the stylesheet almost completely in the same way....which is what I had hoped for :clap:

thank you gjh for your help!

for anyone who still needs this, here is a nice explanation on how to use conditional comments to make different stylesheets for different browser:
http://webdevjunk.com/coding/css/4/use-conditional-comment-to-create-css-style-sheets-for-multiple-browsers/