News:

Support the VirtueMart project and become a member

Main Menu

currency convertion plugins

Started by razor7, December 26, 2011, 19:27:48 PM

Previous topic - Next topic

razor7

Hi, i'm trying to port my currency plugind from VM1.1 to VM2. Readed the code of convertECB.php from VM2 and see no many differences, but when enabling myu plugin, nothing happens. Also can not see my debug strings that my plugin outputs.

Any idea why?

Thanks a lot!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

Stephen Roberts

Can you provide more information? How are you building the plugin? Did you select your currency plugin in the VM configuration? Any error messages at a all?
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

razor7

Hi, this is weird.

I'm testing VM 2 on J1.7 and my home test server (XAMPP) on windws XP.

The weird thing is that i change configuration on VM admin page, but config file (virtuemart.cfg) keeps saying "currency_converter_module=convertECB.php".

It seems that VM doesn't save my config

For my plugin, i think that vmlogger has been changed right? What can i do to output debug messages, because rith now my plugin is enables (manually edited cfg) but no conversion at all. So i want to do some debugging

Thanks  a lot in advise!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

Stephen Roberts

QuoteThe weird thing is that i change configuration on VM admin page, but config file (virtuemart.cfg) keeps saying "currency_converter_module=convertECB.php".

It seems that VM doesn't save my config

I think VM2 saves your configuration in the database in the #__virtuemart_configs table.

QuoteFor my plugin, i think that vmlogger has been changed right? What can i do to output debug messages, because rith now my plugin is enables (manually edited cfg) but no conversion at all. So i want to do some debugging

vmdebug seems to be the way to go now, but you'll need to turn on debugging in VM config. You can always go the old fashioned route and use 'echo' or 'print' or even JError.
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

razor7

Ja!, i think I found a bug in VM2 in file .../helpers/currencydisplay.php lines 44-53

In my case, $converterFile got this value from config "converter.php", so, line 44 allways fails, because gets this path ".../currency_converter/converter.php.php"

if (file_exists( JPATH_VM_ADMINISTRATOR.DS.'plugins'.DS.'currency_converter'.DS.$converterFile.'.php' )) {

$module_filename = $converterFile;

require_once(JPATH_VM_ADMINISTRATOR.DS.'plugins'.DS.'currency_converter'.DS.$converterFile.'.php');

if( class_exists( $module_filename )) {

$this->_currencyConverter = new $module_filename();

}

} else {

if(!class_exists('convertECB')) require(JPATH_VM_ADMINISTRATOR.DS.'plugins'.DS.'currency_converter'.DS.'convertECB.php');

$this->_currencyConverter = new convertECB();

}


Two options, trim the ".php", after getting "$converterFile  = VmConfig::get('currency_converter_module');" on line 41, or fix something in config save functions to trim the ".php" part of the filename

Adding this line after lien 41 makes sense!
        $converterFile=substr($converterFile, 0, strlen($converterFile)-4);

Just posted a bug report in bug forum

Be advised!


MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store