Virtuemart 2.0 plugin HSBC Global Iris Realex Payments return page does not work with sh404SEF

Solution for Virtuemart 2.0 plugin for HSBC Global Iris Realex Payments return page not working with sh404SEF :

You'll find that notify.php appears in 404 section of sh404sef URLs - meaning it's getting lost. The reason for this is that notify.php tries to redirect to index.php, but it gets muddled doing this, due to sh404sef. The solution is to run a CURL request and get the URL that way :

Edit the file /plugins/vmpayment/realex/notify.php ; replace/add from abs_path :

// ORIGINAL CODE IS HERE
// get paths
$abs_path = dirname( dirname( dirname( dirname(__FILE__) ) ) );
chdir( $abs_path );
//require_once( 'index.php' );

// INSTEAD DO A CURL REQUEST - as the redirect does not work with sh404sef
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.WEBSITE.com/index.php?element=realex&option=com_virtuemart&view=pluginresponse&task=pluginnotification&format=raw
");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

// grab POST variables
$data=$_POST;

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

print $output;

/**************** END OF NEW CODE *******/

 

Leave a Reply