Jump to content
Sign in to follow this  
scottymcloo

Worldpay support III

Recommended Posts

Hi

 

osC 2.2

STS

Purchase w/Account installed

------------------------------------

 

 

Iam getting this error :

 

1062 - Duplicate entry '2e1b3ca80e7039fc4e6599811e715eec' for key 1

 

insert into sessions values ('2e1b3ca80e7039fc4e6599811e715eec?language=en', '1130601637', 'cart|O:12:\"shoppingcart\":4:{s:8:\"contents\";a:0:{}s:5:\"total\";i:0;s:6:\"weight\";i:0;s:12:\"content_type\";b:0;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"GBP\";navigation|O:17:\"navigationhistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:14:\"wpcallback.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:3:{s:6:\"osCsid\";s:44:\"2e1b3ca80e7039fc4e6599811e715eec?language=en\";s:7:\"msgType\";s:10:\"authResult\";s:12:\"installation\";s:6:\"124175\";}s:4:\"post\";a:36:{s:8:\"testMode\";s:3:\"100\";s:8:\"authCost\";s:4:\"2.49\";s:8:\"currency\";s:3:\"GBP\";s:7:\"address\";s:26:\"testing ci test test LN\";s:13:\"countryString\";s:14:\"United Kingdom\";s:12:\"installation\";s:6:\"124175\";s:3:\"fax\";s:0:\"\";s:12:\"countryMatch\";s:1:\"B\";s:7:\"transId\";s:9:\"140144563\";s:3:\"AVS\";s:4:\"0000\";s:12:\"amountString\";s:10:\"?2.49\";s:8:\"postcode\";s:6:\"582580\";s:7:\"msgType\";s:10:\"authResult\";s:4:\"name\";s:12:\"Tester Final\";

 

---------------

 

Any help ?

Share this post


Link to post
Share on other sites
Hi Joanna,

 

I have completely reworked my callback script BUT something like this might work for adding the WorldPay transaction ID into admin.

SO BACK UP FIRST, and if any of this doesn't match what you have then revert to your backup and apologies for wasting your time! I hope you're comfortable with php because I may have made a few mistakes here & there.

 

This gets the ID into the admin order lists (default order.php display). If it works for you then it won't be much effort to add the ID into the order detail page, invoice etc.

 

I'm afraid I don't have much time to spend on this board so don't count on any support of this. I'm providing this as a hint rather than a solution!

 

anna

 

1. In mysql:

alter table orders add `worldpay_transId` int(16) unsigned default NULL;

 

2. In catalog/wpcallback.php approx line 74:

replace

$url = tep_href_link(FILENAME_CHECKOUT_PROCESS, $cartId, 'NONSSL', false);

with

$worldpay_transId = (int) $_POST['transId'];
$url = tep_href_link(FILENAME_CHECKOUT_PROCESS, $cartId.'&trans='.$worldpay_transId, 'NONSSL', false);

as WorldPay should POST the transId to the callback and you need to send it on to checkout_process.php

 

3. In catalog/checkout_process.php approx line 95:

In the line before:

tep_db_perform(TABLE_ORDERS, $sql_data_array);

that ends

'currency_value' => $order->info['currency_value']);

change the end from

'currency_value' => $order->info['currency_value']);

to

'currency_value' => $order->info['currency_value'],
'worldpay_transId' => (int) $_GET['trans']);

to get it into the database.

 

4. In admin/orders.php approx line 350

After

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>

add

<td class="dataTableHeadingContent" align="right">Worldpay ID</td>

to give a heading.

Note this doesn't use the language file - I was lazy as I don't have any call for multi-language admin.

 

5. Still in admin/orders.php 3 lines follow soon after and they all start with $orders_query_raw. Add o.worldpay_transID into the sql as below:

Change

$orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC";

to

$orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, o.worldpay_transID, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by orders_id DESC";

then change

$orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC";

to

$orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, o.worldpay_transID, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id DESC";

and change

$orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC";

to

$orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, o.worldpay_transID, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and ot.class = 'ot_total' order by o.orders_id DESC";

all to retrieve it from the db

 

6. Still in admin/orders.php approx line 379 after

<td class="dataTableContent" align="right"><?php echo $orders['orders_status_name']; ?></td>

add

<td class="dataTableContent" align="right"><?php echo $orders['worldpay_transID']; ?></td>

to display it.

 

good luck!

 

Thanks for this, i know everyone harps on about it but i still dont know why my worlpay payment page is not redirecting back to my site after payment.

The order shows in admin, but the user cant get back to the shop. If i go to the shop site again, the cart is still full with the items!

 

Can you help, or point mein the right direction?

Share this post


Link to post
Share on other sites

Hi i've installed worldpay and its working great except its not redirecting customers back to my site after payment and orders are not appearing in admin order panel

 

I found this in the install file

 

"I found that orders were not appearing in my admin screen once payment had been received.

I found this was nothing to do with the payment module but that 3 rows were missing from the order_status table.

 

INSERT INTO orders_status VALUES (1, 1, 'Pending');

INSERT INTO orders_status VALUES (2, 1, 'Processing');

 

INSERT INTO orders_status VALUES (3, 1, 'Delivered');

Will reslve this problem. Only do this if you experience the same problem."

 

but where do I insert these values into Order_status.php i'm kinda urgent on this as my site is now live and I dont have access to orders as they come in and I dont want to have to close my site down :'(

Share this post


Link to post
Share on other sites
heh ok. Well I just took a quick look and the process is:

 

wpcallback.php -> checkout_process.php (payment ok) OR back-to-payment-page (payment fail) -> checkout_success.php (the final Thanks page)

 

It's checkout_process.php that does the important stuff. It puts the order into the database and sends the order emails. It doesn't display anything, leaving that job to the separate checkout_success.php (which by the same token, doesn't do anything important)

 

Apart from the fact it'd be changing the way OSC likes to work, ideally checkout_process and checkout_success need to be brought into wpcallback.php so that this 1 file does all 3 things:

 

1) Called from Worldpay to do stuff.

2) Puts the order into the database.

3) Says Thanks.

 

I'm willing to have a go, but I'm going to have to install Worldpay into my test store to try it out and report back. I don't know when I'll have time for that but I'll try and remember.

This would be ideal - was there any follow up please?

 

:)

Share this post


Link to post
Share on other sites

Hi guys!

 

I've almost read all posts in this but couldn't find the solution for my problem!

 

And the problem is that my orders are not showing up in admin panel after processing at worldpay!

 

i had solved callback redirect problem, it redirects fine but the orders are not shown in my osc admin panel!

 

Kindly guide me what to do?

 

Please don't ignore it :(

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×