I looked all over the internet and found no answer.
Basically my problem is whenever I try to edit orders and change stores I get the SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data OK in firefox and in chrome I get SyntaxError: Unexpected end of input OK.
Has anyone found a "real" solution for this because I tried all that was suggested but they don't work. From changing the api_id to making a secondary API. And even the .htaccess method.
I got the same error and found away to fix it:
You'll be able to edit the order status now!
I happened to have the same update order issue.
If you tried every possible solution found on the Internet, but no one worked, maybe the bug is from your server provider.
In my case, the problem comes from $curl function, which used frequently on opencart 2.0.
You may paste this php file in your admin/controller/sale/ and then type your url :http://YOURDOMAIN.com/admin/controller/sale/test.php
<?PHP
echo "a<br/>";
$curl = curl_init();
//http://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, 'http://YOURDOMAIN.com/index.php?route=api/login');
curl_setopt($curl, CURLOPT_POST, true);
$json = curl_exec($curl);
echo "server link to http://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();
//http://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, 'http://google.com');
curl_setopt($curl, CURLOPT_POST, true);
$json = curl_exec($curl);
echo "server lint to http://google.com <br/>";
echo "Error Message:<br/>";
print_r(curl_error($curl));
echo "<br/>";
echo "Response:";
echo "<br/>";
print_r($json);
curl_close($curl);
?>
If your browser message doesn't show this
a server link to http://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"}
Then you may ask your server provider to help you setting the server, because this means your $curl could not link to your localhost and could not retrieve data from your localhost.
Hope this will help you !!
I was able to solve this problem in 3 steps. In my case, i did upgrade my opencart database from 1.5x to 2.x with the standard (out of the box Opencart upgrade). I also had a multistore configuration. I was able to Edit orders once I run the following steps:
Install OC2 (out of the box, no configuration) with the same admin credential as the one used in your legacy database. Export your database and find the place in the dump file (sql) where you have INSERT INTO api
values (... line. This is the first command you need to run in you legacy database.
UPDATE setting set value=1 where key
= 'config_api_id';
UPDATE store set ssl
=url; However, this may not work if you are working on localhost. So for testing, I had to change it to UPDATE store set ssl
= 'http://localhost/'; Do not forget the last backslash.
Please notice that you can also perform those operation on the admin user interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With