Answer the question
In order to leave comments, you need to log in
How to correctly pass attributes to the selectList field in VirtueMart?
I'm writing a small plug-in for VM, there was a gag with the selectList field - the passed parameters are not saved.
The code is standard, based on vmcustom:
function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) {
$helper = new plgVmCustomAttachFilesHelper;
if ($field->custom_element != $this->_name)
return '';
$file_filter = $helper::getFilter($field->custom_params);
$list_files = array_combine($helper::listFiles($file_filter), $helper::listFiles($file_filter));
$html ='
<fieldset>
<legend>' . vmText::_('VMCUSTOM_ATTACHFILES_ADD_FILES_LABEL') . '</legend>'.
'<table class="admintable">'.
VmHtml::row('selectList', 'VMCUSTOM_ATTACHFILES_SELECT_FILES_LABEL', 'filelist', 'customfield_params['.$row.'][filelist]', $list_files, 1, 'multiple="multiple"', '', 'VMCUSTOM_ATTACHFILES_SELECT_FILES_PLACEHOLDER').
'</table>
</fieldset>';
$retValue .= $html;
$row++;
return true ;
}
VmHtml::row(
'selectList', //type
'VMCUSTOM_ATTACHFILES_SELECT_FILES_LABEL', //label
'filelist', //field name
'customfield_params['.$row.'][filelist]',
$list_files, //input array
'1', //size
'multiple="multiple"', //milti
'class="inputbox"', //attrib
'VMCUSTOM_ATTACHFILES_SELECT_FILES_LABEL' //placeholder
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question