Replacing SELECT tag by another one in the front-end multivariant customfield

Started by fmvm, June 24, 2016, 21:30:35 PM

Previous topic - Next topic

fmvm

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

Apple7


Jumbo!

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

Apple7

Thanks Jumbo!
Really useful