VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Mattybee on November 28, 2018, 01:13:39 AM

Title: Adding redirect to another site when standard payment selected
Post by: Mattybee on November 28, 2018, 01:13:39 AM
Hi,

I'm using joomla 3.9 and vm 3.2.13

I am trying to set the standard payment method to redirect after the customer has finalised their order to direct them to another page off my site so they can fill out a form for credit, the customer does not need to be redirected afterwards

I have tried searching for any info on how to do this but couldn't find anything I thought was relevant.

I assume it is just a simple line of code at the end and any help would be great thanks.

Thanks,
Matt.
Title: Re: Adding redirect to another site when standard payment selected
Post by: GJC Web Design on November 28, 2018, 08:48:13 AM
It would be a standard joomla redirect in an orderdone.php template override after checking/filtering for the correct payment method
Title: Re: Adding redirect to another site when standard payment selected
Post by: Mattybee on November 28, 2018, 22:11:35 PM
Ahhh thank you, that makes sense.

Do you know what code I would need to add?

I know how to set up an override.

Thanks,
Title: Re: Adding redirect to another site when standard payment selected
Post by: GJC Web Design on November 28, 2018, 22:36:28 PM
$mainframe = JFactory::getApplication();
$mainframe->redirect('https://xxx.com');

don't know if it works with external urls otherwise use a JS redirect

<script>document.location.href='https://xxx.com';</script>
Title: Re: Adding redirect to another site when standard payment selected
Post by: Mattybee on November 29, 2018, 00:17:27 AM
Hi,

the below line worked great thank you :)

I ended up adding it to post_payment.php under standard vmpayment.

<script>document.location.href='https://xxx.com';</script>

One last question how would I get this to only trigger when the order is flagged as confirmed by shopper please :)

You have been so much help.