VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: gba on February 09, 2015, 15:28:58 PM

Title: [solved] Custom field plugin - How to get parameter values in javascript
Post by: gba on February 09, 2015, 15:28:58 PM
Hello All!

Within PHP I can get parameter values of a custom field plugin this way:
$plugin = &JPluginHelper::getPlugin('vmcustom', 'myplugin');
$pluginparams = new JRegistry($plugin->params);
$paramvalue = $pluginparams->get('myparameter');


But How can I get the parametervalue in a JS file?
Thank you very much for your help in advance!

Kind regards,
Gerald
Title: Re: Custom field plugin - How to get parameter values in javascript
Post by: GJC Web Design on February 10, 2015, 00:02:49 AM
not on the fly but in your JS

<?php
$plugin = &JPluginHelper::getPlugin('vmcustom', 'myplugin');
$pluginparams = new JRegistry($plugin->params);
$paramvalue = $pluginparams->get('myparameter');
?>

<script type="text/javascript">
   jQuery(document).ready(function($){
      var nelly = '<?php echo $paramvalue; ?>';

          // do something
   });
   jQuery.noConflict();
</script>
Title: Re: Custom field plugin - How to get parameter values in javascript
Post by: gba on February 10, 2015, 08:25:24 AM
Thank you for your hint!

Best regards,
Gerald