D
D
denism3002019-01-28 18:23:50
Joomla
denism300, 2019-01-28 18:23:50

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 ;
}

From what we managed to understand from the documentation for the VM API and by trial, the parameters in the selectList are passed like this:
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
)

two questions:
1. what is the error that the form does not save the parameters?
2. how to pass the default parameter?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question