Bug in TheSecureGateway module
I migrated to a new payment gateway, The Secure Gateway and when I implemented it on 1.3.9, I got a zones table error. So I went ahead and upgraded my site to 1.5.0. here is the error I now get at checkout:
PHP Fatal error: 1146:Table 'DB******.zones' doesn't exist :: select zone_code from zones where zone_name like '%Colorado%' in /home/content/34/7174734/html/zencart_new/includes/classes/db/mysql/query_factory.php on line 101.
Not sure how to get past this. The site seems to hang at the Checkout process.
Any help or suggestions would be appreciated. I am late getting the site up for our summer activities.
Thanks,
Jeff
Re: Help! Error on checkout points to Zones table.
You replaced part of the DB info with ******. But that's critical information needed to help you.
Can you reply with the details of the part you replaced with ******* ?
Also, what is the value of DB_DATABASE and DB_PREFIX in your /includes/configure.php file? They are not sensitive information, so are safe to post. (We don't need the DB_USERNAME or DB_PASSWORD, which *are* sensitive info.)
Re: Help! Error on checkout points to Zones table.
Hi Dr. Byte, Sorry for the lack of information.
DB = bfc1211403234954
DB_DATABASE = bfc1211403234954
DB_PREFIX = 'DB_PREFIX', 'zen_'
I suspect i know what the problem might be now. Please confirm what the PREFIX should be? is that the only issue, do you think?
Thanks for the help,
Jeff
Re: Help! Error on checkout points to Zones table.
All Zen Cart core code uses tablenames like TABLE_ZONES and TABLE_ORDERS_STATUS_HISTORY which are constants defined as a combination of DB_PREFIX and the actual name of the table used without a prefix. This allows stores to have a table-prefix (defined by DB_PREFIX) to help differentiate between multiple ZC stores sharing a single database.
Some modules/plugins are poorly written and just hard-code the actual tablename without regard to prefix, and thus trigger the kind of error message you're reporting when running on stores such as yours which have been installed using a non-blank DB_PREFIX like yours.
So, whatever non-original-core-code you've added to your site is likely the culprit, and needs updating to use the correct tablename constant. They're all listed in /includes/database_tables.php as far as core code tables go.
Re: Help! Error on checkout points to Zones table.
Thanks for that info. I didn't see anything in includes / database_tables.php that looked out of the ordinary.
The only change that was really made was the switch the new payment gateway, The Secure Gateway. Previously, I was using Authorizenet. is it possible that there is a hard coded "authorizenet" pointer where "the Secure Gateway" should go. I had no problems up until the switch. The folks at Newtek can't seem to identify their gateway as the source fo the problem.
Maybe someone is familiar with that gateway.....
Thanks,
Re: Help! Error on checkout points to Zones table.
Attach a zip file containing the files for that module, and we can look at it. Or post a URL where it can be downloaded.
Re: Help! Error on checkout points to Zones table.
Re: Help! Error on checkout points to Zones table.
Yes, as I suspected. This part of the code is not written to support tablename prefixes:
Code:
function get_state_abbr($state_desc) {
global $db;
$states = $db->Execute("select zone_code from zones where zone_name like '%" . $state_desc . "%'");
while (!$states->EOF) {
return $states->fields['zone_code'];
}
return $state_desc;
}
It would need to be changed to:
Code:
function get_state_abbr($state_desc) {
global $db;
$states = $db->Execute("select zone_code from " . TABLE_ZONES . " where zone_name like '%" . $state_desc . "%'");
while (!$states->EOF) {
return $states->fields['zone_code'];
}
return $state_desc;
}
You should also work directly with their technical support team to make correct adjustments to the following lines. If you don't, then your payment transactions are not being handled securely, and you run the risk of credit card theft:
Code:
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
Re: Help! Error on checkout points to Zones table.
Thanks so much for that information. I will forward that on to them. Interestingly, even with my very limited knowledge, I pointed out to them that this area might be part of the issue since the error line was in there. Their initial response was to have me comment it out. Which, of course, did not work either.
So, I will get this back to them to make the correction in their includes.
Thanks again!!!!!!
Jeff