Post by johnyonutz » Tue May 03, 2016 9:40 pm

when checking out i keep getting:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in ...
for each step - invoice, delivery form
Last edited by straightlight on Wed Aug 03, 2016 6:48 am, edited 1 time in total.
Reason: Added quote tags.

Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by viethemes » Tue May 03, 2016 11:39 pm

Are you using extension to replace the built-in checkout?

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by johnyonutz » Tue May 03, 2016 11:47 pm

default theme with no extensions

Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by straightlight » Wed May 04, 2016 4:22 am

More information would be needed here.

- Which OC version are you using?
- Does this error occur by using the API from the admin orders or from the customer's checkout page?

What I am noticing is this error from your first post:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in ...
"Comment in ..." (...) where exactly? A location should be provided from the error window.

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 johnyonutz » Wed May 04, 2016 2:29 pm

version is 2.2.0.0

the errors appear when trying to place an order as a client

errors:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: fax in <b>/home/imecamc/public_html/catalog/controller/checkout/guest.php</b> on line <b>273</b>[]
then if i complete fax i get:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in <b>/home/imecamc/public_html/catalog/controller/checkout/shipping_method.php</b> on line <b>127</b>[]
and the errors appear if i do not complete each and every field in the order - even the order comment form....
Last edited by straightlight on Thu Aug 04, 2016 6:58 am, edited 1 time in total.
Reason: Added quote tags.

Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by straightlight » Wed May 04, 2016 7:20 pm

While the fax is not a mandatory field, it may need to be modified.

In catalog/controller/checkout/guest.php file,

find:

Code: Select all

$this->session->data['guest']['fax'] = $this->request->post['fax'];
replace with:

Code: Select all

$this->session->data['guest']['fax'] = '';

if (!empty($this->request->post['fax'])) {
    $this->session->data['guest']['fax'] = $this->request->post['fax'];
}
In catalog/controller/checkout/shipping_method.php file,

find:

Code: Select all

$this->session->data['comment'] = strip_tags($this->request->post['comment']);
replace with:

Code: Select all

$this->session->data['comment'] = '';

if (!empty($this->request->post['comment'])) {
    $this->session->data['comment'] = strip_tags($this->request->post['comment']);
}

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 johnyonutz » Tue May 10, 2016 12:24 am

hi, and thanks for helping me!

i tried this and i get a lot of messages...

and it seems that it is the same if i order without guest mode..

Attachments

tried.jpg

tried.jpg (167.72 KiB) Viewed 22798 times


Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by johnyonutz » Tue May 10, 2016 5:04 pm

i also have error on payment and shipping...

Attachments

error.jpg

error.jpg (34.75 KiB) Viewed 22787 times


Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by straightlight » Tue May 10, 2016 10:12 pm

In catalog/controller/checkout/guest.php file,

find:

Code: Select all

$this->session->data['payment_address']['company'] = $this->request->post['company'];
replace with:

Code: Select all

$this->session->data['payment_address']['company'] = '';

if (!empty($this->request->post['company'])) {
    $this->session->data['payment_address']['company'] = $this->request->post['company'];
}
Then, find:

Code: Select all

$this->session->data['payment_address']['address_2'] = $this->request->post['address_2'];
replace with:

Code: Select all

$this->session->data['payment_address']['address_2'] = '';

if (!empty($this->request->post['address_2'])) {
    $this->session->data['payment_address']['address_2'] = $this->request->post['address_2'];
}

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 johnyonutz » Wed May 11, 2016 3:22 pm

thank straightlight

i allready followed your example and it works fine

however i am stuck with the payment and shipping method...

the same error is thrown for guest and account mode...

Newbie

Posts

Joined
Tue Apr 30, 2013 4:12 am

Post by straightlight » Fri May 13, 2016 1:15 am

In catalog/controller/checkout/payment_method.php and catalog/controller/checkout/shipping_method.php file,

find:

Code: Select all

$this->session->data['comment'] = strip_tags($this->request->post['comment']);
replace both with:

Code: Select all

$this->session->data['comment'] = '';

if (!empty($this->request->post['comment'])) {
	$this->session->data['comment'] = $this->request->post['comment'];
}

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 platypuspuzzles » Mon Jun 27, 2016 12:06 am

Hi

I have this same issue, and thanks to the above posts, I was able to fix all but one JSON error

I've updated onto a copy of my store and the upgrade script worked like a charm from 2.0.3.1 to 2.2.0.0

I had this same error for guest.php and shipping_method.php but was able to find the fix on the forum.

I haven't been able to find a fix for this one though:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in <b>/.../catalog/controller/checkout/payment_method.php</b> on line <b>186</b>[]
Any help greatly appreciated
Last edited by straightlight on Wed Aug 03, 2016 6:47 am, edited 1 time in total.
Reason: Added quote tags.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 12:07 am

platypuspuzzles wrote:Hi

I have this same issue, and thanks to the above posts, I was able to fix all but one JSON error

I've updated onto a copy of my store and the upgrade script worked like a charm from 2.0.3.1 to 2.2.0.0

I had this same error for guest.php and shipping_method.php but was able to find the fix on the forum.

I haven't been able to find a fix for this one though:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in <b>/.../catalog/controller/checkout/payment_method.php</b> on line <b>186</b>[]

Any help greatly appreciated
The solution is right above your post for this file particularly ...

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 platypuspuzzles » Mon Jun 27, 2016 12:37 am

straightlight wrote:
platypuspuzzles wrote:Hi

I have this same issue, and thanks to the above posts, I was able to fix all but one JSON error

I've updated onto a copy of my store and the upgrade script worked like a charm from 2.0.3.1 to 2.2.0.0

I had this same error for guest.php and shipping_method.php but was able to find the fix on the forum.

I haven't been able to find a fix for this one though:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: comment in <b>/.../catalog/controller/checkout/payment_method.php</b> on line <b>186</b>[]

Any help greatly appreciated
The solution is right above your post for this file particularly ...
I tried to find and replace the text in payment_method too, but it didnt work

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by platypuspuzzles » Mon Jun 27, 2016 12:47 am

I tell a lie - it did work! (Thanks, I must have made a mistake when attempting the edit the first time)

Now I have a new error
Notice: Error: Could not load template /.../catalog/view/theme/default/template/default/template/payment/nabtrans.tpl! in /.../vqmod/vqcache/vq2-system_library_template_basic.php on line 26
I'll post this on the nab transact extention comments
Last edited by straightlight on Thu Aug 04, 2016 6:54 am, edited 1 time in total.
Reason: Added quote tags.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 12:51 am

Nabtrans Payment Gateway is a contributed extension as it is not part of the core. Contact the payment gateway developer of that extension to resolved this issue.

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 platypuspuzzles » Mon Jun 27, 2016 3:14 pm

I've just completed testing the rest of the different checkout processes to trigger the JSON errors (I only have default/no wholesale account log in so haven't tested different account type log ins)
The following checkout processes produce these errors - I've tried making changes, to the above suggestions, and editing shipping/payment address , but I receive internal error message, and not sure what causes it.

Any help to let me know what to replace the associated lines with, greatly appreciated

**LOGGED IN ACCOUNT CHANGE OF ADDRESS**
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/model/account/address.php</b> on line <b>4</b>[]
**REGISTER NEW ACCOUNT**
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: fax in <b>/home/.../catalog/model/account/customer.php</b> on line <b>14</b>
<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/model/account/customer.php</b> on line <b>18</b>[]
**GUEST ACCOUNT**
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/controller/checkout/guest.php</b> on line <b>338</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/controller/checkout/guest.php</b> on line <b>340</b>[]
Last edited by platypuspuzzles on Mon Jun 27, 2016 5:22 pm, edited 3 times in total.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by platypuspuzzles » Mon Jun 27, 2016 4:54 pm

**GUEST ACCOUNT - CHANGE DELIVERY ADDRESS**
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/controller/checkout/guest_shipping.php</b> on line <b>165</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/controller/checkout/guest_shipping.php</b> on line <b>167</b>[]
I made these edits: same again for address_2 - THIS FIXED THE ABOVE ERROR
replaced this

Code: Select all

$this->session->data['shipping_address']['company'] = $this->request->post['company'];

}
with

Code: Select all

$this->session->data['shipping_address']['company'] = '';

    if (!empty($this->request->post['company'])) {
        $this->session->data['shipping_address']['company'] = $this->request->post['company'];
}
Last edited by platypuspuzzles on Mon Jun 27, 2016 8:13 pm, edited 3 times in total.

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm

Post by straightlight » Mon Jun 27, 2016 7:06 pm

platypuspuzzles wrote:**GUEST ACCOUNT - CHANGE DELIVERY ADDRESS**

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

OK

<b>Notice</b>: Undefined index: company in <b>/home/.../catalog/controller/checkout/guest_shipping.php</b> on line <b>165</b>
<b>Notice</b>: Undefined index: address_2 in <b>/home/.../catalog/controller/checkout/guest_shipping.php</b> on line <b>167</b>[]

I made these edits: same again for address_2 - THIS FIXED THE ABOVE ERROR
replaced this

Code: Select all

$this->session->data['shipping_address']['company'] = $this->request->post['company'];
with

Code: Select all

$this->session->data['shipping_address']['company'] = '';

    if (!empty($this->request->post['company'])) {
        $this->session->data['shipping_address']['company'] = $this->request->post['company'];

This code change will create an missing } ending.

Code: Select all

}
Then, on the same file, find:

Code: Select all

$this->session->data['shipping_address']['address_2'] = $this->request->post['address_2'];
replace with:

Code: Select all

$this->session->data['shipping_address']['address_2'] = '';
			
			if (!empty($this->request->post['address_2'])) {
				$this->session->data['shipping_address']['address_2'] = $this->request->post['address_2'];
			}
at the end of your change. ;D

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 platypuspuzzles » Mon Jun 27, 2016 7:40 pm

oh cheers!

Do I use the same coding for all the above errors?

Active Member

Posts

Joined
Sun Jan 23, 2011 8:11 pm
Who is online

Users browsing this forum: No registered users and 204 guests