We are writing a payment plugin. After redirecting back from the payment gateway to the shop, we would like the user to be redirected to the page Home->Thank you for your Order! instead of just Home for a successful payment, like the standard payment method...
how can i do that? This is my plgVmOnPaymentResponseReceived function
function plgVmOnPaymentResponseReceived(&$html) {
if (!class_exists('VirtueMartCart')) {
require_once(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
}
if (!class_exists('shopFunctionsF')) {
require_once(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
}
if (!class_exists('VirtueMartModelOrders')) {
require_once(VMPATH_ADMIN . DS . 'models' . DS . 'orders.php');
}
$jinput = JFactory::getApplication()->input;
$inputValues = $jinput->getArray(array(
'option' => 'STRING',
'view' => 'STRING',
'task' => 'STRING',
'session' => 'ALNUM',
'vmpm' => 'int',
'vmoid' => 'int',
'vmuid' => 'int',
'gcReference' => 'CMD',
'gcMerchantTxId' => 'RAW',
'gcBackendTxId' => 'RAW',
'gcAmount' => 'int',
'gcCurrency' => 'ALNUM',
'gcResultPayment' => 'int',
'gcHash' => 'ALNUM'
));
if (!($method = $this->getVmPluginMethod($inputValues['vmpm']))) {
return NULL; // Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return NULL;
}
//MORE CODE to check if it is a successful transaction
if ($notify->paymentSuccessful()) {
$cart = VirtueMartCart::getCart();
$payment_name = parent::renderPluginName($method);
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($inputValues["vmoid"]);
if (!class_exists('CurrencyDisplay')) {
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
}
$totalInPaymentCurrency = vmPSPlugin::getAmountInCurrency($order['details']['BT']->order_total,$method->payment_currency);
$html = $this->renderByLayout('post_payment', array(
'order_number' => $order['details']['BT']->order_number,
'order_pass' => $order['details']['BT']->order_pass,
'payment_name' => $payment_name,
'displayTotalInPaymentCurrency' => $totalInPaymentCurrency['display']
));
$cart->emptyCart();
return TRUE;
} else {
$html = $notify->getResponseMessage($notify->getResponseParam('gcResultPayment'), GiroCheckout_Utility::getLanguageCode());
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage($html, 'Warning');
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=editpayment'));
}
return NULL;
}
but a return TRUE will send you back to the cart - order_done.php template and display the $html
you can over ride and display what u want there
I return True but the user is redirected to the path Home (see attachment img1)
I would like the user to be redirected to Home -> Thank you for your order! (see attachment img2)
but what does the url path matter?
that is the order_done.php template and u can alter this is any way you like
So, how can i have the same url? i do the same than the standard payment method but i don't obtain the same path