its forcing me to upgrade to 2.1.0.1 or whatever the latest version is. my client isnt gonna be happy with that.pacage wrote:I have the same issue and have tried everything on this thread.
It appears to be a very generic error with many possible causes.
A huge bug in OpenCart's error reporting/handling if you ask me.
It looks as though I'm going to have to find another cart solution as OpenCart is just too costly when it comes to fault finding. Which is a pity because I really like OpenCart when it works.
One import issue, which has been neglected:pacage wrote:I have the same issue and have tried everything on this thread.
It appears to be a very generic error with many possible causes.
A huge bug in OpenCart's error reporting/handling if you ask me.
It looks as though I'm going to have to find another cart solution as OpenCart is just too costly when it comes to fault finding. Which is a pity because I really like OpenCart when it works.
What kind of third-party plug-ins you have in use? Do they result in conflicts?
I've read very bad things about the upgrade from 2.0.3.1 to 2.1.0.1.hebiki wrote: its forcing me to upgrade to 2.1.0.1 or whatever the latest version is. my client isnt gonna be happy with that.
From what I've read, the upgrade doesn't work and butchers the database!
That's what has held me back, but I may have no other choice than to try on my test site and see.
I have ruled that out very early on, as I imagine most have. No extensions or mods installed on the test site and same issue still presents. I suspect my host (Arvixe) have changed something their end.pm-netti wrote: One import issue, which has been neglected:
What kind of third-party plug-ins you have in use? Do they result in conflicts?
My test site also developed the same issue at the same time, and absolutely nothing has changed on that from the production site launched!
If only the error message wasn't so generic we might know where to look
This is true offtopic, but always can use upgrade method, some is work:pacage wrote: I've read very bad things about the upgrade from 2.0.3.1 to 2.1.0.1.
From what I've read, the upgrade doesn't work and butchers the database!
That's what has held me back, but I may have no other choice than to try on my test site and see.
http://www.opencart.com/index.php?route ... n_id=24347
The solution quoted below worked for me, BUT the error always reoccurs either in the form of the or
To overcome this, I have found that editing the API user account to toggle between Disabled/Enabled solves the error. A complete waste of time, but works at least.
Code: Select all
json... error
Code: Select all
Warning: You do not have permission to access the API!
rmullaney77 wrote:Worked fine as long as you remember to set Status to Enabled, error persists otherwise (most overlooking that detail).
Tested on 2.0.3.1.Admin > System > Users > API
Admin > System > Settings > Edit > Option (tab) > Checkout (section)
- No users?
- Add
- Enter a username (using "api" is fine)
- Generate
- Status: Enabled
- Save
- All disabled?
- Edit
- Status: Enabled
- Save
Admin > Sales > Order > Edit
- API User: [api user from above]
- Save
Note to Daniel, Q, or whoever: This should done automatically during install/upgrade if required to modify orders.
Hi, I solved this by creating an API user in Settings > User > API and then setting it in Settings > Options > Checkout
All the errors went away after doing this.
All the errors went away after doing this.
This error (Undefined) occured when Server address changed (compaired with the first instalation address)
------------------------------------
Paste these below code replace the old line
------------
100% work - tested with Opencart v2.2.0.0
------------
------------------------------------
Admin/Config.php
------------------------------------
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].str_replace('/admin', '',dirname($_SERVER['PHP_SELF'])));
define('HTTP_SERVER', 'http://'.HTTP.'/admin/');
define('HTTP_CATALOG', 'http://'.HTTP.'/');
define('HTTP_IMAGE', 'http://'.HTTP.'/image/');
// HTTPS
define('HTTPS_SERVER', 'http://'.HTTP.'/admin/');
define('HTTPS_IMAGE', 'http://'.HTTP.'/image/');
// DIR
define('BASE_DIR', str_replace(DIRECTORY_SEPARATOR.'admin', '', realpath(dirname(__FILE__))));
define('DIR_APPLICATION', BASE_DIR.'/admin/');
define('DIR_SYSTEM', BASE_DIR.'/system/');
define('DIR_IMAGE', BASE_DIR.'/image/');
define('DIR_LANGUAGE', BASE_DIR.'/admin/language/');
define('DIR_TEMPLATE', BASE_DIR.'/admin/view/template/');
define('DIR_CONFIG', BASE_DIR.'/system/config/');
define('DIR_CACHE', BASE_DIR.'/system/storage/cache/');
define('DIR_DOWNLOAD', BASE_DIR.'/system/storage/download/');
define('DIR_LOGS', BASE_DIR.'/system/storage/logs/');
define('DIR_MODIFICATION', BASE_DIR.'/system/storage/modification/');
define('DIR_UPLOAD', BASE_DIR.'/system/storage/upload/');
define('DIR_CATALOG', BASE_DIR.'/catalog/');
------------------------------------
Config.php
------------------------------------
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/');
define('HTTP_SERVER', 'http://'.HTTP);
// HTTPS
define('HTTPS_SERVER', 'http://'.HTTP);
// DIR
define('BASE_DIR', realpath(dirname(__FILE__)));
define('DIR_APPLICATION', BASE_DIR.'/catalog/');
define('DIR_SYSTEM', BASE_DIR.'/system/');
define('DIR_LANGUAGE', BASE_DIR.'/catalog/language/');
define('DIR_TEMPLATE', BASE_DIR.'/catalog/view/theme/');
define('DIR_CONFIG', BASE_DIR.'/system/config/');
define('DIR_IMAGE', BASE_DIR.'/image/');
define('DIR_CACHE', BASE_DIR.'/system/storage/cache/');
define('DIR_DOWNLOAD', BASE_DIR.'/system/storage/download/');
define('DIR_LOGS', BASE_DIR.'/system/storage/logs/');
define('DIR_MODIFICATION', BASE_DIR.'/system/storage/modification/');
define('DIR_UPLOAD', BASE_DIR.'/system/storage/upload/');
------------------------------------
Paste these below code replace the old line
------------
100% work - tested with Opencart v2.2.0.0
------------
------------------------------------
Admin/Config.php
------------------------------------
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].str_replace('/admin', '',dirname($_SERVER['PHP_SELF'])));
define('HTTP_SERVER', 'http://'.HTTP.'/admin/');
define('HTTP_CATALOG', 'http://'.HTTP.'/');
define('HTTP_IMAGE', 'http://'.HTTP.'/image/');
// HTTPS
define('HTTPS_SERVER', 'http://'.HTTP.'/admin/');
define('HTTPS_IMAGE', 'http://'.HTTP.'/image/');
// DIR
define('BASE_DIR', str_replace(DIRECTORY_SEPARATOR.'admin', '', realpath(dirname(__FILE__))));
define('DIR_APPLICATION', BASE_DIR.'/admin/');
define('DIR_SYSTEM', BASE_DIR.'/system/');
define('DIR_IMAGE', BASE_DIR.'/image/');
define('DIR_LANGUAGE', BASE_DIR.'/admin/language/');
define('DIR_TEMPLATE', BASE_DIR.'/admin/view/template/');
define('DIR_CONFIG', BASE_DIR.'/system/config/');
define('DIR_CACHE', BASE_DIR.'/system/storage/cache/');
define('DIR_DOWNLOAD', BASE_DIR.'/system/storage/download/');
define('DIR_LOGS', BASE_DIR.'/system/storage/logs/');
define('DIR_MODIFICATION', BASE_DIR.'/system/storage/modification/');
define('DIR_UPLOAD', BASE_DIR.'/system/storage/upload/');
define('DIR_CATALOG', BASE_DIR.'/catalog/');
------------------------------------
Config.php
------------------------------------
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/');
define('HTTP_SERVER', 'http://'.HTTP);
// HTTPS
define('HTTPS_SERVER', 'http://'.HTTP);
// DIR
define('BASE_DIR', realpath(dirname(__FILE__)));
define('DIR_APPLICATION', BASE_DIR.'/catalog/');
define('DIR_SYSTEM', BASE_DIR.'/system/');
define('DIR_LANGUAGE', BASE_DIR.'/catalog/language/');
define('DIR_TEMPLATE', BASE_DIR.'/catalog/view/theme/');
define('DIR_CONFIG', BASE_DIR.'/system/config/');
define('DIR_IMAGE', BASE_DIR.'/image/');
define('DIR_CACHE', BASE_DIR.'/system/storage/cache/');
define('DIR_DOWNLOAD', BASE_DIR.'/system/storage/download/');
define('DIR_LOGS', BASE_DIR.'/system/storage/logs/');
define('DIR_MODIFICATION', BASE_DIR.'/system/storage/modification/');
define('DIR_UPLOAD', BASE_DIR.'/system/storage/upload/');
hello i have similar problem (after modific order.php), but in mi case instead of the "succes" display one alert, but mi information its upgrade normal (only need press F5), the problem its in when press add history (in admin/orders/tap:histoy) the alert display
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON 200
{"error":"succes"}
In other page have the same problem but...the alert display the same message of the textarea change the spaces to %20
try change the api and replace the files before the edition, but the alert persist, this not stop mi work but is irritating
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON 200
{"error":"succes"}
In other page have the same problem but...the alert display the same message of the textarea change the spaces to %20
try change the api and replace the files before the edition, but the alert persist, this not stop mi work but is irritating
I suffered this issue for two days and finally got a working solution!!! (I'll try my best to explain since I don't speak much English)
This solution may only work for my situation. Actually I MIGRATED SERVER days ago and this Undefined variable: json OR Unexpected token < in JSON issue happened since that. This solution doesn't apply to someone who faces this issue on a clean installation.
Overall, it's the config.php files in root and admin. Let's say the Opencart with problem is running under a.com, then you may need a unused b.com to help you get clean config.php files.
If you have a b.com, add b.com to the same web hosting with a.com and install clean Opencart (same version as a.com is using). Then you'll get config.php files. Copy the content and remember to replace b.com to a.com, and the folder name. Do same step for admin/config.php.
If you don't have a b.com, then backup everything you have, clean the web hosting and reinstall Opencart to get the config.php files. Then restore the backup and edit config.php files to the right content.
Hope it explains clearly... (I'm not sure
This solution may only work for my situation. Actually I MIGRATED SERVER days ago and this Undefined variable: json OR Unexpected token < in JSON issue happened since that. This solution doesn't apply to someone who faces this issue on a clean installation.
Overall, it's the config.php files in root and admin. Let's say the Opencart with problem is running under a.com, then you may need a unused b.com to help you get clean config.php files.
If you have a b.com, add b.com to the same web hosting with a.com and install clean Opencart (same version as a.com is using). Then you'll get config.php files. Copy the content and remember to replace b.com to a.com, and the folder name. Do same step for admin/config.php.
If you don't have a b.com, then backup everything you have, clean the web hosting and reinstall Opencart to get the config.php files. Then restore the backup and edit config.php files to the right content.
Hope it explains clearly... (I'm not sure
Sorry to bump an old thread, but i found a solution thanx to my host provider and thought id share.
For hosts that do not allow HTTP loopback requests, you need to switch to a server that does. however for a host provider who does allow HTTP loopback requests, please delete your php.ini file in both root and admin, then once you set the api user in settings/option. editing orders will work again.
For hosts that do not allow HTTP loopback requests, you need to switch to a server that does. however for a host provider who does allow HTTP loopback requests, please delete your php.ini file in both root and admin, then once you set the api user in settings/option. editing orders will work again.
Hi all I found a solution to orders not showing on this forum by manually setting the api_id in the mysql database to 1. Opencart seems to increment the api_id everytime you add a new API user but the user needs to be top dog. I just used the standard json name for the API, so not sure if it would work for any other API names/passwords.
Peace out
Peace out
Really I think the auto-increment is down to mysql preferring unique keys but there is no reason not to recycle and reuse.
Actually I just noticed that although my orders were showing now, I cannot update the status as I get the JSON.parse error now. The API user in settings was set to --none--. As soon as I assign an API user, the order details stop showing altogether! Back in the same boat now!
hi there, i am facing so many problems with opencarts.
On clean installs i have issues.
Every time using checkout and register forms it throws errors, i noticed it throws errors when the blank forms are not writed, even if they are not marked with *
At fax,address 2, comments, etc.
I tested on all themes, and default clean installations, i got rid of some more errors because email smtp was not properly configured. I passed all errors from api, etc.
I am starting to think there is imposible how to make a working website for shopping niche, at least with opencart.
Should i look into another platform? i like this community, but the developers kinda leave too many errors behind every update.
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined index: comment in <b>/home/pcmodro/public_html/catalog/controller/checkout/shipping_method.php</b> on line <b>127</b>[SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined index: comment in <b>/home/pcmodro/public_html/catalog/controller/checkout/shipping_method.php</b> on line <b>127</b>[
P.S
One more notice, it happen only when registration is made from checkout basket formular, if a user use separate account registration from login --> register is working smooth w/o json errors, it happen only if they process checkout registration form.
On clean installs i have issues.
Every time using checkout and register forms it throws errors, i noticed it throws errors when the blank forms are not writed, even if they are not marked with *
At fax,address 2, comments, etc.
I tested on all themes, and default clean installations, i got rid of some more errors because email smtp was not properly configured. I passed all errors from api, etc.
I am starting to think there is imposible how to make a working website for shopping niche, at least with opencart.
Should i look into another platform? i like this community, but the developers kinda leave too many errors behind every update.
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined index: comment in <b>/home/pcmodro/public_html/catalog/controller/checkout/shipping_method.php</b> on line <b>127</b>[SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined index: comment in <b>/home/pcmodro/public_html/catalog/controller/checkout/shipping_method.php</b> on line <b>127</b>[
P.S
One more notice, it happen only when registration is made from checkout basket formular, if a user use separate account registration from login --> register is working smooth w/o json errors, it happen only if they process checkout registration form.
Hi @estroblock
I exactly have the same problem like yours:
================================quote=================================
I seem to have a similar issue using 2.0.3.1.
For me, I suspect this to be SSL/ server related issue. I tried a clean install without my ssl cert installed and was working fine.
I then installed my ssl cert to the domain, and changed the config files to allow ssl.
In doing so it has caused an error in order section:
" SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined variable: json in <b>/home/alt/public_html/admin/controller/sale/order.php</b> on line <b>2221</b> "
I then tried the suggested change
CODE: SELECT ALL
public function api() {
change to:
CODE: SELECT ALL
public function api() {
$json = array();
Now I get error:
" SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
{"country_id":"13","name":"Australia","iso_code_2":"AU","iso_code_3":"AUS","address_format":"","postcode_required":"0","zone":[{"zone_id":"191","country_id":"13","name":"Australian Capital Territory","code":"ACT","status":"1"},{"zone_id":"192","country_id":"13","name":"New South Wales","code":"NSW","status":"1"},{"zone_id":"193","country_id":"13","name":"Northern Territory","code":"NT","status":"1"},{"zone_id":"194","country_id":"13","name":"Queensland","code":"QLD","status":"1"},{"zone_id":"195","country_id":"13","name":"South Australia","code":"SA","status":"1"},{"zone_id":"196","country_id":"13","name":"Tasmania","code":"TAS","status":"1"},{"zone_id":"197","country_id":"13","name":"Victoria","code":"VIC","status":"1"},{"zone_id":"198","country_id":"13","name":"Western Australia","code":"WA","status":"1"}],"status":"1"} "
I have tried all the other suggested fix's I could find (including curl with another domain) and same issue.
I then tried to also remove my ssl cert and re-edit my config files for non ssl and it did not revert back to a functioning state. I was getting the same error as when the ssl was installed. So if I now want to have it functioning without ssl, it seems I require to do a fresh install.
So at this stage I have 2 options. Reinstall opencart and do not install ssl, or use it in its current state and not have the function to edit and delete orders, and do so manually through the database.
I hope a fix for this comes soon with the next version. Seems like the biggest issue with OC 2. atm.
================================quote=================================
But I have solved it.
I SOLVED THE PROBLEM of "<b>Notice</b>: Undefined variable: json in <b>/home/alt/public_html/admin/controller/sale/order.php</b> on line <b>2221</b> ""
Step 1: find file public_html/admin/controller/sale/order.php and open it;
Step 2: Find codes as below:
if ($api_info) {
$curl = curl_init();
// Set SSL if required
if (substr(HTTPS_CATALOG, 0, 5) == 'https') {
curl_setopt($curl, CURLOPT_PORT, 443);
}
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
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_CATALOG . 'index.php?route=api/login');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($api_info));
$json = curl_exec($curl);
Step 3: Change "https" to "http"
Step 4: Change "443" to "80"
Save and upload to website. PROBLEM SOLVED.
DONE.
I exactly have the same problem like yours:
================================quote=================================
I seem to have a similar issue using 2.0.3.1.
For me, I suspect this to be SSL/ server related issue. I tried a clean install without my ssl cert installed and was working fine.
I then installed my ssl cert to the domain, and changed the config files to allow ssl.
In doing so it has caused an error in order section:
" SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined variable: json in <b>/home/alt/public_html/admin/controller/sale/order.php</b> on line <b>2221</b> "
I then tried the suggested change
CODE: SELECT ALL
public function api() {
change to:
CODE: SELECT ALL
public function api() {
$json = array();
Now I get error:
" SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
{"country_id":"13","name":"Australia","iso_code_2":"AU","iso_code_3":"AUS","address_format":"","postcode_required":"0","zone":[{"zone_id":"191","country_id":"13","name":"Australian Capital Territory","code":"ACT","status":"1"},{"zone_id":"192","country_id":"13","name":"New South Wales","code":"NSW","status":"1"},{"zone_id":"193","country_id":"13","name":"Northern Territory","code":"NT","status":"1"},{"zone_id":"194","country_id":"13","name":"Queensland","code":"QLD","status":"1"},{"zone_id":"195","country_id":"13","name":"South Australia","code":"SA","status":"1"},{"zone_id":"196","country_id":"13","name":"Tasmania","code":"TAS","status":"1"},{"zone_id":"197","country_id":"13","name":"Victoria","code":"VIC","status":"1"},{"zone_id":"198","country_id":"13","name":"Western Australia","code":"WA","status":"1"}],"status":"1"} "
I have tried all the other suggested fix's I could find (including curl with another domain) and same issue.
I then tried to also remove my ssl cert and re-edit my config files for non ssl and it did not revert back to a functioning state. I was getting the same error as when the ssl was installed. So if I now want to have it functioning without ssl, it seems I require to do a fresh install.
So at this stage I have 2 options. Reinstall opencart and do not install ssl, or use it in its current state and not have the function to edit and delete orders, and do so manually through the database.
I hope a fix for this comes soon with the next version. Seems like the biggest issue with OC 2. atm.
================================quote=================================
But I have solved it.
I SOLVED THE PROBLEM of "<b>Notice</b>: Undefined variable: json in <b>/home/alt/public_html/admin/controller/sale/order.php</b> on line <b>2221</b> ""
Step 1: find file public_html/admin/controller/sale/order.php and open it;
Step 2: Find codes as below:
if ($api_info) {
$curl = curl_init();
// Set SSL if required
if (substr(HTTPS_CATALOG, 0, 5) == 'https') {
curl_setopt($curl, CURLOPT_PORT, 443);
}
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
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_CATALOG . 'index.php?route=api/login');
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($api_info));
$json = curl_exec($curl);
Step 3: Change "https" to "http"
Step 4: Change "443" to "80"
Save and upload to website. PROBLEM SOLVED.
DONE.
Hi,npn2531 wrote:Can you be specific? What is 'Auth stuff'. I am getting the same error msg:I removed the Auth stuff from my .htaccess and now my order operations in admin all work properly.
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
do this
find the code:
define('HTTPS_CATALOG', 'https://yoursite.com/');
change to:
define('HTTPS_CATALOG', 'http://yoursite.com/');
I had the same problem
It looks like this behavior was being caused by browsers defaulting to the AAAA record for the domain, instead of the A record, and the the account having no IPv6 address assigned to it within WHM/cPanel.
Or delete the AAAA in your DNS settings.
cPanel was very helpful with this problem.
It looks like this behavior was being caused by browsers defaulting to the AAAA record for the domain, instead of the A record, and the the account having no IPv6 address assigned to it within WHM/cPanel.
Or delete the AAAA in your DNS settings.
cPanel was very helpful with this problem.
Who is online
Users browsing this forum: No registered users and 39 guests