Redirecting from end.php

  • Posts: 4
  • Thank you received: 0
10 years 8 months ago #172778

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4.31
-- Browser(s) name and version -- : N/A

Hi
I have a cart workflow that can either go via PayPal or use a voucher in which case no payment is necessary.
At the end of checkout i am redirecting to an order summary page to give the user information, a serial and download link.
This works fine for PayPal when i redirect from after_end.php and the payment process completes, however for the voucher the process seems to go to end.php and never gets to after_end.php.

If i put a redirect in end.php, things are OK for the voucher but when Paypal is selected as a payment method the process redirects before it gets to go to PayPal so no payment is taken.

Ideally i'd like to check for the payment method in end.php and conditionally redirect but not sure how to do this. Maybe there is a better way ?

TIA,
Ian

Please Log in or Create an account to join the conversation.

  • Posts: 83890
  • Thank you received: 13579
  • MODERATOR
10 years 8 months ago #172806

Hi,

Yes, you can add such check in end.php like this:

			$app = JFactory::getApplication();
			$order_id = $app->getUserState('com_hikashop.order_id');
			$orderClass = hikashop_get('class.order');
			$order = $orderClass->get($order_id);
			if($order->order_payement_method!='paypal'){
				$app->redirect('Your URL here');
			}

The following user(s) said Thank You: IanH

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
10 years 8 months ago #173388

That did the trick. Many thanks

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum