Author Topic: Custom Fields as a "radio button" list instead dropdown list.  (Read 11763 times)

syntalk

  • Beginner
  • *
  • Posts: 42
Hi,

I know there is a lot of posts about this but mostly "how to change radio buttons to dropdown list". I need the other way around - I have dropdown list and need radio buttons. Changing "is a list" or "hidden" to "NO" makes no difference. I also tried PRO's VMCustom - dropbox plugin.
Can anyone help me with this?
Thanks,

VM 2.0.18a
Joomla 2.5.9

Shiftster

  • Beginner
  • *
  • Posts: 3
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #1 on: April 15, 2013, 22:48:00 pm »
I am also looking for this.

Please let me know if you find out how to do this.

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #2 on: May 01, 2013, 17:47:07 pm »
Ditto also. I cannot find either. Anyone know? Thanks.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10377
  • VirtueMart Version: 3+
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #3 on: May 01, 2013, 19:56:09 pm »
administrator/components/com_cvirtuemart/helpers/html.php

if you look in MY plugin

You will see it uses

   $html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);

You could also use vmHtml

& use the     radioList   function



ofcourse, you will have to do a little coding


J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #4 on: May 02, 2013, 10:45:55 am »
Hi PRO, I went and installed your plugin but there is no Use plugin in my custom fields when creating a new one. I have enabled the Plugin in Joomlas plugin manager already but it doesnt show the option to use your plugin when in customfields.

I was also wondering if it is possible to do tick boxes with this also? I want users to be able to select different or all options if they need.

Thanks.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10377
  • VirtueMart Version: 3+
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #5 on: May 02, 2013, 19:27:04 pm »
Hi PRO, I went and installed your plugin but there is no Use plugin in my custom fields when creating a new one. I have enabled the Plugin in Joomlas plugin manager already but it doesnt show the option to use your plugin when in customfields.

I was also wondering if it is possible to do tick boxes with this also? I want users to be able to select different or all options if they need.

Thanks.

when you click save after choosing plugin,

you dont see it in the dropdown?
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #6 on: May 03, 2013, 03:06:53 am »
Hi PRO, I went and installed your plugin but there is no Use plugin in my custom fields when creating a new one. I have enabled the Plugin in Joomlas plugin manager already but it doesnt show the option to use your plugin when in customfields.

I was also wondering if it is possible to do tick boxes with this also? I want users to be able to select different or all options if they need.

Thanks.

when you click save after choosing plugin,

you dont see it in the dropdown?

Hi Pro, yes I got the plugin working. Reason I didnt see it as I was trying to edit other fields.

However, how does this plugin give me a radio list instead of a dropdown list?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10377
  • VirtueMart Version: 3+
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #7 on: May 03, 2013, 12:37:45 pm »
NO, but did you see my post above about how to modify it?
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #8 on: May 03, 2013, 12:45:22 pm »
administrator/components/com_cvirtuemart/helpers/html.php

if you look in MY plugin

You will see it uses

   $html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);

You could also use vmHtml

& use the     radioList   function



ofcourse, you will have to do a little coding




Yes I see this now. Sorry I missed it. However how do I do it? And what if I dont want all my lists to be radio buttons? Some I will need in radio and some as tickboxes and some as dropdowns.

Thanks PRO.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10377
  • VirtueMart Version: 3+
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #9 on: May 03, 2013, 20:08:52 pm »


Yes I see this now. Sorry I missed it. However how do I do it? And what if I dont want all my lists to be radio buttons? Some I will need in radio and some as tickboxes and some as dropdowns.

Thanks PRO.


sounds like you are going to have to get someone to code something for you.

Or look around for other plugins,

My plugin can be modified by someone who knows how to code, & has the time to do it.

See image below, with what I got


by just changing this
$html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);


to this

$html = JHTML::_('select.radiolist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);



as you can see it's not complete, but just needs some tweeking

[attachment cleanup by admin]
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #10 on: May 04, 2013, 04:10:45 am »
Thanks. However I wouldnt know how to change your code to achieve what I need as my PHP coding skills is next to none.

syntalk

  • Beginner
  • *
  • Posts: 42
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #11 on: May 08, 2013, 13:09:47 pm »

See image below, with what I got


by just changing this
$html = JHTML::_('select.genericlist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);


to this

$html = JHTML::_('select.radiolist', $selects,'customPlugin['.$field->virtuemart_customfield_id.']['.$this->_name.'][custom_drop]','','value','text',$selects[0],false,true);



as you can see it's not complete, but just needs some tweeking

Hi PRO,

Thanks for this tip! After I've changed:

Code: [Select]
return JHTML::_('select.genericlist', $options,$name,$attrib,$key,$text,$default,false,true);
to:

Code: [Select]
return JHTML::_('select.radiolist', $options,$name,$attrib,$key,$text,$default,false,true);
 in the administrator/components/com_virtuemart/helpers/html.php, I've got what I wanted (see picture)! Making this a list in the column would be even better but still..

BTW I'm using a native Virtuemart Custom Fields function.

Many thanks for this.


[attachment cleanup by admin]

yurpodushkin

  • Beginner
  • *
  • Posts: 3
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #12 on: August 13, 2013, 01:23:10 am »
Huge thanks to syntalk and everybody !

I made same change as syntalk described on a standard Custom Field and got radiobuttons!


[attachment cleanup by admin]

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1390
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #13 on: August 13, 2013, 09:27:16 am »
By the way, if you like to avoid hacks, check also this solution
http://breakdesigns.net/extensions/customfields-for-all

Ninjab

  • Jr. Member
  • **
  • Posts: 78
Re: Custom Fields as a "radio button" list instead dropdown list.
« Reply #14 on: August 13, 2013, 19:13:01 pm »
By the way, if you like to avoid hacks, check also this solution
http://breakdesigns.net/extensions/customfields-for-all

Thanks a lot for this. This will come in VERY handy.

Their custom filter also will solve my sub-category issue.