VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: fmvm on June 24, 2016, 21:30:35 PM

Title: Replacing SELECT tag by another one in the front-end multivariant customfield
Post by: fmvm on June 24, 2016, 21:30:35 PM
On the productdetails page we display parent and its child products by means of the Multivariant custom field. By default, the variants are rendered as OPTIONS of the <SELECT> dropdown list. But I need to display them with some another HTML tag(s). For example, the wrapper may be as <UL> and the variants as <LI>.

In the file sublayouts/customfield.php I tried commenting the line

//$html .= JHtml::_ ('select.genericlist', $options, $fieldname, $attribs , "value", "text", $selected,$idTagK);


and replaced it with


$myLIs = array();
foreach($options as $optionText) {
$myLIs[] = '<li>'.$optionText.'</li>';
}
$html .= '<ul id="'.$idTagK.'" name="'.$fieldname.'" data-dynamic-update="1">'.implode('',$myLIs).'</ul>';


But switching between the variants stopped working after that.

Everything seems to be binded to the SELECT html tag in the components/com_virtuemart/assets/js/dynupdate.js

There I tried to replace

default:
el[0].onchange = null;
el.off('change',Virtuemart.upd);
el.on('change',Virtuemart.upd);


with


default:
el[0].onclick = null;
el.off('click',Virtuemart.upd);
el.on('click',Virtuemart.upd);


But it also didn't help

How to resolve the problem?

VM 3.0.12
Title: Re: Replacing SELECT tag by another one in the front-end multivariant customfield
Post by: Apple7 on July 13, 2016, 21:56:41 PM
I would like to find out the solution to that problem as well
Title: Re: Replacing SELECT tag by another one in the front-end multivariant customfield
Post by: Jumbo! on July 13, 2016, 23:16:15 PM
Just thought you may find it useful. VM 3.0.17.2 has working radio type multi variant custom field feature. Then you can easily use some CSS to change the actual display style of the radio buttons. You can find the package here - http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: Replacing SELECT tag by another one in the front-end multivariant customfield
Post by: Apple7 on July 13, 2016, 23:32:16 PM
Thanks Jumbo!
Really useful