Guest krypton1 Posted January 17, 2006 Share Posted January 17, 2006 Many people on this forum have comments about how the Paypal direct payment gateway has a major flaw: it doesn't provide any useful error message back to the customer when the order has failed. No matter how it fails, it says the same thing: "Order failed!". Not helpful! This could be the customers card was declined, wrong address, maybe they typed in the expiration year with 2 digits instead of 4, etc. They would never know, and probably never make the purchase! These error messages are also quite useful when you are trying to get the module installed. If you are having trouble getting it installed, you should probably read this thread: http://www.cubecart.com/site/forums/index....showtopic=11714 Bottom line, it is probably costing cube cart store owners a small fortune in lost orders from customers who got frustrated and just gave up! So anyway, here is the fix. There are 3 files to edit: 1. Edit cart\modules\gateway\DirectPayment\form.inc.php around line 141, change //if(Services_PayPal::isError($response)) // echo $response->getMessage(); header("Location: confirmed.php?f=1"); exit; to // if(Services_PayPal::isError($response)) // echo $response->getMessage(); $errs = $response->getErrors(); $message = ""; if(is_array($errs)){ foreach($errs as $err){ $m = $err->getLongMessage(); if(substr_count($message,$m) == 0) $message .= $m . "<BR>"; } }else{ $message = $errs->getLongMessage() . "<BR>"; } header("Location: confirmed.php?f=1&err=".urlencode($message)); exit; 2. Edit cart\includes\content\confirmed.inc.php around line 126 change $confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']); $confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']); $confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']); $confirmation->parse("confirmation.session_true.order_failed"); to $confirmation->assign("LANG_ORDER_FAILED",$lang['front']['confirmed']['order_fail']); $confirmation->assign("LANG_ORDER_FAILED_ERRORS",$_GET['err']); $confirmation->assign("LANG_ORDER_RETRY",$lang['front']['confirmed']['try_again_desc']); $confirmation->assign("LANG_RETRY_BUTTON",$lang['front']['confirmed']['try_again']); $confirmation->parse("confirmation.session_true.order_failed"); The only thing different is one line gets inserted (the second one). 3. Edit cart\skins\[NAME OF THE SKIN YOU ARE USING]\styleTemplates\content\confirmed.tpl around line 20 change <!-- BEGIN: order_failed --> <p>{LANG_ORDER_FAILED}</p> <p>{LANG_ORDER_RETRY}</p> to <!-- BEGIN: order_failed --> <p>{LANG_ORDER_FAILED}</p> <p><font color=red>{LANG_ORDER_FAILED_ERRORS}</font></p> <p>{LANG_ORDER_RETRY}</p> Again, only the one line is inserted. This should fix it (if not let me know, maybe I forgot something, its been a long day). I know a lot of people were offering money for this fix, but I decided to post it for free to keep with the spirit of open source cube cart. Hope this helps some people! Brian Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted January 17, 2006 Share Posted January 17, 2006 Here is another fix, I put on my cart. This will eliminate the screen that allows the user to select their payment method. In my case, I only have one payment method I want them to use (Paypal Direct Payment) so this screen is unecessary and confusing for the customer. Also, I have no idea what the purpose of the "Your comments" box is.....once again, unecessary and confusing for the customer. The fix is easy. Edit this file: cart\includes\content\gateway.inc.php Around line 47, right after this line: $gateway->assign("LANG_COMPLETE",$lang['front']['gateway']['complete']); Add in this: //permantently set the gateway variable here to avoid the "select a payment method screen" $_POST['gateway'] = "DirectPayment"; You can use this fix to automatically select any payment method. In the added line just change "DirectPayment" to "Whichever gateway you want to use" To find the correct name to put there, browse to: cart\modules\gateway and use the name of the folder of the gateway you want automatically selected. Regards, Brian Quote Link to comment Share on other sites More sharing options...
Guest Posted January 17, 2006 Share Posted January 17, 2006 These are both excellent mods well done Quote Link to comment Share on other sites More sharing options...
Guest jaycarney Posted January 20, 2006 Share Posted January 20, 2006 Fatal error: Call to a member function getLongMessage() on a non-object in .../music/modules/gateway/DirectPayment/form.inc.php on line 147 what am i doing wrong here? Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted January 21, 2006 Share Posted January 21, 2006 Hi, Another user posted an error like this, but then later found out it actually was working. He just had to exit the check out and start over from the homepage. Seems strange, but this might work. If not, PM me and I will take a closer look at it. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Guest pacoferia Posted January 21, 2006 Share Posted January 21, 2006 Many thanks Krypton, I´ve just added your code...and bingo!! this is the first time I dare to change code lines, for me all those parentheses, lines and words is like chinese but I did it with yours because it looked clear and short, well this encourages me to try with longest and complicate codes running around this forum, PD- ey man, what were you doing at your childhood??? I said because I would need all my life to learn such thing and I presume you haven´t had much time for playing while learning that gibberish .... but despite that it´s incredible for me.... it works!! Here is another fix, I put on my cart. This will eliminate the screen that allows the user to select their payment method. In my case, I only have one payment method I want them to use (Paypal Direct Payment) so this screen is unecessary and confusing for the customer. Also, I have no idea what the purpose of the "Your comments" box is.....once again, unecessary and confusing for the customer. The fix is easy. Edit this file: cart\includes\content\gateway.inc.php Around line 47, right after this line: $gateway->assign("LANG_COMPLETE",$lang['front']['gateway']['complete']); Add in this: //permantently set the gateway variable here to avoid the "select a payment method screen" $_POST['gateway'] = "DirectPayment"; You can use this fix to automatically select any payment method. In the added line just change "DirectPayment" to "Whichever gateway you want to use" To find the correct name to put there, browse to: cart\modules\gateway and use the name of the folder of the gateway you want automatically selected. Regards, Brian Quote Link to comment Share on other sites More sharing options...
Guest Posted January 27, 2006 Share Posted January 27, 2006 Fatal error: Call to a member function on a non-object in /home/pwhole/public_html/store/modules/gateway/DirectPayment/form.inc.php on line 145 I am getting it again now it was working now its not not sure what would have changed to get the error again but something is not working right line 145 = if(substr_count($message,$err->getLongMessage()) == 0) Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted January 28, 2006 Share Posted January 28, 2006 viper, PM me. If you can setup a tmp login/pass on your server I will be happy to look into this further. Quote Link to comment Share on other sites More sharing options...
Guest Insurrectus Posted February 2, 2006 Share Posted February 2, 2006 Same error here www.onecraftymama.com Fatal error: Call to a member function on a non-object in /home/pwhole/public_html/store/modules/gateway/DirectPayment/form.inc.php on line 146 line 146 = if(substr_count($message,$err->getLongMessage()) == 0) Any thoughts? Thanks, Clint Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2006 Share Posted February 8, 2006 I was hopeing that some one could maybe fix it it was working but I thank It stoped after I turned off register_globals could this have an effect on the code above? Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted February 9, 2006 Share Posted February 9, 2006 Hey Guys, I have fixed this error (thanks go to Insurrectus for helping me recreate the error). It was working in some cases, and failing in others. For the programmers out there, here is the explanation: paypal's function had an inconsistant return type (which is allowed for some reason in PHP but a very bad idea). When there were multiple errors, it would return an array of errors. When it was one error, it would return just the error itself, not an array with one error in it. Anyway, the code in the first file should look like this now: cart\modules\gateway\DirectPayment\form.inc.php around line 141 // if(Services_PayPal::isError($response)) // echo $response->getMessage(); $errs = $response->getErrors(); $message = ""; if(is_array($errs)){ foreach($errs as $err){ $m = $err->getLongMessage(); if(substr_count($message,$m) == 0) $message .= $m . "<BR>"; } }else{ $message = $errs->getLongMessage() . "<BR>"; } header("Location: confirmed.php?f=1&err=".urlencode($message)); exit; I've updated the first post on this thread so it is correct up above as well. If you guys test it out and come across any more errors, please let me know and I will fix it!! I'm using this mod on my site too, and its always better for us to find an error before a customer does. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Guest Insurrectus Posted February 9, 2006 Share Posted February 9, 2006 Brian, Works great - thanks a bunch. Clint Quote Link to comment Share on other sites More sharing options...
Guest mashurst Posted February 12, 2006 Share Posted February 12, 2006 worked well for me also. Installed your fix because it looks like I lost a sale today because of this. Sending paypal extra value meal money to your address. -M :D Quote Link to comment Share on other sites More sharing options...
Guest JABevan Posted February 13, 2006 Share Posted February 13, 2006 Hi, I applied this fix and now my shopping cart jumps straight from the form of payment page to "Thank you, your order was successful! Please visit again soon." ...without prompting for the credit card number. Also, I noticed that even when the orders failed CC sends an order email and lists the order in its database... Any help would be much appreciated! Thanks, JAB* Quote Link to comment Share on other sites More sharing options...
Guest Insurrectus Posted February 14, 2006 Share Posted February 14, 2006 Also, I noticed that even when the orders failed CC sends an order email and lists the order in its database.. This has nothing to do with this fix, it is a CubeCart default. Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted February 21, 2006 Share Posted February 21, 2006 Hi, I applied this fix and now my shopping cart jumps straight from the form of payment page to "Thank you, your order was successful! Please visit again soon." ...without prompting for the credit card number. Also, I noticed that even when the orders failed CC sends an order email and lists the order in its database... Any help would be much appreciated! Thanks, JAB* Hi JABevan, Can you set me up with a temp pass on your website so I can ftp in a see what is happening. This is what I did with Insurrectus and it helped solve the last problem. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Guest Posted February 24, 2006 Share Posted February 24, 2006 Hi All Does anybody know if PayPal API works in the UK yet? I tried it before christmas and it was not working. Cheers A Quote Link to comment Share on other sites More sharing options...
Guest JABevan Posted February 24, 2006 Share Posted February 24, 2006 Brian, I switched from PayPal IPN to PayPal Pro, had some issues there, canceled my account and am now switching to Authorize.net. I'm debating whether to support PayPal at all.... JAB* Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted February 25, 2006 Share Posted February 25, 2006 Brian, I switched from PayPal IPN to PayPal Pro, had some issues there, canceled my account and am now switching to Authorize.net. I'm debating whether to support PayPal at all.... JAB* I understand. The paypal pro mod really was more confusing than it needed to be. Cubecart isn't 100% user friendly yet. Brian Hi All Does anybody know if PayPal API works in the UK yet? I tried it before christmas and it was not working. Cheers A I haven't tried it. But from other posts I've seen on here, you aren't the only one having problems. Brian Quote Link to comment Share on other sites More sharing options...
Guest mashurst Posted March 5, 2006 Share Posted March 5, 2006 Also, I noticed that even when the orders failed CC sends an order email and lists the order in its database.. This has nothing to do with this fix, it is a CubeCart default. What is the usual rate of failed orders that make it to the pending stage, but fail to get to the processing stage because something happened during payment? It seems like I get too many of these. -m :alien: Quote Link to comment Share on other sites More sharing options...
Guest shopsarc Posted March 16, 2006 Share Posted March 16, 2006 I had a succesful first sale the other day, then subsequent failures - several. I installed this mod to get a better idea on what was happening and got the error message: Username/Password is incorrect This is with a brand new created customer. Thoughts or theories?!?!? Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted March 17, 2006 Share Posted March 17, 2006 Hi Shopsarc, If that is the error message coming from my mod....then you have to keep in mind that is a paypal error message. So it most likely means that you username and password for your paypal website payments pro account is incorrect. And has nothing to do with customer's username/pass with cubecart. Just a guess tho. Brian Quote Link to comment Share on other sites More sharing options...
Guest Posted March 17, 2006 Share Posted March 17, 2006 Hi Krypton... I applied your mod to my cart (TYVM) and am now having the same issue as JEBevan...jumps right from address info to "order complete." I am fairly new to cube cart so would appreciate any assistance you might provide... TY in advance, V let me know if you can take a closer look Hi, I applied this fix and now my shopping cart jumps straight from the form of payment page to "Thank you, your order was successful! Please visit again soon." ...without prompting for the credit card number. Also, I noticed that even when the orders failed CC sends an order email and lists the order in its database... Any help would be much appreciated! Thanks, JAB* Hi JABevan, Can you set me up with a temp pass on your website so I can ftp in a see what is happening. This is what I did with Insurrectus and it helped solve the last problem. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Guest shopsarc Posted March 17, 2006 Share Posted March 17, 2006 Just as a followup, somehow my Username/Pssword for my API Cert was corrupted. After hours of teeth grinding and hair pulling it was a matter of downloading a new cert and creating a new username and password. I'm still a bit nervous as to why there was a failure on my original after several succesful orders, but all is well. Now if I could just get tax working correctly... Quote Link to comment Share on other sites More sharing options...
Guest krypton1 Posted March 18, 2006 Share Posted March 18, 2006 Glad you got it figured out Shopsarc. Veepir: PM me a temporary username/pass and i will try to take a look at it in the next week some time. JABevan never gave me access to look at it, so I wasn't able to resolve it. Thanks, Brian Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.