Post by nick5000 » Sun Jul 05, 2015 1:03 am

straightlight wrote:Great. Now, we have a bit more information regarding this problem. Which OC version are you using exactly?
2.0.3.1
I have tried every "fix" found here, including Qphoria's workaround http://forum.opencart.com/viewtopic.php?f=181&t=146714

EDIT: some more info:
json support enabled
json version 1.2.1

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by straightlight » Sun Jul 05, 2015 1:26 am

This error occurs because the $json array has not been declared in the first place since there are multiple if statements in the api method. As previously mentioned before to the OC developers, especially on windows server, this methodology MUST be used.

To fix this, in admin/controller/sale/order.php file, after:

Code: Select all

public function api() {
add:

Code: Select all

$json = array();
Then, try to reproduce the same action and review your error logs. Tell me if this particular error shows by comparing the date and time of the left side of the line.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by nick5000 » Sun Jul 05, 2015 1:34 am

The popup changes from:
SyntaxError: Unexpected token <
OK
<b>Notice</b>: Undefined variable: json in <b>/home/XX/public_html/admin/controller/sale/order.php</b> on line <b>2222</b>
to:
SyntaxError: Unexpected end of input
OK
And there is nothing in error_log after adding this.

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by straightlight » Sun Jul 05, 2015 4:40 am

Ok, on the same file, for others that will encounter similar issues which disregards the cURL loopback process from hosts, here's the following api() method block to replace with:

Code: Select all

public function api() {
		$json = array();
		
		$this->load->language('sale/order');
		
		if ($this->validate()) {
			// Store
			if (isset($this->request->get['store_id'])) {
				$store_id = $this->request->get['store_id'];
			} else {
				$store_id = 0;
			}

			$this->load->model('setting/store');

			$store_info = $this->model_setting_store->getStore($store_id);

			if ($store_info) {
				$url = $store_info['ssl'];
			} else {
				$url = HTTPS_CATALOG;
			}

			if (isset($this->request->get['api'])) {
				// Include any URL perameters
				$url_data = array();

				foreach($this->request->get as $key => $value) {
					if ($key != 'route' && $key != 'token' && $key != 'store_id') {
						$url_data[$key] = $value;
					}
				}

				$curl = curl_init();

				// Set SSL if required
				if (substr($url, 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, $url . 'index.php?route=' . $this->request->get['api'] . ($url_data ? '&' . http_build_query($url_data) : ''));

				if ($this->request->post) {
					curl_setopt($curl, CURLOPT_POST, true);
					curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->request->post));
				}
				
				if (isset($this->session->data['cookie'])) {
					curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . $this->session->data['cookie'] . ';');
				}

				$json = curl_exec($curl);

				curl_close($curl);
			}
		} else {
			$response = array();

			$response['error'] = $this->error;

			$json = json_encode($response);
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput($json);
	}
As for cURL loopback restricted from hosts, there isn't much that can be done on that end to those who has an unexpected token < message from the jQuery alert. The only time this message would normally appear is whenever a token has not been defined from controllers or from admin templates in the jQuery part of code. Otherwise, this message should not appear period.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by nick5000 » Sun Jul 05, 2015 10:16 am

This changed the error to:
SyntaxError: Unexpected token <
OK


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>404 Not Found</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
background-color:#367E8E;
scrollbar-base-color: #005B70;
scrollbar-arrow-color: #F3960B;
scrollbar-DarkShadow-Color: #000000;
color: #FFFFFF;
margin:0;
}
a { color:#021f25; text-decoration:none}
h1 {
font-size: 18px;
color:…

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by nick5000 » Sun Jul 05, 2015 12:47 pm

Ok, I made some further discoveries. The longer error in post above was related to DNS (/etc/hosts file). Adjusting this removes it and curl seems to be working now (I can access the site from CLI).

In safari I get this error (with straighlights above changes)

SyntaxError: JSON Parse error: Unexpected EOF
OK

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by nick5000 » Sun Jul 05, 2015 6:30 pm

I fixed it with the help from a programmer.
The issue (at least in my case) is with Maxmind Fraud, which isn't compatibale with 2.0, while being included in core 2.0

Disabling maxmind fixed the issue.

The error:
PHP Fatal error: Call to undefined method ModelFraudMaxMind::getFraud() in /home/XXX/public_html/catalog/model/fraud/maxmind.php on line 6

getFraud is used by maxmind, but has been removed from order.php:
https://github.com/opencart/opencart/co ... 4316b540a2

So, I'm relieved to finally be able to edit order history again. But then it's a problem to not have maxmind working..

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by computersghana » Fri Jul 10, 2015 7:20 am

i see this error message when i open product to view .

Please help me solve this

Notice: unserialize(): Error at offset 6678 of 65535 bytes in /home/thompsoncomp/public_html/catalog/controller/module/journal_cp.php on line 955
Warning: fopen(/home/thompsoncomp/public_html/opencart_new/system/logs/error.txt): failed to open stream: No such file or directory in /home/thompsoncomp/public_html/system/library/log.php on line 12

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/thompsoncomp/public_html/system/library/log.php on line 14

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/thompsoncomp/public_html/system/library/log.php on line 16


Posts

Joined
Fri Jul 10, 2015 1:36 am

Post by straightlight » Mon Jul 13, 2015 11:25 pm

computersghana wrote:i see this error message when i open product to view .

Please help me solve this

Notice: unserialize(): Error at offset 6678 of 65535 bytes in /home/thompsoncomp/public_html/catalog/controller/module/journal_cp.php on line 955
Warning: fopen(/home/thompsoncomp/public_html/opencart_new/system/logs/error.txt): failed to open stream: No such file or directory in /home/thompsoncomp/public_html/system/library/log.php on line 12

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/thompsoncomp/public_html/system/library/log.php on line 14

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/thompsoncomp/public_html/system/library/log.php on line 16
This error message originates from a contribution you have installed. The catalog/controller/module/journal_cp.php file does not exist in the default installation of OC. I would suggest contacting the author of this journal contribution to get this issue resolved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by pabloctoledo » Thu Jul 16, 2015 2:48 pm

So...

How we fix this issue?

I can't find the steps to follow, is way too complicated for my knowledge.

Could somebody advice where is the solution? O0

I tried many of the options but nothing seems to work.
I have Opencart 2.0
Last edited by pabloctoledo on Thu Jul 16, 2015 3:10 pm, edited 1 time in total.

Newbie

Posts

Joined
Thu Jan 23, 2014 12:39 am

Post by pabloctoledo » Thu Jul 16, 2015 3:08 pm

nick5000 wrote:I fixed it with the help from a programmer.
The issue (at least in my case) is with Maxmind Fraud, which isn't compatibale with 2.0, while being included in core 2.0

Disabling maxmind fixed the issue.

The error:
PHP Fatal error: Call to undefined method ModelFraudMaxMind::getFraud() in /home/XXX/public_html/catalog/model/fraud/maxmind.php on line 6

getFraud is used by maxmind, but has been removed from order.php:
https://github.com/opencart/opencart/co ... 4316b540a2

So, I'm relieved to finally be able to edit order history again. But then it's a problem to not have maxmind working..
How do I disable Max mind?

Newbie

Posts

Joined
Thu Jan 23, 2014 12:39 am

Post by nick5000 » Thu Jul 16, 2015 3:24 pm

The issue is that this error can be caused by many different issues.
I hired 4 people helping with this, and only one of them found the reason (in my case).

If you have not enabled Maxmind then it is already disabled.

I'd recommend you hire somebody (check upwork.com or similar). Or downgrade to 1.5.6 as there seems to be many issues with 2.0 that I've needed to fix.

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by pabloctoledo » Thu Jul 16, 2015 3:29 pm

THIS FIXED!

Image
Image
Image

Newbie

Posts

Joined
Thu Jan 23, 2014 12:39 am

Post by IP_CAM » Tue Sep 22, 2015 12:24 pm

the:
admin_row-clicker.xml
prevented me from creating Admin Orders manually in several of my v.1.5.6.4+ Versions.
Drove me Nut's and cost me about 20 hours, to find out!
Ernie :crazy:
openshop.li/shop/

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by rajeevdutta » Sat Sep 26, 2015 4:14 am

Whenever I log into my domail www.e-partner.in or my Opencart Admin panel, I recieve the following ERROR.

Parse error: syntax error, unexpected '/' in /home/ac4e19c4/public_html/index.php on line 17

Please help somebody.

Newbie

Posts

Joined
Wed Sep 23, 2015 10:20 pm

Post by Kayram » Sat Oct 17, 2015 5:13 pm

Problem still continue. I'm using OC 2.0.3.1,
I have tried all advice included above here and fallowing adresses:
viewtopic.php?f=181&t=132699&start=60
https://github.com/opencart/opencart/issues/1993
https://github.com/opencart/opencart/issues/2587
http://stackoverflow.com/questions/2805 ... 1-column-1
http://stackoverflow.com/questions/2773 ... ine-1-colu
viewtopic.php?f=181&t=133490
http://www.viethemes.com/how-to-fix-err ... pencart-2/

But not working any solution. Still I'm getting error....

Also I'm getting this error:
<b>Notice</b>: Undefined variable: order_id in <b>/home/dossenamilano/public_html/catalog/model/fraud/maxmind.php</b> on line <b>8</b>

This line content is:
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "maxmind` WHERE order_id = '" . (int)$order_id . "'");

In line number 7 content is commentted line (fixed issue) :
//$fraud_info = $this->getFraud($data['order_id']);

So I changed it to
$order_id = $this->getFraud($data['order_id']);

But nothing change... problem still contniue...

So sorry for my bad english....

Newbie

Posts

Joined
Mon Jul 18, 2011 4:12 pm

Post by straightlight » Sat Oct 17, 2015 9:47 pm

Upgrading your OC to the latest version would resolved the issue on that end.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by marandy » Sun Nov 22, 2015 8:01 pm

I have the same problem

When finishing new order custommer take error
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON...

I use OC 1.5.1. I cant upgrade to newest version because I use some modules I bought - they are not working in new version of opencart.
On OC 1.5.1 I cant fine API setting.
Does anybody now what should to do?

My webpage is http://www.abcsedacievaky.sk
Thanks
Martin

Newbie

Posts

Joined
Mon Mar 26, 2012 4:14 pm

Post by marandy » Sun Nov 22, 2015 11:28 pm

I found whats wrong.
The problem was when someone choose product option.
After rename produs option everithing is OK :)

Newbie

Posts

Joined
Mon Mar 26, 2012 4:14 pm

Post by hebiki » Wed Nov 25, 2015 3:50 pm

i havent found a solution to the error when editing orders.

undefined variable json in order.php.

like others ive tried everything mention in this forum. upgrading to 2.1.0.1 or downgrading is a last resort. please help. im willing to pay

New member

Posts

Joined
Sun Oct 10, 2010 4:00 pm
Who is online

Users browsing this forum: No registered users and 50 guests