Hi everyone
I'm facing a strange error with J 4.2.6 and VM 4.0.12
Using standard payment module that shoud simply display a message page, I reach a error that leads to blank page loaded.
After clicking the "confirm order" in cart page i see this in logs:
Invalid status line from script 'index.php': 0, referer: https://[MYSITEURL]/cart.html
This also happens if i reload the page allowing the POST to be repeated
If I go to the URL wy typing it I see the cart page.
If I use Paypal I'm redirected to the Paypal Payment page BUT If I click on the cancel button I'm redirected to my site with a shop offline message.
The error seems to happen in
controllers/vmplg.php
in function pluginUserPaymentCancel when it calls
vDispatcher::trigger('plgVmOnUserPaymentCancel', array());
I suspect the same happen when triggering the paymentConfirm event
Any clue?
Tracked where it crashes:
models/order.php
$_returnValues = vDispatcher::trigger('plgVmOnUpdateOrderPayment',array(&$data,$old_order_status,$inputOrder));
then it goes to class vDispatcher and goes 500 on line
return self::$dispatcher->triggerEvent($name, $params);
I'm on J4.2.6
commenting line
$_returnValues = vDispatcher::trigger('plgVmOnUpdateOrderPayment',array(&$data,$old_order_status,$inputOrder));
in models/order.php fixes the payment return but doesn't call plugin method to update the order if needed.
Anyway the plgVmOnUpdateOrderPayment event never reaches the payment plugin.
I'll dig some deeper to undertand the reasons since a test site with the same J 4.2.6 doesn'how this problem.
I suspect it may come from something wrong with configuration sice this is an upgraded Vm installation
Here I am
I debugged the problem and come to a solution.
The cause of error 500 is Amazon Pay plugin.
Here is the original code:
public function plgVmOnUpdateOrderPayment(&$order, $old_order_status) {
static $updateOrderPaymentNumber = 0;
// we don't do anything from the front end
if(JFactory::getApplication()->isSite()) {
return NULL;
}
Very unrfortunatelly the isSite function doesn'exist anymore so it has to be amended as follows:
public function plgVmOnUpdateOrderPayment(&$order, $old_order_status) {
static $updateOrderPaymentNumber = 0;
// we don't do anything from the front end
if(JFactory::getApplication()->isClient('site')) {
return NULL;
}
Fixed this line in the amazon.php the model works fine and the plgVmOnUpdateOrderPayment method gets called with no errors.
Very great work, Alex. I was in christmas feeling and not checking the forum.
We just use VmConfig::isSite(), the reason is our FE manager mode. So we have VmConfig::isSite() and VmConfig::isSitebyApp(), to differ if we are in the backend, regardless accessed from the frontend. Or if we are in the real site or admin area. the isSitebyApp is used for the "infrastructure" like loading the right paths for layouts, templates, and so on.
directly fixed, so it will be in the next update
;D