Jump to content

Changing ReturnURL and CancelURL


CrossY

Recommended Posts

Hi there,

 

I wish to redirect my customers to a different page than is default when they finish/cancel their order with PayPal.

 

I have to make sure that any hidden data is still sent to prestashop, to ensure that all orders are coming in.

 

I've found some code in /express_checkout/process.php, but i'm not quite sure how to change it properly:

private function _setPaymentDetails(&$fields)
	{
		// Required field
		$fields['RETURNURL'] = PayPal::getShopDomainSsl(true, true)._MODULE_DIR_.$this->name.'/express_checkout/payment.php';
		$fields['NOSHIPPING'] = '1';
		$fields['BUTTONSOURCE'] = $this->getTrackingCode((int)Configuration::get('PAYPAL_PAYMENT_METHOD'));

Best,

Dave

Edited by CrossY (see edit history)
Link to comment
Share on other sites

I think I've managed to at least change the ReturnURL. The CancelURL still seems to redirect back to the shop itself, but that's not too worrying for me at the moment..

 

File: /paypal/views/templates/hook/integral/integral_evolution_payment.tpl

	<input type="hidden" name="cancel_return" value="{http://www.yourwebsite.com/payment-error/|escape:'htmlall':'UTF-8'}" />
	<input type="hidden" name="return" value="{http://www.yourwebsite.com/payment-succesful/|escape:'htmlall':'UTF-8'}" />
Edited by CrossY (see edit history)
Link to comment
Share on other sites

In process.php there is a function called setCancelUrl.  You would need to alter this function to change the cancel url.

 

However if the Paypal module is not invoked when the customer cancels, then there will be certain cookie information retained in the customers browser which could effect the checkout process and it may not function as expected

 

As for the return URL, why don't you describe what or why you are trying to change this.  If you change it from payment.php then the module will not be able to create a Prestashop order, and that will be problematic

Link to comment
Share on other sites

I've given the setCancelUrl a try, but either way I tried it I got a Paypal module error.

 

As for the return URL, i'm using Wordpress for the main part of my side. I only sell 1 product, so I've stripped down Prestashop to the bare minimum and it's opened in an iFrame. Upon finishing/cancelling I want the users to be redirected back to the 'main' site, and not the default Prestashop environment.

 

The way I've set it up now seems to work (via the integral_evolution_payment.tpl form). There is a difference between the notification URL and the return URL, so that appears to work without problems at the moment.

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...