Post by hebiki » Sat Nov 28, 2015 5:31 am

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. :(
its forcing me to upgrade to 2.1.0.1 or whatever the latest version is. my client isnt gonna be happy with that.

New member

Posts

Joined
Sun Oct 10, 2010 4:00 pm

Post by pm-netti » Sat Nov 28, 2015 7:20 pm

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:
What kind of third-party plug-ins you have in use? Do they result in conflicts?

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by pacage » Sat Nov 28, 2015 11:45 pm

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.
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.
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?
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.
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 :(

Newbie

Posts

Joined
Thu Jul 02, 2015 3:52 am

Post by pm-netti » Sun Nov 29, 2015 3:01 am

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.
This is true offtopic, but always can use upgrade method, some is work:
http://www.opencart.com/index.php?route ... n_id=24347

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by hebiki » Sun Nov 29, 2015 4:06 pm

im not doing a traditional upgrade. im building a fresh 2.1.0.1 site.. then importing the database (only importing in customer and order history/data).

the rest will be a fresh install.

New member

Posts

Joined
Sun Oct 10, 2010 4:00 pm

Post by ASP » Tue Dec 01, 2015 10:40 pm

The solution quoted below worked for me, BUT the error always reoccurs either in the form of the

Code: Select all

json... error
or

Code: Select all

Warning: You do not have permission to access the API!
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.
rmullaney77 wrote:Worked fine as long as you remember to set Status to Enabled, error persists otherwise (most overlooking that detail).
Admin > System > Users > API
  • No users?
    • Add
    • Enter a username (using "api" is fine)
    • Generate
    • Status: Enabled
    • Save
  • All disabled?
    • Edit
    • Status: Enabled
    • Save
Admin > System > Settings > Edit > Option (tab) > Checkout (section)
  • API User: [api user from above]
  • Save
Admin > Sales > Order > Edit
Tested on 2.0.3.1.

Note to Daniel, Q, or whoever: This should done automatically during install/upgrade if required to modify orders.

ASP
New member

Posts

Joined
Fri Sep 11, 2015 11:35 pm

Post by ralphstirrat » Wed Mar 09, 2016 5:02 pm

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.

http://colbrook.co.uk


Active Member

Posts

Joined
Wed Aug 29, 2012 7:53 pm

Post by xkhoax » Thu Apr 21, 2016 1:05 pm

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/');

Newbie

Posts

Joined
Thu Apr 21, 2016 12:59 pm

Post by vtxhero » Thu May 12, 2016 12:48 am

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

Newbie

Posts

Joined
Wed May 11, 2016 12:19 am

Post by chenxian352 » Thu Jun 09, 2016 4:51 pm

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 :)

New member

Posts

Joined
Sat Oct 18, 2014 11:19 am

Post by SXGuy » Mon Jul 11, 2016 3:33 am

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.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by davidcropley » Sun Aug 28, 2016 9:04 pm

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 O0

New member

Posts

Joined
Thu Jul 12, 2012 2:18 am

Post by davidcropley » Sun Aug 28, 2016 9:11 pm

Really I think the auto-increment is down to mysql preferring unique keys but there is no reason not to recycle and reuse. ::)

New member

Posts

Joined
Thu Jul 12, 2012 2:18 am

Post by davidcropley » Sun Aug 28, 2016 11:15 pm

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! :(

New member

Posts

Joined
Thu Jul 12, 2012 2:18 am

Post by xtzfla » Tue Sep 13, 2016 8:28 pm

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.

Newbie

Posts

Joined
Sat Sep 10, 2016 4:24 pm

Post by xiaxionghui » Tue Nov 15, 2016 1:39 pm

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.

Newbie

Posts

Joined
Tue Nov 15, 2016 1:31 pm

Post by kec » Tue Nov 29, 2016 12:39 am

I'm sorry.... but NOT solved.

Spent HOURS searching and HOURS of using EVERY so called 'solution'. But NO.... there is NO solution.
The only thing left to do is upgrade the shop in order to pray it's over and hope no things are lost.

kec
New member

Posts

Joined
Sat Apr 20, 2013 6:06 pm

Post by mandarkhamkar » Wed Feb 01, 2017 3:37 pm

npn2531 wrote:
I removed the Auth stuff from my .htaccess and now my order operations in admin all work properly.
Can you be specific? What is 'Auth stuff'. I am getting the same error msg:

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Hi,

do this

find the code:
define('HTTPS_CATALOG', 'https://yoursite.com/');
change to:
define('HTTPS_CATALOG', 'http://yoursite.com/');

Newbie

Posts

Joined
Mon Nov 21, 2016 8:44 pm

Post by k2tec » Sat Feb 04, 2017 2:07 am

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.

User avatar
Active Member

Posts

Joined
Mon Apr 12, 2010 8:06 pm

Post by tkao23 » Mon Apr 17, 2017 5:36 pm

This error happen it because your `order` table, store_url column URL is not same with your live server URL, if you wish to keep your order record, please make sure you update the store_url to your server address.

Newbie

Posts

Joined
Thu Jan 15, 2015 10:20 am
Who is online

Users browsing this forum: No registered users and 39 guests