VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: syntalk on April 09, 2013, 15:41:49 PM

Title: Custom Fields as a "radio button" list instead dropdown list.
Post by: syntalk on April 09, 2013, 15:41:49 PM
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
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Shiftster 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.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Ninjab on May 01, 2013, 17:47:07 PM
Ditto also. I cannot find either. Anyone know? Thanks.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: 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


Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: 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.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: 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?
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Ninjab on May 03, 2013, 03:06:53 AM
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?
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: PRO on May 03, 2013, 12:37:45 PM
NO, but did you see my post above about how to modify it?
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Ninjab on May 03, 2013, 12:45:22 PM
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.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: PRO on May 03, 2013, 20:08:52 PM
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]
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Ninjab 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.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: syntalk on May 08, 2013, 13:09:47 PM
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]
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: yurpodushkin 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]
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: 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
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: Ninjab on August 13, 2013, 19:13:01 PM
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.
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: egilan on September 25, 2013, 22:43:57 PM
Hi,

l haw Virtuemart 2.0.22c. The place where it is necessary to make changes: administrator/components/com_cvirtuemart/helpers/html.php
}
return JHTML::_('select.genericlist', $options,$name,$attrib,$key,$text,$default,false,true);
}

I changed:

from select.genericlist to select.radiolist

Firefox understands this change, but do not understand the Opera, Google Chrome, Internet Explorer...

Maybe you know how to fix, that all browsers understand the changes?
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: PRO on September 26, 2013, 01:19:35 AM
that code is ran by virtuemart, not the browser
Title: Re: Custom Fields as a "radio button" list instead dropdown list.
Post by: retep007 on December 05, 2013, 21:44:00 PM
Does this change work even with generic child variant? And is there also fix for a new version of virtuemart ?