Jump to content
DavidK

2checkout gateway not working anymore

Recommended Posts

Hi,2checkout gateway plugin I think should be updated,after recent upgrades provided by 2checkout gateway is causing error  and customer is not forwarding to payment page.Could anybody look on it and try to fix this plugin that it works ???

Share this post


Link to post
Share on other sites

I have looked over their documentation, but cannot determine if the docs have changed since the CubeCart module was written.

So, let's try this:

In the module's gateway.class.php file, find:

'action'	=> ($this->_module['checkoutMode']=='single') ? 'https://www.2checkout.com/checkout/spurchase' : 'https://www2.2checkout.com/2co/buyer/purchase',

Change to:

'action'	=> 'https://www.2checkout.com/checkout/purchase',

 

Share this post


Link to post
Share on other sites

Hello,I have my account active,I have discussed with their support,they say,that conflict is due to sending parameter token and it should be excluded....


------------
Hello David,

From our early investigations regarding this issue it seems that the parameter "token" which you pass-by conflict with some other parameters.

Can you please re-check your integration and stop sending the token parameter to see if the issue still persists?

Hope to hear from you soon.

Thank you,

Mihai D.
Merchant Support Specialist
https://www.2checkout.com

Share this post


Link to post
Share on other sites

I have tried the following with a test gateway, but otherwise have no means to make sure this works for 2Checkout (or any other payment gateway).

The task is to suppress the inclusion of the 'token' key when sending a bunch of POST stuff to 2CO.

This key gets added to any <form> block when the current store configuration element 'csrf' is true. This config setting gets set if the skin has a <csrf>true</csrf> line in its config.xml file.

So, maybe if the skin does not have this node, all will work. But then, maybe other problems will arise.

Instead, we will have the 2CO module temporarily switch off this config setting.

In the 2CO module's folder, gateway.class.php file, find:

return $transfer;

Change to:

$GLOBALS['config']->merge('config', 'csrf', '0'); return $transfer;

It seems that the 2CO tech offered no advice on whether the 2CO module was attempting to connect using the correct URL. So, you can try it with the original 'action' statement, or stay with what 2Checkout's docs now say to use (see previous post).

Hope this works.

Share this post


Link to post
Share on other sites

Hi Brian,thank you for your fix,just want to confirm,that it works now with original url in action statement and adding code as adviced in your second post.Thank you a lot for your help,you already help me few times in past,I really appreciate it very much.

I would have one more problem to fix,I have some issues with login,I was doing some test orders and found,that when I try to login to front store as buyer with some test accounts,instead of being logged,it returns blank page with just "1" as page source,so probably some issue with ip blocker.I am not sure,if this happens also to buyers,some buyers use express paypal checkout without having to login or register,some register accounts,but strange is,that I tried my test with 3 different test accounts and with any I am not able to login.From admin I can log using Login as... but not from store front.Would you be willing to look in to my problem ? This problem started after my upgrade from v5 to my current 6.1.15 and since upgrade our sales went down,so I am afraid more potential buyers may have same issue.Thank you advance for your advice or help.David 

 

Share this post


Link to post
Share on other sites

The '1' is actually the default output of a PHP function used the wrong way. Finding out where it is happening will require extensive troubleshooting.

However, since there are no known reports of this for CC6, we need to ask if you have any third-party plugins installed, or have made any edits to the code.

Share this post


Link to post
Share on other sites

Hello,I use 6.1.15,it was upgraded from modified v5 with fairly many mods.Upgrade was made by semperfiwebservices and I installed also couple of their plugins and store has also some code change.I am confused about login issues,because as far I can not see in admin access  logs some numerous failed login attempts by customers.There is also some continuous errors caused by catalogue.class.php file.What would you recommend to do ?

Share this post


Link to post
Share on other sites

Hi,this is some of latest error logs,last line (from 17:17:39) is when I made test login to store front.

[18-Sep-2018 18:43:14 Europe/Prague] PHP Warning:  Invalid argument supplied for foreach() in /home2/minerals/public_html/store/classes/catalogue.class.php on line 258
[18-Sep-2018 16:43:17 UTC] PHP Warning:  Security Warning: Illegal array key "#39;A" was detected and was removed. in /home2/minerals/public_html/store/classes/sanitize.class.php on line 111
[18-Sep-2018 18:43:18 Europe/Prague] PHP Warning:  Invalid argument supplied for foreach() in /home2/minerals/public_html/store/classes/catalogue.class.php on line 258
[18-Sep-2018 16:43:21 UTC] PHP Warning:  Security Warning: Illegal array key "#39;A" was detected and was removed. in /home2/minerals/public_html/store/classes/sanitize.class.php on line 111
[18-Sep-2018 18:43:21 Europe/Prague] PHP Warning:  Invalid argument supplied for foreach() in /home2/minerals/public_html/store/classes/catalogue.class.php on line 258
[18-Sep-2018 16:43:30 UTC] PHP Warning:  Security Warning: Illegal array key "#39;A" was detected and was removed. in /home2/minerals/public_html/store/classes/sanitize.class.php on line 111
[18-Sep-2018 18:43:30 Europe/Prague] PHP Warning:  Invalid argument supplied for foreach() in /home2/minerals/public_html/store/classes/catalogue.class.php on line 258
[18-Sep-2018 18:43:34 Europe/Prague] PHP Warning:  Invalid argument supplied for foreach() in /home2/minerals/public_html/store/classes/catalogue.class.php on line 258
[18-Sep-2018 17:17:39 UTC] PHP Fatal error:  Call to a member function setError() on null in /home2/minerals/public_html/store/classes/user.class.php on line 244

And this is part of latest error logs from store admin (system error logs):

Today, 18:43File: [catalogue.class.php] Line: [1819] "SELECT I.*, MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE) AS Relevance FROM CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM CubeCart_pricing_group WHERE group_id = 0 GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `CubeCart_category_index` as CI INNER JOIN CubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND (MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE)) >= 0.5 ORDER BY `IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))` DESC LIMIT 100 " - Unknown column 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))' in 'order clause'

Today, 18:43File: [catalogue.class.php] Line: [1821] "SELECT COUNT(I.product_id) as count, MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE) AS Relevance FROM CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM CubeCart_pricing_group WHERE group_id = 0 GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `CubeCart_category_index` as CI INNER JOIN CubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND (MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE)) >= 0.5 GROUP BY I.product_id ORDER BY `IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))` DESC " - Unknown column 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))' in 'order clause'

Today, 18:43File: [catalogue.class.php] Line: [1819] "SELECT I.*, MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE) AS Relevance FROM CubeCart_inventory AS I LEFT JOIN (SELECT product_id, MAX(price) as price, MAX(sale_price) as sale_price FROM CubeCart_pricing_group WHERE group_id = 0 GROUP BY product_id) as G ON G.product_id = I.product_id WHERE I.product_id IN (SELECT product_id FROM `CubeCart_category_index` as CI INNER JOIN CubeCart_category as C where CI.cat_id = C.cat_id AND C.status = 1) AND I.status = 1 AND (MATCH (I.product_code,I.name,I.description) AGAINST('tourmaline' IN BOOLEAN MODE)) >= 0.5 ORDER BY `IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))` DESC LIMIT 100 " - Unknown column 'IF (G.product_id IS NULL, IF (I.sale_price IS NULL OR I.sale_price = 0, I.price, I.sale_price), IF (G.sale_price IS NULL OR G.sale_price = 0, G.price, G.sale_price))' in 'order clause'

 

Share this post


Link to post
Share on other sites

There should be solutions available for most of the issues shown, but they are minor problems.

However, the PHP Fatal error needs to be addressed. For some reason, the GUI class is getting destroyed, or never instantiated, prior to checking if there is a customer with the given email and password -- which, to get the error message "Login failed", there would not be a database record found.

Do any of the plugins and code changes have anything to do with pre-determining if a customer exists or should be allowed to view the store?

Share this post


Link to post
Share on other sites

I believed there is no plugin or code change that could cause this problem,but after checking all active plugins,I realized there is zendesk plugin that I installed some time ago.This plugin is enhanced that allow to see,if buyer is registered customer and show cart content...so I realized this could be the problem.I deactivated it and I can now log in with test accounts.You are really great helper,I would never think this way...This is official plugin from cubecart marketplace.Many many thanks !

Regarding those other errors,especialy with catalog class,do you think this could be also fixed some way ? Once again thanks for your time and help.David

Share this post


Link to post
Share on other sites

The above errors logged in the System Error Log is fixed in a later version of CubeCart. To fix it yourself:

In /classes/catalogue.class.php, near line 1758 (line numbers are for CC6115), find:

if (is_array($order)) {
	$order_string = 'ORDER BY `'.$order['field'].'` '.$order['sort'];
}

Change to:

if (is_array($order)) {
	$field_format = preg_match('/\s/', $order['field']) ? $order['field'] : '`'.$order['field'].'`';
	$order_string = 'ORDER BY '.$field_format.' '.$order['sort'];
}

The errors Illegal array key "#39;A" suggests that a querystring has a bad encoding. The URL may look something like (as an example, but not specifically your situation):

index.php?firstname=Frank&lastname=DETR'A
index.php?firstname=Frank&lastname=DETR&#39;A

Note: the ampersand (&) is used to separate key/value pairs. 'firstname' goes with "Frank" and 'lastname' is supposed to go with "DETR'A".

But because the apostrophe is encoded as &#39;, the ampersand is misunderstood to start a new key (#39;A).

CubeCart does not like querystring keys that have characters other than a-z, 0-9, underscore, and dash.

CubeCart also does not like such keys in the POST payload, nor in any cookies.

So, it may prove worthwhile to view your site's hosting web access log to see if you can find the URL that may have a badly formed querystring. It could help determine what would need to be fixed.

Share this post


Link to post
Share on other sites

Thank you for all help and advices,I will try to check and fix other things as you recommend.David

Share this post


Link to post
Share on other sites
On 9/18/2018 at 8:17 PM, DavidK said:

[18-Sep-2018 17:17:39 UTC] PHP Fatal error:  Call to a member function setError() on null in /home2/minerals/public_html/store/classes/user.class.php on line 244
 

What skin are you using ?

On 9/18/2018 at 9:01 PM, bsmither said:

However, the PHP Fatal error needs to be addressed. For some reason, the GUI class is getting destroyed, or never instantiated, prior to checking if there is a customer with the given email and password -- which, to get the error message "Login failed", there would not be a database record found.

Did you ever look into this ?  I have seen this on a couple of sites and happens when a user tries to login and enters an invalid email address or password - the normal error notification isnt being shown due to this error

Share this post


Link to post
Share on other sites

An earlier post, "This plugin is enhanced that allow to see if buyer is registered customer".

Share this post


Link to post
Share on other sites
1 hour ago, bsmither said:

An earlier post, "This plugin is enhanced that allow to see if buyer is registered customer".

Yep but the sites I have seen this on don’t have any plugins like that and therefore don’t believe it has anything to do with that !

Share this post


Link to post
Share on other sites

OK the problem (at least on the three sites I have checked) is the CubeCart created Zendesk Chat plugin and it has been logged here : https://github.com/cubecart/v6/issues/2188 until a fix is created, users of Zendesk can install and use our older https://www.cubecart.com/extensions/live-help/zopim-livechat-for-cubecart   This is also free to use but doesnt add the basket items to the basket items to the visitor notes nor does it update the customers name, email address and phone number.  However, at least it doesnt cause a fatal error !  Sure that @Al Brookbanks will fix the issue ASAP

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

×