Forums / Setting Up Categories, Products, Attributes / remove radiobutton when just one attribute

remove radiobutton when just one attribute

Locked

Started by fcegarra on 12 Oct 2007, 8:31 PM · Views: 3,897

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
12 Oct 2007, 8:31 PM
#1
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

remove radiobutton when just one attribute

Hello everyone!!

It is something which could be really easy but I can't figure out. I choose the drop down menu to display my attributes.

I want to remove the radiobutton next to the attribute when there is just one attribute. I don't know how to do it
thanks for any ideas!! I really appreciate !!

F.

16 Oct 2007, 3:44 PM
#2
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

I still can't find where I can change it..someone has any idea?

Thanks a lot..

18 Oct 2007, 2:17 PM
#3
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

I am soo sorry to bother you again but I have NOO clue about this issue.

Any help?

thanks

23 Oct 2007, 6:13 PM
#4
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

I feeeeel sooo looonely...
I tried to edit "attribute.php" but I still keep the radiobutton in front of my attribute.

Has someone did it or have any idea ?
thanks

F.

23 Oct 2007, 11:54 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: remove radiobutton when just one attribute

Currently, Option Groups as dropdowns with 1 Option Value are converted to automatically selected radio buttons ...

You would need to customize the attributes.php module ...

I think I may have a post somewhere over the last month or so on how to do this ...

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!

24 Oct 2007, 1:22 PM
#6
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

Thank you Ajeh...I tried to find your old post but I can not find it...
Arg I know I am a bit stupid... :(

Thanks again

F.

25 Oct 2007, 1:38 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: remove radiobutton when just one attribute

I can never find my old posts either ... :cry:

but it's out there ... :smile:

However, being the nice person that I am and since others may need to find how to allow Option Names with a Single Options Value you can look in the attributes module:
/includes/modules/attributes.php

There is a section that controls in the case statement for the Options Names Option Type where you have set it up to be a dropdown but have only one option value and this, by default, is switching that dropdown to the selected radiobutton so the customer does not waste the time clicking a 1 option value option name ...

However, I digress ...

Look at the section for:

                  // 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 you comment out that whole case then it will not run and the single option value on the dropdown option type will now switch back to a dropdown and not a radio button ...

Commenting it is easy ... just copy the file to your overrides directory:
/includes/modules/your_template_dir/attribute.php

and change the code to read:

/*
                  // 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;
*/

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!

25 Oct 2007, 2:40 PM
#8
fcegarra avatar

fcegarra

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

Thanks, it works fine like that!

I just wanted to know if it is possible to have just the attribute written(not in the drop down menu) when there is one attribute choice.

Thanks again for all your help,

F.

25 Oct 2007, 4:50 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: remove radiobutton when just one attribute

It probably would of been easier to customize the change from dropdown to RadioButton to be a hidden selection when only 1 exists ...

I haven't had time to write this code for you but that would be the area in which to do it ...

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!

2 Apr 2008, 3:53 PM
#10
hemz avatar

hemz

New Zenner

Join Date:
Dec 2007
Location:
brighton UK
Posts:
40
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

did anyone come up with an answer to this one?

I too would like just the one attribute to be displayed without a radio button...

and without a dropdown - just so the text is echoed out on the page ...:blink:

it's better to light a candle than curse the darkness

search engine marketing

12 May 2008, 9:11 AM
#11
hemz avatar

hemz

New Zenner

Join Date:
Dec 2007
Location:
brighton UK
Posts:
40
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

no answer to this then :smile: ?

Change the radio button to just text for one attribute?

thanks!!!!!!!!!!!!!!!!

:smile:

it's better to light a candle than curse the darkness

search engine marketing

20 Jul 2008, 6:48 AM
#12
divineiguana avatar

divineiguana

New Zenner

Join Date:
Jul 2008
Posts:
25
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

I, too, am stumped by this. I know it must be a fairly simple solution...can anyone tell me what I should alter in the php file to make the attribute hidden when there is only one? All my products are digital downloads and it looks really weird to have that radio button with nothing to select.

help?

11 Aug 2008, 10:21 PM
#13
thedruid avatar

thedruid

New Zenner

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

Re: remove radiobutton when just one attribute

I three would like to know how to get it to display the option name and value with only text on a one attribute item. any help from you programming minds out there would be much appreciated.:D

12 Aug 2008, 3:11 AM
#14
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: remove radiobutton when just one attribute

From the Tutorial:

Select an Option Type:
TEXT (this does not get an Option Value)

Options:

For Option Type TEXT:

* Comments
* Max Display Size (size of input box on screen)
* Max Length (max number of characters/spaces)

https://www.zen-cart.com/tutorials/index.php?article=57

Zen-Venom Get Bitten

14 Oct 2010, 3:50 PM
#15
sarahl avatar

sarahl

Zen Follower

Join Date:
May 2004
Location:
UK
Posts:
471
Plugin Contributions:
0

Re: remove radiobutton when just one attribute

Linda - thank you!!! saved me hunting for this :) Easy when you know how :):):)