VirtueMart Forum

VirtueMart 2 + 3 + 4 => Installation, Migration & Upgrade => Topic started by: leahshanz on September 23, 2016, 08:42:22 AM

Title: VM3 upgrade payment plugin does not load parameters
Post by: leahshanz on September 23, 2016, 08:42:22 AM
Hi all
I have just upgraded a payment plugin from VM2 to VM 3 following the instructions provided by VM. There were only minor changes. I installed the plugin and everything looks good so far. When i update the configuration parameters (select the plugin, save it and then click configuration) i do not see the updated parameters. I checked the database table virtumart_paymentmethods and the parameters (varsToPush) are there they just do not load in the backend, in other words  it only loads the default values from the constructor.

The old site (J25/VM2) it works so i figure its something to do with the VM3 version loading the plugin parameters. The field in the table that stores  the varsToPush is 'payment_params' i could not find customfield_params as documented (not sure if this is relevant) however payment_params does store the data when i make a change, i just cant see it in the BE after save.

Any ideas why this would be happening, i have spent the last few days trying to solve it. I am not an expert on VM plugins so any help is appreciated.

Thanks in advance for any help


Below is the first part of the file

defined ('_JEXEC') or die('Restricted access');
if (!class_exists ('vmPSPlugin')) {
   require(JPATH_VM_PLUGINS . DS . 'vmpsplugin.php');
}


class plgVmpaymentOncefinance extends vmPSPlugin {
function __construct (& $subject, $config) {

      parent::__construct ($subject, $config);
      
      $jlang = JFactory::getLanguage ();
      $jlang->load ('plg_vmpayment_oncefinance', JPATH_ADMINISTRATOR, NULL, TRUE);
      $this->_loggable = TRUE;
      $this->_debug = TRUE;
      $this->tableFields = array_keys ($this->getTableSQLFields ());
      $this->_tablepkey = 'id';
      $this->_tableId = 'id';

      $varsToPush (my vars here )

      if(!defined('VM_VERSION') or VM_VERSION < 3){
        $this->setConfigParameterable ('custom_params', $varsToPush);
      } else {
        $this->setConfigParameterable ($this->_configTableFieldName, $varsToPush);
      }
}
   //added new triggers
   function plgVmDeclarePluginParamsCustomVM3(&$data){
     return $this->declarePluginParams('custom', $data);
   }
   function plgVmGetTablePluginParams($psType, $name, $id, &$xParams, &$varsToPush){
     return $this->getTablePluginParams($psType, $name, $id, $xParams, $varsToPush);
   }
   public function getVmPluginCreateTableSQL () {

      return $this->createTableSQL ('Payment Once Finance Table');
   }


Title: Re: VM3 upgrade payment plugin does not load parameters
Post by: GJC Web Design on September 23, 2016, 10:29:46 AM
the new trigger should be

function plgVmDeclarePluginParamsPaymentVM3( &$data) {
      return $this->declarePluginParams('payment', $data);
   }
Title: Re: VM3 upgrade payment plugin does not load parameters
Post by: leahshanz on September 23, 2016, 11:27:32 AM
Thank you I am very grateful, fixed the problem. I never would have figured that out
Title: Re: VM3 upgrade payment plugin does not load parameters
Post by: GJC Web Design on September 23, 2016, 13:13:31 PM
Use the current bundled payment plugs as your guide.. pick a simple one like authorize