SagePay Form - Edit the Unfriendly TX Code

For articles specific to version 5.x
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

SagePay Form - Edit the Unfriendly TX Code

Post by grantg »

Hello...

Hoping someone here can spot the problem, so here goes.

As standard, the TX Code is rather ugly, so when the customer gets to the SagePay 'Complete Order' page (as well as in the My Sage Pay reports), the order is shown as something like this:

Transaction Reference : dafb64cf2c5aeef1fc89c52367203ec5_82483

This is rather ugly, and has absolutely no reference to the customer, or their order - so reconciliation isn't exactly easy.

I would like to change the TX Code to begin with the 'Order ID' if possible, so:

Code: Select all

'VendorTxCode'		=> $_COOKIE['SHOP_ORDER_TOKEN'] . "_" . rand(1,100000),
I tried to change this to:

Code: Select all

'VendorTxCode'		=> $orderId. "_" .$_COOKIE['SHOP_ORDER_TOKEN'],
AND

Code: Select all

'VendorTxCode'		=> $GLOBALS['orderId']. "_" .$_COOKIE['SHOP_ORDER_TOKEN'],
But then the TX code is shown as:

Transaction Reference : _dafb64cf2c5aeef1fc89c52367203ec5

Note the Order ID is missing and shows no value at all.

So my question is, how do I reference the OrderID in this manner? I am assuming that, because the Order is already generated (can be seen in Incomplete Orders), the orderid must also be generated, but I'm not sure on how to get this to generate in this location.

Any ideas?

Thanks
Grant :)
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by Tony Barnes »

Hey Grant,

Here is how we've got ours:

Code: Select all

'VendorTxCode' 		=> $_COOKIE['SHOP_ORDER_TOKEN'] . "_" . rand(1,100) . "_" . $pendingOrder['orderid'],
This makes the first random number shorter, and tags the order ID on to the end of the TxCode. Works a treat for matching up orders with transactions.
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by grantg »

Thanks Tony!

I was using the $GLOBALS variable...seems it does work if I change that to $pendingOrder.

I am going to see if it'll work without the cookie part...our SagePay account is only used for sales through the one site, so the chance of getting duplicate Order Number + Random 3 digit code are pretty remote.

Will update once I get this working.

Cheers
Grant
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by grantg »

OK I tried using $pendingOrder but on the bounce page, an error is shown:

Undefined index 'pendingOrder' in modules/checkout/protx/module.protx.php


Do I need to define the variable elsewhere? I thought using $GLOBALS would use the global definition...maybe I'm wrong, but neither works :mrgreen:
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by Tony Barnes »

Pass..!

I'm using an OLD module, may have something to do with it?
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by grantg »

An old module in a newer version of the cart? Or just an old version of the cart? Doesn't really make sense, considering in 5.0.6 you couldn't view incomplete orders but you can in 5.5.2, which is what I'm using (presumably using $pendingOrder variable to confirm the order status in earlier versions.)
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: SagePay Form - Edit the Unfriendly TX Code

Post by Martin »

grantg wrote:An old module in a newer version of the cart? Or just an old version of the cart? Doesn't really make sense, considering in 5.0.6 you couldn't view incomplete orders but you can in 5.5.2, which is what I'm using (presumably using $pendingOrder variable to confirm the order status in earlier versions.)
The payment modules haven't changed that much and as it happens there's STILL a [insert expletive] bug that I fixed and informed InterSplutter about more than 3 months ago.

As for upgrading... only when I'm good and ready... :ugeek:
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by Tony Barnes »

Old module (think it was modded way back in 4.0.7 following Martins moaning, sorry, advice) running on 5.5.2
grantg
Posts: 112
Joined: Thu Oct 08, 2009 11:01 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by grantg »

Are you using VSP Form or VSP Direct? Is this old module still available..?

Thanks :)
Cupar Garden Centre: CS-Cart Professional 2.2.5 (Converted from ISC 6.0.14 Ultimate)
Online Garden Centre: ISC 6.0.14 Professional
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: SagePay Form - Edit the Unfriendly TX Code

Post by Tony Barnes »

Erm, form I think? Just checked and all it says is Protx - it's the one where they bounce to sagepay site, then come back again.

I can email you mine if you want! lol
Post Reply