Post by ryanhammill10 » Thu May 07, 2015 5:27 am

Hello all,

Not sure if anyone can help however I have found ANOTHER bug/issue in opencart 2. When changing the status of orders I am getting the below message:

SyntaxError: Unexpected Token <


Notice:Undefined variable: json in /vhost/...../www/admin/controller/sale/order.php on line 2490

I have tried re-creating a new API user as found in other posts about this without any luck, still gets the same error. I have also tried amended the order.php file to add the extra line for json but this makes no difference so reverted to original order.php file for now.

Any help would be great as currently cannot edit orders and the upgrade to opencart 2 for production is very near and testing has already found a lot of bugs.



Sun May 03, 2015 10:15 pm

Post by Daydream85 » Thu May 21, 2015 9:46 pm

I have exactly the same error. And so far nobody knows the answer to this problem.

Did you already find out how to solve this?

New member


Sun Oct 13, 2013 4:29 pm

Post by OpenTeam » Thu May 21, 2015 10:12 pm


Normally you are getting a response from the controller 'api/order' in the catalog folder. In fact, the public function history() is executed when you change an order status.

So to get close to the problem, do check the function addOrderHistory in the model file 'model/checkout/order.php' in the folder 'catalog'.

Hope it will help you.

User avatar
Active Member


Tue May 19, 2015 2:31 am

Post by Ergotron_Mexico » Fri May 29, 2015 11:45 pm

Any have the modification ? or a copy of order.php ?


ergotron mexico

New member


Wed Nov 06, 2013 12:40 am
Location - Mexico

Post by nchotorova » Fri Jun 05, 2015 4:13 pm

Opnecart Version
I got the an 'Unexpected Token'... error in odrer.php when trying to edit the order in admin section
I tried a lot of solutions, it took me a lot of time.
This is the solution that worked for me:
go to Admin->System->users->Api
Add a new api generate password, and enable it
Then go to Admin->system->settings->Edit->Option(tab)
Select api user under Checkout section as your api user
Then save the changes
Then go to Sales->orders->edit

I found the solution here ... ta-ok.html. Thank you very much!



Fri Jun 05, 2015 4:02 pm

Post by prashant_21 » Wed Jul 29, 2015 3:14 pm

:) Change api user was not worked for me.

Replace all admin files with fresh copies. It works for me.

oc version :



Fri Jul 24, 2015 11:25 pm

Post by twigg » Wed Sep 30, 2015 2:57 pm

You have to change php version: cPanel -> Software and Services -> Select PHP version.

Use 5.4 and buy me a beer :)



Fri Feb 10, 2012 4:33 am

Post by serafimme » Sun Oct 04, 2015 4:50 pm


I'm new here. Just want to share with you guys, i got same problem when i tried to run that step it still getting me same issue. i'm using OC
i create new API user and generate new password, save it and follow to Sales menu. i still unable to edit or modify any order even delete it still fail.

I go to CPanel to change the PHP version to 5.4 / 5.5 and still stuck in same problem.

anybody can help me?

when click edit order_after create new API - Error_Edit_Order_AP.JPG (19.87 KiB) Viewed 942 times



Sun Oct 04, 2015 4:07 pm
Who is online

Users browsing this forum: No registered users and 12 guests