|
在opencart2.0 版本的订单管理第4步经常出现如下错误
opencart 2.0 SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data OK
问题排查
1. 可能系统没有安装curl扩展
这样的问题遇到比较少,因为opencart安装系统最初会判断这个条件,如果是后台直接做网站迁移或者搬家情况可能会遇到。可以用一下代码进行检测CURL扩展环境:
- <?PHP
- echo "a<br/>";
- $curl = curl_init();
- //https://YOURDOMAIN.com testing"
- $aa='Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36 OPR/28.0.1750.48';
- curl_setopt($curl, CURLOPT_HEADER, false);
- curl_setopt($curl, CURLINFO_HEADER_OUT, true);
- curl_setopt($curl, CURLOPT_USERAGENT, $aa);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_URL, 'https://YOURDOMAIN.com/index.php?route=api/login');
- curl_setopt($curl, CURLOPT_POST, true);
- $json = curl_exec($curl);
- echo "server link to https://YOURDOMAIN.com/index.php?route=api/login <br/>";
- echo "Error Message:<br/>";
- print_r(curl_error($curl));
- echo "<br/>";
- echo "Response:";
- echo "<br/>";
- print_r($json);
- echo "<br/>";
- echo "<br/>";
- echo "<br/>";
- echo "<br/>";
- curl_close($curl);
- $curl = curl_init();
- //https://google.com"
- $aa='Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36 OPR/28.0.1750.48';
- curl_setopt($curl, CURLOPT_HEADER, false);
- curl_setopt($curl, CURLINFO_HEADER_OUT, true);
- curl_setopt($curl, CURLOPT_USERAGENT, $aa);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_URL, 'https://google.com');
- curl_setopt($curl, CURLOPT_POST, true);
- $json = curl_exec($curl);
- echo "server lint to https://google.com <br/>";
- echo "Error Message:<br/>";
- print_r(curl_error($curl));
- echo "<br/>";
- echo "Response:";
- echo "<br/>";
- print_r($json);
- curl_close($curl);
- ?>
复制代码
你浏览器应用出现一下提示
a server link to https://YOURDOMAIN.com/index.php?route=api/login Error Message:
Response: {"error":"\u8b66\u544a\uff1a\u4e0d\u5339\u914d\u7684\u7528\u6236\u540d\u6216\u5bc6\u78bc\u3002"}
如果没有看到说明你的CURL没有安装好,请联系主机商处理。
2. api数据问题
处理办法如下
1) 检查表 oc_api (注意表前缀). 这里会有一条记录
如果没有,请执行一下操作
INSERT INTO oc_api (api_id, username, firstname, lastname, password, status, date_added, date_modified) VALUES (1, '2uVCDrqPBaq52KKCModEFFc7ILdMbKWulvbEsLkJVJHbm334HGQC5BDxoWlnXUwi', '', '', 'so49tj04Cv6yteAoZaZ3IzAfhYG7qWkOLavvIyejHPHEO7eQEn7mtgUFxT9JXQvwCD9b46gFjlrMGSWvHs1NrECiaHPOaCTNRjk8E64eY0nNVflHgpJrCgH3bw1K1rOf28iXkyquk76F8lNWUexCuzjGzU29pOhq1O3peiy4K6n07jMeeL0QzAZLkuPq0nMuNXmzvLV5GxreUZidCvPXSEmItDAPZ4Pp6Ys2aqOzbgJ9EISV6NCVIAM8ONIrVEqd', 1, '2015-01-27 16:38:49', '2015-01-27 16:38:49');
2) 给oc_setting 表中的 config_api_id 设置值,或者运行如下SQL
UPDATE oc_setting SET value = '1' WHERE oc_setting.setting_id = 437;
3 有可能是某些支付模块本身存在问题
opencart默认的支付模板都没有问题,如果存在新增的或者是第3方开发的,请联系作者处理
|
|