Post by vana.panagiotou » Tue Sep 28, 2021 8:37 pm

Hello,

we are encounter the following problem during the updated of an order on the admin environment

[SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
<b>Notice</b>: Undefined variable: json in <b>/var/www/vhosts/hantrodentro.gr/httpdocs/admin/controller/sale/order.php</b> on line <b>2226</b>



We have already checked the following topics and our config.php file is correct.
viewtopic.php?t=145497

The problem appeared unexpected without any update on the site.

The tests that we already performed:

1. The if ($this->validate()) is not true. Even though if we changed the code to always be true the
$json variable is still empty
2. We also tried to declare the variable at the beginning of the function public function api() as an array but again we received an error.

Please keep in mind that our knowledge is limited.

Can you please help us? Our version is 2.0.3.1.

Thank you in advance.


Posts

Joined
Tue Sep 28, 2021 6:26 pm

Post by Gergely » Tue Sep 28, 2021 10:05 pm

Hi vana.panagiotou,
while not a complete solution, here are a few observations:
  1. The file in question does not have 2226 lines out of the box. The additional length might just be due to your previous debugging efforts, but if that's not the case, an investigation into whether previous changes are causing the issue might be worthwhile.
  2. The solution in the topic you link to is no longer recommended, you should be serving your site over https, and set up config accordingly.
  3. One of the problems is that the Notice makes it into the response body, for more on that read this post: viewtopic.php?f=202&t=225662#p829144
  4. I think this should have done the trick:
    vana.panagiotou wrote:
    Tue Sep 28, 2021 8:37 pm
    We also tried to declare the variable at the beginning of the function public function api() as an array but again we received an error.
    As fixed in this commit
    Have you cleared the caches after doing these changes?
I hope this is at least a bit helpful!
Last edited by Gergely on Tue Sep 28, 2021 11:40 pm, edited 1 time in total.

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by straightlight » Tue Sep 28, 2021 10:10 pm

Way too old.

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
Who is online

Users browsing this forum: No registered users and 151 guests