Forums / Addon Payment Modules / Nochex not clear cart after succesful order (before_process not called)

Nochex not clear cart after succesful order (before_process not called)

Views: 5,204

Results 1 to 19 of 19
6 Jul 2010, 10:19 PM
#1
philchand avatar

philchand

New Zenner

Join Date:
Jul 2010
Location:
uk
Posts:
4
Plugin Contributions:
0

Nochex not clear cart after succesful order (before_process not called)

HI ALL

I am running the last 1.39d, with the nochex modules (from nochex update). Php 5.2.

I am having a strange problem, that after nochex returns back to the checkout_success page the cart/comments/etc is not cleared. (so all order processing has been successful, and success page is shown and everyone gets all the right emails and the order is created)

It seems to me that the before_process overriden function doesn't get called. (From what I can gather this is the function that clears the Session["cart"] No debug log produced with the debug module

I have check out the site running under 1.38a, everything runs as it should, cart cleared. I have run beyond compare (diff) between the two versions, checked all the changes, (note: I applied no changes to the nochex code, although they are different as nochex dropped from core in 1.39)

Other payments systems work, like cheque.

Being a professional coder, although PHP is not my main language, I'm finding very hard to debug this problem. So I need some pointers on how to debug zen cart.

I've tried dumping variables to flat file with no success, if I could do that it would help.

I was also looking to find in which order payment functions get called, am I looking in the right place. Where does the cart get normally cleared?

any pointers?

Phil

9 Jul 2010, 7:50 PM
#2
philchand avatar

philchand

New Zenner

Join Date:
Jul 2010
Location:
uk
Posts:
4
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Well, I think most of my assumptions were wrong, and before_process() doesn't seem to get called at all for nochex. I really couldn't find out the reason or where the change should go. And to limit me wasting my whole life on this I did what all coders do, I created a kludge. It's not bad as kudges go.

A small observational class that clears the cart and associated data on reaching successful checkout

The autoloader, place in includes/auto_loaders

<?php
// load the clearcart class 
// This looks like an example I once saw
// July 2010 - Phil Chandler

$autoLoadConfig[10][] = array('autoType'=>'class',
                              'loadFile'=>'observers/class.ClearCart.php');
$autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                              'className'=>'ClearCart',
                              'objectName'=>'ClearCart');
?>

the class

<?php

/*
 * Observer Class for clearing cart after successful nochex transaction
 * July 2010 - Phil Chandler
*/
class ClearCart extends base {


  // Attach for notifies
  function ClearCart() {
     $this->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_SUCCESS'));
  }

  // Update when notified
  function update(&$class, $eventID) {

	if ( $_SESSION['payment'] == 'nochex_apc')
	{
	$_SESSION['cart']->reset(true);
        unset($_SESSION['sendto']);
        unset($_SESSION['billto']);
        unset($_SESSION['shipping']);
        unset($_SESSION['payment']);
        unset($_SESSION['comments']);
        unset($_SESSION['cot_gv']);
	}
   }

}
?>

This could be used for clearing out the cart for any reason, but here it's just for nochex. The problem seems to exist on a freshly create 1.39 system.

I hope this will save some one else some time in the future. If you do know why nochex fails to clearout the cart and/or a fix please let me know.

Phil

10 Jul 2010, 11:00 AM
#3
catattak avatar

catattak

New Zenner

Join Date:
May 2006
Posts:
35
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Thanks for contacting me Phil... I have the addditional problem of the cart not seeing the order at all. I have deleted all the nochex files and the sql and reinstalled from scratch.

I think there is some data missing or some files missing for 1.3.9d to work...

Cat

14 Jul 2010, 10:55 AM
#4
tjrayner avatar

tjrayner

New Zenner

Join Date:
Jul 2010
Posts:
15
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Thanks for the message, this looks great, could you tell me where I need to place the code?

Thanks

16 Jul 2010, 12:37 PM
#5
baa avatar

baa

New Zenner

Join Date:
Jul 2007
Posts:
46
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Thanks Phil, do both pieces of code go into includes/auto_loaders?

16 Jul 2010, 1:14 PM
#6
philchand avatar

philchand

New Zenner

Join Date:
Jul 2010
Location:
uk
Posts:
4
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hi

Sorry, I thought it was obvious, but obviously not

the auto loaders code should be place in a file called "config.ClearCart.php" and place is the <root>/includes/auto_loaders

the class code should be placed in a file called "class.ClearCart.php" and placed in <root>/includes/classes/observers

Any trouble please post to this thread.

Phil

philchand:

Well, I think most of my assumptions were wrong, and before_process() doesn't seem to get called at all for nochex. I really couldn't find out the reason or where the change should go. And to limit me wasting my whole life on this I did what all coders do, I created a kludge. It's not bad as kudges go.

A small observational class that clears the cart and associated data on reaching successful checkout

The autoloader, place in includes/auto_loaders

<?php // load the clearcart class // This looks like an example I once saw // July 2010 - Phil Chandler $autoLoadConfig[10][] = array('autoType'=>'class', 'loadFile'=>'observers/class.ClearCart.php'); $autoLoadConfig[90][] = array('autoType'=>'classInstantiate', 'className'=>'ClearCart', 'objectName'=>'ClearCart'); ?>
> 
> the class
> 
> ```php
<?php

/*
 * Observer Class for clearing cart after successful nochex transaction
 * July 2010 - Phil Chandler
*/
class ClearCart extends base {


  // Attach for notifies
  function ClearCart() {
     $this->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_SUCCESS'));
  }

  // Update when notified
  function update(&$class, $eventID) {

	if ( $_SESSION['payment'] == 'nochex_apc')
	{
	$_SESSION['cart']->reset(true);
        unset($_SESSION['sendto']);
        unset($_SESSION['billto']);
        unset($_SESSION['shipping']);
        unset($_SESSION['payment']);
        unset($_SESSION['comments']);
        unset($_SESSION['cot_gv']);
	}
   }

}
?>

This could be used for clearing out the cart for any reason, but here it's just for nochex. The problem seems to exist on a freshly create 1.39 system.

I hope this will save some one else some time in the future. If you do know why nochex fails to clearout the cart and/or a fix please let me know.

Phil

17 Jul 2010, 8:30 AM
#7
baa avatar

baa

New Zenner

Join Date:
Jul 2007
Posts:
46
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hello Phil

Thanks for thinking I'm that knowledgeable! Unfortunately I'm just a retailer who uses Zen Cart so anything to do with the coding leaves me completely clueless. :wacko: I've used Zen Cart since 2006, I just don't have the time to learn anything above the normal operation of the site and adding very simple mods. I suspect that the same for a lot of us.

Thanks for the explanation I'll do that, I really appreciate your effort on this. :smile:

17 Jul 2010, 9:21 AM
#8
catattak avatar

catattak

New Zenner

Join Date:
May 2006
Posts:
35
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

That seems to clear the cart :clap:

Only thing I don't get now is email of confirmation of order from the admin section of the cart - although I can see the order in admin...:blink:

Thanks,

Cat

20 Aug 2010, 5:51 PM
#9
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

I used this code on a 1.3.9e cart, and it broke the checkout process. When I click Continue on the Step 1 of 3 checkout page, it goes to a blank page. If I remove these two files, the checkout works perfectly again, except that it does not clear the shopping cart.

Any ideas why this would be happening?

Thanks!

Danielle

21 Dec 2010, 11:12 PM
#10
shutzy avatar

shutzy

New Zenner

Join Date:
Dec 2010
Posts:
1
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hi there I have uploaded the Nochex shopping cart upgrade I was sent from Nochex and an APC Upgrade. My problem is this: In test mode my transaction goes through fine and I received an email frommy site, with what my customer has ordered. In Live, I get the Nochex confirmation, but no email from my website stating what my customer has ordered. Can anyone help??? Thanks Sean

Ps: Uisng Version v1.3.8h

19 Jan 2011, 10:57 PM
#11
linnets avatar

linnets

New Zenner

Join Date:
Dec 2010
Posts:
1
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Shutzy:

Hi there I have uploaded the Nochex shopping cart upgrade I was sent from Nochex and an APC Upgrade. My problem is this: In test mode my transaction goes through fine and I received an email frommy site, with what my customer has ordered. In Live, I get the Nochex confirmation, but no email from my website stating what my customer has ordered. Can anyone help??? Thanks Sean

Ps: Uisng Version v1.3.8h

Can anyone shed any light on this? I'm getting pretty much the same problem. I have re-uploaded the nochex apc files from the June 2010 update to my store via FTP but I'm still not getting any emails sent. The first time I click on an order within admin it gives me the following error at the top of the order:

1054 Unknown column 'order_id' in 'where clause'
in:
[select * from nochex_apc_transactions where order_id = '10' order by nochex_apc_id DESC LIMIT 1]

First of all, can someone confirm that the field in the database, which I can edit in phpMyAdmin, should be called "zen_order_id" or just "order_id" or even "_order_id" as per the pdf regarding installation says?

Also would changing the callback function from an https:// url to an http:// url help?

Any other suggestions will be gratefully received!

Just to clarify, I don't get any emails, and the order within admin doesn't show what products have been bought. Everything else is there, (customer name, email address, delivery address, order value, payment method etc...) but I just don't know what anyone has bought. One other symptom is that the stock level doesn't deplete in the store.

Help!?
Please. :)

25 Jan 2011, 12:15 PM
#12
nochexsupport avatar

nochexsupport

New Zenner

Join Date:
Jun 2010
Posts:
16
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hello,

You are receiving the error:
1054 Unknown column 'order_id' in 'where clause'
in:
[select * from nochex_apc_transactions where order_id = '10' order by nochex_apc_id DESC LIMIT 1]

Because you don't have the right column name, you need to change it to order_id. In Zen Cart version 1.3.8 they changed the column name from zen_order_id to order_id.

Just follow this link to download the files needed:
http://esupport.nochex.com/index.php?_m=downloads&_a=viewdownload&downloaditemid=7&nav=0

Use the files for the version of Zen Cart you have and make sure you follow the instructions in the guide carefully. Always remember to process the SQL file as this will change the column name to the correct one for your version.

Kind Regards,
Matthew Iveson
Nochex Technical Support

22 Feb 2011, 10:48 AM
#13
chienmort avatar

chienmort

New Zenner

Join Date:
Jul 2009
Posts:
29
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hi, I am using a seller account (don't know if that makes a difference I also have a merchant account for another shop) and am having problem two problems:

  1. The emails from Nochex to both customer and shop admin have no order details.

This is the text in the admin email:
*Transaction Type: Xtra
Transaction Date: 22/02/2011 10:25:45
Transaction ID: 17222342812983703143
Order ID:
Transaction Description:
NO MESSAGE ATTACHED]

Transaction Amount: £10.28
Postage & Packing: £2.00
Insurance: £0.00
Sub Total: £12.28
Transaction Charge: £0.00
Total Received: £12.28
Current Balance: £13.27*

  1. The payment success page is shown for only 0.5 seconds, so the customer cannot review or print the the transaction details.

Thanks in advance for any assistance.

22 Feb 2011, 12:04 PM
#14
chienmort avatar

chienmort

New Zenner

Join Date:
Jul 2009
Posts:
29
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Chienmort:

Hi, I am using a seller account (don't know if that makes a difference I also have a merchant account for another shop) and am having problem two problems:

  1. The emails from Nochex to both customer and shop admin have no order details.

This is the text in the admin email:
*Transaction Type: Xtra
Transaction Date: 22/02/2011 10:25:45
Transaction ID: 17222342812983703143
Order ID:
Transaction Description:
NO MESSAGE ATTACHED]

Transaction Amount: £10.28
Postage & Packing: £2.00
Insurance: £0.00
Sub Total: £12.28
Transaction Charge: £0.00
Total Received: £12.28
Current Balance: £13.27*

  1. The payment success page is shown for only 0.5 seconds, so the customer cannot review or print the the transaction details.

Thanks in advance for any assistance.

Just in case it helps, the APC debug emails are as follows. I have only changed the email addresses for security reasons:

  1. APC Session Query: SELECT *
    FROM iusw_nochex_sessions
    WHERE session_id = '165bf1208ef45fb149c03841f3edd336'

$session_stuff = Array
(
[0] => zenid
[1] => 165bf1208ef45fb149c03841f3edd336
)

  1. APC NOTICE::Got past language loads

  2. APC INFO - POST VARS
    transaction_id=2559834
    &transaction_date=22%2F02%2F2011+11%3A33%3A00
    &order_id=
    &amount=5.99
    &from_email=mycustomer%40hotmail.com
    &to_email=myemail%40virginmedia.com
    &security_key=de9e197bbb3d4145bc7c579fa65c041a
    &status=test
    &custom=zenid%3D165bf1208ef45fb149c03841f3edd336

  3. APC INFO - RESPONSE
    HTTP/1.1 200 OK
    Connection: close
    Transfer-Encoding: chunked
    Expires: -1
    Date: Tue, 22 Feb 2011 11:32:24 GMT
    Content-Type: text/html
    Server: Microsoft-IIS/6.0
    Cache-Control: no-store
    Pragma: nocache


AUTHORISED

7 Mar 2011, 1:13 PM
#15
shop4costumes avatar

shop4costumes

New Zenner

Join Date:
Feb 2011
Posts:
16
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Chienmort:

Just in case it helps, the APC debug emails are as follows. I have only changed the email addresses for security reasons:

Hi
Did you find a fix for this ?
we have the same problems on a new site.

I wasnt sure if it wasnt a problem with being in test mode, so went live and the same happens.
Changed https to http on the callback.
Changed the server permissions to allow outgoing messages to the NoChex IP address.

THe Nochex confirmation screen only displays for a brief second and then returns to our site.

The Zencart emails all look ok, but the Nochex email sent to the customer and the control panel in nochex does not confirm details.

The third problem is that the customer is returned to the site, it shows confirmation screen, but the shopping cart is not empty.

I have double checked all files I loaded and I think I have done everything correctly.

Any suggestions ?

Thanks

Paul

https://www.shopforcostumes.co.uk

8 Mar 2011, 11:14 PM
#16
shop4costumes avatar

shop4costumes

New Zenner

Join Date:
Feb 2011
Posts:
16
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Just to let anyone who has had the same problem that this fix worked for me - so thanks Phil (if you are out there somewhere)

The only thing that I had to do was edit the file names, when I created them in Notebook++ they became .clearcart files.
I simply uploaded to server as instructed and added the .php to the end.

I still have my cart in test so havent tried with nochex live yet, but it does seem to now clear the cart after payment which has been my biggest problem.

Thanks
Paul

https://www.shopforcostumes.co.uk

8 Mar 2011, 11:19 PM
#17
shop4costumes avatar

shop4costumes

New Zenner

Join Date:
Feb 2011
Posts:
16
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

if its of any help to anyone this post solved the cart not emptying problem (so far anyway!)
http://www.zen-cart.com/forum/showthread.php?p=1004765#post1004765

Still unsure about the short lived display of the Nochex confirmation screen and the lack of data being shown on the Nochex payment screen - so if any ideas please let me know.

Thanks
Paul
https://www.shopforcostumes.co.uk

16 Apr 2011, 1:09 PM
#18
gouldy avatar

gouldy

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Hi
I tied the fix to clear the cart and all seemed to work in test fine
So I went live
Then today I had an order that appeared in admin but no detail or email sent from zen. as soon as I removed the 2 files to clear the cart all OK and working fine now, except the cart is no longer clearing, so back to square 1.

I dont know if it was just a one of. that the cart was cleared before the nochex handler got the payment message. also nochex didnt show any details of the order.
So did the cart get cleared while the customer was transfering to nochexs or something else. I tried ressetting the callback message from nochex as it said it was pending!. it sent it again and then said it had been processed another order appeared in zen admin but still with no details only the moeny amount.

Driving me nuts this one, any help would take away so much stress, as with PayPal when anybody tries to pay with a card they says not accepted ( am sure they want everybody to set up an account with them even though they say you dont have to). I thought I had it solved with nochex. until I can solve this I have no faith in any payment system at the moment

David

David Goud

18 Apr 2011, 8:49 PM
#19
gouldy avatar

gouldy

New Zenner

Join Date:
Mar 2011
Posts:
6
Plugin Contributions:
0

Re: Nochex not clear cart after succesful order (before_process not called)

Spent all day and it is fixed

I dont know if it was a change I made in my zen cart or the ticket I posted on nochex forum.
Will find out tomorrow and re-post the details :D

David Goud