Zen Cart Logo
Forums / Bug Reports / [not a bug] Label missing on radio field if only one attribute is available

[not a bug] Label missing on radio field if only one attribute is available

Locked

Views: 1,854

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
21 Sep 2008, 1:29 AM
#1
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

[not a bug] Label missing on radio field if only one attribute is available

I think it's a bug as all form items need to have labels for accesibility (screen readers)

zc1.3.8a

modules/attributes.php

line 564

$options_name[] = $products_options_names->fields['products_options_name'];
```Should be replaced with
```php
$options_name[] = '<label class="attribsRadioButton" for="' . 'attrib-' . $products_options_names->fields['products_options_id'] . '-' . $products_options_value_id . '">' . $products_options_names->fields['products_options_name'] . '</label>';
22 Sep 2008, 8:13 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [not a bug] Label missing on radio field if only one attribute is available

Did you encounter a particular product attribute configuration which rendered an incorrect display? If so, please explain the exact configuration so it can be reproduced for proper evaluation.

Or are you just analyzing code?

22 Sep 2008, 8:17 AM
#3
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

Re: [not a bug] Label missing on radio field if only one attribute is available

This is when a drop down attribute is set, for example Colour, and only one colour is entered, for example blue. Instead of rendering a drop down, the attribute option (blue) is shown as a selected radio option.

22 Sep 2008, 8:35 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: [not a bug] Label missing on radio field if only one attribute is available

Using 1.3.8a with demo data, I selected "Test Eight" as the product, then added the "Documentation" (a [Dropdown] option) and "MS Word" for the value.

The resultant HTML in the template renders as: ```html
<input type="radio" name="id[17]" value="63" checked="checked" id="attrib-17-63" /><label class="attribsRadioButton" for="attrib-17-63">MS Word - English</label>

22 Sep 2008, 8:45 AM
#5
dsided avatar

dsided

Zen Follower

Join Date:
Jun 2008
Posts:
128
Plugin Contributions:
0

Re: [not a bug] Label missing on radio field if only one attribute is available

Sorry Dr Byte, you're right this isn't a bug. In your test example "Documentation" is wrapped in a h4 when the only item is MS Word, however if you add another attribute, "MS Excel", "Documentation" is now wrapped in a label. I noticed this change as I had styled form labels, and when only one attribute appears there wasn't a label to take the formatting. Thanks for looking into this and hope I didn't waste your time.