Problem with saved custom field parameters in VM 3.0.2

Started by sealion, December 18, 2014, 18:25:00 PM

Previous topic - Next topic

sealion

There is a problem with custom field plugin parameters in VM 3.0.2 (and previous versions of VM3)

When you create a new plugin custom field, then try to save the parameters for the field, it looks like they are not saved. Actually they are, but the saved values are not displayed to the user, just the default values, so it looks like they are not being saved. This is going to be confusing to users.

I think that the problem is in administrator/components/com_virtuemart/views/custom/view.html.php, where you have (lines 71 to 75)

$this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(),false, '//vmconfig | //config[not(//vmconfig)]');
$this->custom->params = new stdClass();
$varsToPush = vmPlugin::getVarsToPushFromForm($this->custom->form);
VmTable::bindParameterableToSubField($this->custom,$varsToPush);
$this->custom->form->bind($this->custom->getProperties());



You can see that the values that are bound to the form just taken from the form, not the actual data. You can fix it easily, just add

    VmTable::bindParameterable ($this->custom, 'custom_params', $varsToPush);


like this

$this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(),false, '//vmconfig | //config[not(//vmconfig)]');
$this->custom->params = new stdClass();

$varsToPush = vmPlugin::getVarsToPushFromForm($this->custom->form);
            VmTable::bindParameterable ($this->custom, 'custom_params', $varsToPush);
VmTable::bindParameterableToSubField($this->custom,$varsToPush);
$this->custom->form->bind($this->custom->getProperties());



AH

Regards
A

Joomla 3.10.11
php 8.0