VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: razor7 on December 26, 2011, 19:27:48 PM

Title: currency convertion plugins
Post by: razor7 on December 26, 2011, 19:27:48 PM
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!
Title: Re: currency convertion plugins
Post by: Stephen Roberts on December 26, 2011, 19:59:09 PM
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?
Title: Re: currency convertion plugins
Post by: razor7 on December 26, 2011, 20:04:49 PM
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!
Title: Re: currency convertion plugins
Post by: Stephen Roberts on December 26, 2011, 20:10:07 PM
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.
Title: Re: currency convertion plugins
Post by: razor7 on December 26, 2011, 20:27:48 PM
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!