VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: SteveTM on June 13, 2014, 11:50:51 AM

Title: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: SteveTM on June 13, 2014, 11:50:51 AM
After updating Joomla from 2.5.20 to 2.5.22, the Klarna Payment plugin in breaks and generates error.

When I trying to access the plugin from the backend administration, the layout is broken and

Warning: require(/home/u/u8823798/www/plugins/vmpayment/klarna/helpers/define.php) [function.require]: failed to open stream: No such file or directory in /home/u/u8823798/www/plugins/vmpayment/klarna/klarna/elements/getklarna.php on line 25

It seems that Klarna gets a wrong path as the helpers folder is located in klarna/klarna/helpers and not klarna/helpers

Following code in getklarna.php constructs the path

if (JVM_VERSION === 2) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');
}
} else {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');
}
}


Joomla 2.5.22
Virtuemart 2.6.6
PhP: 5.3.27

Grateful for assistance as I had to revert to 2.5.20 and can not update until this is solved

Regards/Stefan
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: alatak on June 13, 2014, 12:11:31 PM
Hello

Can you try replacing this  code
if (JVM_VERSION === 2) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');
}
} else {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');
}
}


by

require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');

Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: SteveTM on June 13, 2014, 13:59:57 PM
Hi

I will replace it on a testsite, and get back with the result.


Regards/Stefan
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: SteveTM on June 13, 2014, 14:07:56 PM
Hi

After replacing the code, I get following error, trying to open the plugin:


Parse error: syntax error, unexpected $end in /home/u/u8823798/www/plugins/vmpayment/klarna/klarna/elements/getklarna.php on line 58

Regards/Stefan
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: alatak on June 13, 2014, 14:23:13 PM
Hello
ok, sry missing one line
This should be correct:
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'define.php');
if (!class_exists ('KlarnaHandler')) {
require (JPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'klarna' . DS . 'klarna' . DS . 'helpers' . DS . 'klarnahandler.php');
}
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: SteveTM on June 13, 2014, 14:31:39 PM
Hi

yes that works and the plugin shows correctly,
but language files don't seem to load and all old values are gone (see attachment).

Regards/Stefan

[attachment cleanup by admin]
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: alatak on June 16, 2014, 10:09:18 AM
Hello
which version of VM are u using ?
VM2.6.6 ?
Title: Re: Klarna plugin breaks after updating from Joomla 2.5.20 to 2.5.22
Post by: SteveTM on June 21, 2014, 13:32:25 PM
Hi

Yes VM 2.6.6 and Joomla 2.5.20

PHP 5.3.27

Regards/Stefan