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
我在opencart购物车页面遇到问题,每当用户想要从购物车中取出商品时,都会显示下面的按摩
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 ?
3 个解决方案
#1
1
Seems that your output should be json format, however you're printing those <pre>remove</pre>
as well, which makes your json invalid.
似乎你的输出应该是json格式,但是你也打印那些
remove ,这会使你的json无效。
Maybe You could try to use some grep
in order to locate the file where those strings are coming from.
也许你可以尝试使用一些grep来找到那些字符串来自哪里的文件。
#2
0
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:
我对opencart一无所知......但你的问题是
remove / pre>是json对象的“外部”,它必须是这样的东西:
{"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.
我认为你有一个PHP代码在你到达json对象输出之前发出这个请求(ajax请求?)时发出回声。
#3
0
i found the solution to this problem
我找到了解决这个问题的方法
in system/library/cart.php
under : public function remove($cart_id)
delete the follwing :
在:public function remove($ cart_id)删除以下内容:
echo "<pre>";
print_r("Remove");
echo "</pre>"; )
that shall fix the problem
这将解决问题
#1
1
Seems that your output should be json format, however you're printing those <pre>remove</pre>
as well, which makes your json invalid.
似乎你的输出应该是json格式,但是你也打印那些
remove ,这会使你的json无效。
Maybe You could try to use some grep
in order to locate the file where those strings are coming from.
也许你可以尝试使用一些grep来找到那些字符串来自哪里的文件。
#2
0
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:
我对opencart一无所知......但你的问题是
remove / pre>是json对象的“外部”,它必须是这样的东西:
{"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.
我认为你有一个PHP代码在你到达json对象输出之前发出这个请求(ajax请求?)时发出回声。
#3
0
i found the solution to this problem
我找到了解决这个问题的方法
in system/library/cart.php
under : public function remove($cart_id)
delete the follwing :
在:public function remove($ cart_id)删除以下内容:
echo "<pre>";
print_r("Remove");
echo "</pre>"; )
that shall fix the problem
这将解决问题