VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: sealion on December 18, 2014, 18:25:00 PM

Title: Problem with saved custom field parameters in VM 3.0.2
Post by: sealion on December 18, 2014, 18:25:00 PM
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());

Title: Re: Problem with saved custom field parameters in VM 3.0.2
Post by: sealion on December 23, 2014, 12:39:18 PM
My mistake, it is working OK now.
Title: Re: Problem with saved custom field parameters in VM 3.0.2
Post by: AH on December 24, 2014, 11:03:17 AM
User misunderstanding