Post by mrlawrencelam » Sat Oct 24, 2020 4:03 pm

I have a User Group named Operator. I noticed when I disable (uncheck) "localisation/country" under:

Code: Select all

Admin > System > Users > User Group > Operator > Edit User Group > Access Permission > localisation/country
then this error will popup:

Code: Select all

SyntaxError: Unexpected token < in JSON at position 0
OK
<!DOCTYPE html>
<html dir="Itr" lang="en">
<head>
<meta charset="UTF-8" />
<title> Permission Denied!</title>
<base href="http://food.xxxxxxxx.com/admin/" />
<meta name="viewport” content="width=device-width, initial-
If I re-enable "localisation/country", this error is gone. When I disable (uncheck) this permission again, the error re-appear. Other "localisation" permissions do not seem to be related to this error, only "localisation/country".

I need to disable "localisation/country" for my "Operator" group. I have searched for a few days but can't find a solution.

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by straightlight » Sun Oct 25, 2020 5:17 am

Check your error / server access logs for more information.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mrlawrencelam » Sun Oct 25, 2020 1:59 pm

I have searched the forum and also Googled for days. I found many reports about "Unexpected token in JSON at position 0". Unfortunately none fit my situation. None of the cases I found is related to "localisation/country". Although I found some very closely related situation, there was no solution.

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by mrlawrencelam » Sun Oct 25, 2020 2:36 pm

I checked the error log. Nothing useful is recorded.

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by sw!tch » Sun Oct 25, 2020 3:47 pm

Use Chrome Developer tools and check the XHR tab. See which URL is returning the error. Must be some Ajax request hitting that controller.

Backup and learn how to recover before you make any changes!
Full Stack Web Developer :: Contact via PM for custom work.


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA

Post by xxvirusxx » Sun Oct 25, 2020 3:51 pm

What oc version?
You have ocmod/vqmod extensions?

OC 2.3.0.2 | OC 3.0.3.6 | Extensions converted by me | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by spectreav » Sun Oct 25, 2020 9:46 pm

add permissions to view localisation/country or copy function localisation/country/country to controller which the user has access

and edit js function country() in admin/view/template/customer/customer_form.twig

All in One Remarketing And Ecommerce Solution for Opencart. Free Install and Setup


Newbie
Online

Posts

Joined
Sun Oct 25, 2020 7:24 pm

Post by mrlawrencelam » Mon Oct 26, 2020 3:07 pm

1) This is the result under Chrome Developer Tools > XHR when accessing the error page:

Image

2) I am using OC v3.0.3.6.

3) I tried to look into error log and access log. Can't locate anything related.

4) "localisation/country" folder is originally with chmod 644. I changed to 755 and error still pops up.

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by sw!tch » Mon Oct 26, 2020 3:50 pm

Has nothing to do with file permissions.

You can see in the XHR request it's hitting the localization/country controller.

This error would also happen on the store/settings section as it expects permission to country.

What page are you getting the error on? I suspect the page needs country to work.

Backup and learn how to recover before you make any changes!
Full Stack Web Developer :: Contact via PM for custom work.


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA

Post by paulfeakins » Mon Oct 26, 2020 7:32 pm

It might be quicker to pay a developer such as ourselves or post a job in the Commercial Support Forum.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by mrlawrencelam » Tue Oct 27, 2020 3:23 pm

sw!tch wrote:
Mon Oct 26, 2020 3:50 pm
Has nothing to do with file permissions.

You can see in the XHR request it's hitting the localization/country controller.

This error would also happen on the store/settings section as it expects permission to country.

What page are you getting the error on? I suspect the page needs country to work.
The popup error occurs when viewing a customer profile under CUSTOMERS > CUSTOMERS > (customer name) > Edit.
And this error only occurs when Access Permission for "localisation/country" is disabled for the user.

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by mrlawrencelam » Tue Oct 27, 2020 3:30 pm

This is my test:

1) I created a User Group called "Operator".
2) I enabled all Access Permissions and Modify Permission under User Groups > Edit. The only permission I disabled is "localisation/country".
3) Then I assigned permission "Operator" to user XXX.
4) When I logged in under XXX and go to Customers > Customers > (customer name) > Edit, the error popup when the customer profile page is loaded. If I enabled "localisation/country", the error disappeared.

I wonder if other users are facing the same thing?

User avatar
Newbie

Posts

Joined
Mon Oct 12, 2020 4:59 am

Post by sw!tch » Tue Oct 27, 2020 4:02 pm

Because country is needed for customer address and the AJAX request pulls that from the localisation/country controller.

Just enable access permission and disable modify permission for country.

Backup and learn how to recover before you make any changes!
Full Stack Web Developer :: Contact via PM for custom work.


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA
Who is online

Users browsing this forum: Lozza2 and 33 guests