I have a problem in the opencart cart page , whenever the user want to remove an item from the cart the below massage is displayed
syntaxerror : unexpected token < in json at position 0
ok
<pre>remove</pre>{"total":"0 item(s)-0.000 BD"}
i believe that
removeshould not be here , but unfortunately i couldn't find it in the files , any idea ?
Seems that your output should be json format, however you're printing those <pre>remove</pre>
as well, which makes your json invalid.
Maybe You could try to use some grep
in order to locate the file where those strings are coming from.
I know nothing about opencart... but your problem is that <pre>remove/pre> is "outside" of the json object, it must to be some thing like:
{"total":"0 item(s)-0.000 BD", "the_pre":"<pre>remove</pre>"}
What I think is that you have a php code that is making an echo when you make this request (ajax request?) before arrive to the json object output.
i found the solution to this problem
in system/library/cart.php
under : public function remove($cart_id)
delete the follwing :
echo "<pre>";
print_r("Remove");
echo "</pre>"; )
that shall fix the problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.