Post by e-Hifi » Thu Aug 15, 2019 6:02 pm

This seems to be a very common problem when searching through posts on this forum and when searching on google.
I have tried to find a possible solution to my specific problem but i cant find any that works.
The problem occurs when i try to add a new order or edit an existing one, the first 2 tabs works fine but when i press proceed from the third tab (payment details) to go to forth (shipping details) i get "syntax error: unexpected token < in JSON at position 0."
The PHP error log states:

Code: Select all

[15-Aug-2019 09:11:40 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php on line 251 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-catalog_model_extension_total_sub_total.php:3
Stack trace:
#0 C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php(251): ModelExtensionTotalSubTotal->getTotal()
#1 C:\wamp64\www\snyggtljud_v3\catalog\controller\api\payment.php(181): Loader->{closure}(Array, Array, 0)
#2 C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_action.php(79): ControllerApiPayment->methods()
#3 C:\wamp64\www\snyggtljud_v3\catalog\controller\startup\router.php(25): Action->execute(Object(Registry))
#4 C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_action.php(79): ControllerStartupRouter->index()
#5 C:\wamp64\www in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-catalog_model_extension_total_sub_total.php on line 3
I have installed OC 3.031 on a localhost with the default theme and i have a few extensions installed as well. I of course have tried to uninstall all extensions first and do the regular cache updates with no luck. I have reverted to english admin language instead of my installed swedish, no luck either.
I have created a new API key and entered my ip, then chose the new API in settings.

Based on my error log and taken steps, what do you think is the cause of this and what can i do to fix it.

Thanks in advance!
Last edited by e-Hifi on Mon Aug 19, 2019 6:20 pm, edited 1 time in total.

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am

Post by thekrotek » Thu Aug 15, 2019 6:11 pm

Judging from the error message, issue is still related to 3rd party modification. Disable ALL modification and try again.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by paulfeakins » Thu Aug 15, 2019 6:38 pm

e-Hifi wrote:
Thu Aug 15, 2019 6:02 pm
"syntax error: unexpected token < in JSON at position 0."
The page is trying to request some JSON data via AJAX but it is receiving an HTML page.

In your browser, use the developer tools to inspect the request being made and find out why the URL being requested is returning HTML rather than JSON.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by e-Hifi » Thu Aug 15, 2019 7:47 pm

Thanks for your input.
I have removed all extensions and modifications (with the exception of vqmod itself) and cleared all cache.
When using developer tools i get no errors in console but i can see this under "network preview" a bit more info of the error perhaps?

Code: Select all

( ! ) Fatal error: Uncaught ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line 3
( ! ) ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line 3
Call Stack
#	Time	Memory	Function	Location
1	0.0000	363376	{main}( )	...\index.php:0
2	0.0160	575752	start( )	...\index.php:23
3	0.0160	577256	require_once( 'C:\wamp64\www\snyggtljud_v3\system\framework.php' )	...\vq2-system_startup.php:104
4	0.0310	726296	Router->dispatch( )	...\framework.php:165
5	0.0490	849016	Router->execute( )	...\router.php:56
6	0.0490	849016	Action->execute( )	...\router.php:67
7	0.0490	850008	ControllerStartupRouter->index( )	...\vq2-C:_wamp64_storage_modification_system_engine_action.php:79
8	0.0490	859096	Action->execute( )	...\router.php:25
9	0.0490	860088	ControllerApiPayment->methods( )	...\vq2-C:_wamp64_storage_modification_system_engine_action.php:79
10	0.0540	878176	Loader->{closure:C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php:220-262}( )	...\payment.php:181
11	0.0540	879232	ModelExtensionTotalSubTotal->getTotal( )	...\vq2-C:_wamp64_storage_modification_system_engine_loader.php:248 
Am i missing something obvious here?

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am

Post by paulfeakins » Thu Aug 15, 2019 7:52 pm

e-Hifi wrote:
Thu Aug 15, 2019 7:47 pm
Too few arguments to function ModelExtensionTotalSubTotal::getTotal()
So for some reason when you're pressing the button and it's making a request, it probably isn't passing enough arguments.

Can you see from the Network tab what the request is and to what URL?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by e-Hifi » Thu Aug 15, 2019 8:27 pm

After pressing "proceed" on tab 3 when creating a new order i get 2 request URL:s in network tab in dev tools.
The first is:

Code: Select all

Request URL: http://localhost/snyggtljud_v3/index.php?route=api/payment/address&api_token=XXXXXXXX&store_id=0
(removed api token)
and the preview and response on that is:
success: "Klart: Betaladress är registrerad!"
swedish for "payment adress is registred"

The second request is the problem...

Code: Select all

Request URL: http://localhost/snyggtljud_v3/index.php?route=api/payment/methods&api_token=XXXXXXXXX&store_id=0
(again api removed)
The preview is the same error text as my last post stated and the response is a html:

Code: Select all

<br />
<font size='1'><table class='xdebug-error xe-uncaught-exception' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Uncaught ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line <i>3</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line <i>3</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0000</td><td bgcolor='#eeeeec' align='right'>363376</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\wamp64\www\snyggtljud_v3\index.php' bgcolor='#eeeeec'>...\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0350</td><td bgcolor='#eeeeec' align='right'>561168</td><td bgcolor='#eeeeec'>start(  )</td><td title='C:\wamp64\www\snyggtljud_v3\index.php' bgcolor='#eeeeec'>...\index.php<b>:</b>23</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0350</td><td bgcolor='#eeeeec' align='right'>562672</td><td bgcolor='#eeeeec'>require_once( <font color='#00bb00'>'C:\wamp64\www\snyggtljud_v3\system\framework.php'</font> )</td><td title='C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-system_startup.php' bgcolor='#eeeeec'>...\vq2-system_startup.php<b>:</b>104</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.0570</td><td bgcolor='#eeeeec' align='right'>711712</td><td bgcolor='#eeeeec'>Router->dispatch(  )</td><td title='C:\wamp64\www\snyggtljud_v3\system\framework.php' bgcolor='#eeeeec'>...\framework.php<b>:</b>165</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.0750</td><td bgcolor='#eeeeec' align='right'>834112</td><td bgcolor='#eeeeec'>Router->execute(  )</td><td title='C:\wamp64\www\snyggtljud_v3\system\engine\router.php' bgcolor='#eeeeec'>...\router.php<b>:</b>56</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.0750</td><td bgcolor='#eeeeec' align='right'>834112</td><td bgcolor='#eeeeec'>Action->execute(  )</td><td title='C:\wamp64\www\snyggtljud_v3\system\engine\router.php' bgcolor='#eeeeec'>...\router.php<b>:</b>67</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.0760</td><td bgcolor='#eeeeec' align='right'>835104</td><td bgcolor='#eeeeec'>ControllerStartupRouter->index(  )</td><td title='C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_action.php' bgcolor='#eeeeec'>...\vq2-C:_wamp64_storage_modification_system_engine_action.php<b>:</b>79</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>0.0760</td><td bgcolor='#eeeeec' align='right'>844192</td><td bgcolor='#eeeeec'>Action->execute(  )</td><td title='C:\wamp64\www\snyggtljud_v3\catalog\controller\startup\router.php' bgcolor='#eeeeec'>...\router.php<b>:</b>25</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.0760</td><td bgcolor='#eeeeec' align='right'>845184</td><td bgcolor='#eeeeec'>ControllerApiPayment->methods(  )</td><td title='C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_action.php' bgcolor='#eeeeec'>...\vq2-C:_wamp64_storage_modification_system_engine_action.php<b>:</b>79</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>10</td><td bgcolor='#eeeeec' align='center'>0.0830</td><td bgcolor='#eeeeec' align='right'>863272</td><td bgcolor='#eeeeec'>Loader->{closure:C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php:220-262}(  )</td><td title='C:\wamp64\www\snyggtljud_v3\catalog\controller\api\payment.php' bgcolor='#eeeeec'>...\payment.php<b>:</b>181</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>11</td><td bgcolor='#eeeeec' align='center'>0.0840</td><td bgcolor='#eeeeec' align='right'>864328</td><td bgcolor='#eeeeec'>ModelExtensionTotalSubTotal->getTotal(  )</td><td title='C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php' bgcolor='#eeeeec'>...\vq2-C:_wamp64_storage_modification_system_engine_loader.php<b>:</b>248</td></tr>
</table></font>
I have only tested to activate the "free checkout" and "COD" payment modules, no third party modules.

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am

Post by paulfeakins » Thu Aug 15, 2019 8:56 pm

e-Hifi wrote:
Thu Aug 15, 2019 8:27 pm
function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php
There are a couple of problems here:
"C:\wamp64\www\snyggtljud_v3\vqmod\vqcache\vq2-C:_wamp64_storage_modification_system_engine_loader.php"

1. Why does that path have the "C:_" in it?
2. vqcache is being used, meaning you haven't really removed all extensions.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by e-Hifi » Thu Aug 15, 2019 9:38 pm

The "C:_" seems to be a vqmod thing, there is a "_" between every part of the filepath.
But i found out that a part of the vqmod engine wasnt deleted, therefore the vqcache.
After deleting all vqmod files, the problem is still the same though, only that the error text dont have any reference to vqcache files anymore.
It looks like this now:

Code: Select all

( ! ) Fatal error: Uncaught ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\storage\modification\system\engine\loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line 3
( ! ) ArgumentCountError: Too few arguments to function ModelExtensionTotalSubTotal::getTotal(), 0 passed in C:\wamp64\storage\modification\system\engine\loader.php on line 248 and exactly 1 expected in C:\wamp64\www\snyggtljud_v3\catalog\model\extension\total\sub_total.php on line 3
Call Stack
#	Time	Memory	Function	Location
1	0.0000	363376	{main}( )	...\index.php:0
2	0.0020	389440	start( )	...\index.php:23
3	0.0020	390944	require_once( 'C:\wamp64\www\snyggtljud_v3\system\framework.php' )	...\startup.php:104
4	0.0120	524128	Router->dispatch( )	...\framework.php:165
5	0.0330	646840	Router->execute( )	...\router.php:56
6	0.0330	646840	Action->execute( )	...\router.php:67
7	0.0330	647832	ControllerStartupRouter->index( )	...\action.php:79
8	0.0330	656920	Action->execute( )	...\router.php:25
9	0.0330	657912	ControllerApiPayment->methods( )	...\action.php:79
10	0.0380	676000	Loader->{closure:C:\wamp64\storage\modification\system\engine\loader.php:220-262}( )	...\payment.php:181
11	0.0380	677056	ModelExtensionTotalSubTotal->getTotal( )	...\loader.php:248 

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am

Post by paulfeakins » Thu Aug 15, 2019 9:59 pm

I see, so you will need to look at the URL being called by AJAX, use that to work out what file is running - it will be a controller.

Then trace the data through by logging what certain variables are at different points to try and figure out why when it calls get Total(), it is not passing any data.

As the URL contains: api/payment/methods the file is likely to be called payment.php in the api folder and the function in that file is probably called methods().

Unless the file is called methods.php in folders api and payment and in that case the function being called would be index().

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by letxobnav » Thu Aug 15, 2019 10:36 pm

you still have a modification
C:\wamp64\storage\modification\system\engine\loader.php

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by e-Hifi » Thu Aug 15, 2019 10:55 pm

Thankyou for your input!
I will have to investigate further and perhaps there is some leftover code from previous mods somewhere that im missing.
I think i will have to install OC from scratch again and work my way up, one extension / mod at a time to see if thats whats causing this behaviour.
I will let you know as soon as i find the problem.

8)

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am

Post by e-Hifi » Mon Aug 19, 2019 6:18 pm

A little update on this matter...
Today i installed OC 3.032 from scratch and i can now edit orders again!
So it must have been some code from an extension that i wasnt able to remove before.
Thanks again for your time.

New member

Posts

Joined
Thu Apr 28, 2011 6:29 am
Who is online

Users browsing this forum: Amazon [Bot] and 320 guests