News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Fields as a "radio button" list instead dropdown list.

Started by syntalk, April 09, 2013, 15:41:49 PM

Previous topic - Next topic

syntalk

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

I am also looking for this.

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

Ninjab

Ditto also. I cannot find either. Anyone know? Thanks.

PRO

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



Ninjab

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

Quote from: Ninjab 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.

when you click save after choosing plugin,

you dont see it in the dropdown?

Ninjab

Quote from: PRO on May 02, 2013, 19:27:04 PM
Quote from: Ninjab 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.

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

NO, but did you see my post above about how to modify it?

Ninjab

Quote from: PRO 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




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

Quote from: Ninjab on May 03, 2013, 12:45:22 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]

Ninjab

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

Quote from: PRO on May 03, 2013, 20:08:52 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:

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

to:

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

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


Ninjab

Quote from: balai 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

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

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