简体   繁体   English

将产品添加到购物车,prestashop中时,ajax购物车出现错误

[英]Error with ajax cart when add product to cart, prestashop

I've seen similar question here, but that was a long time ago and there was no any exact solving issue. 我在这里看到过类似的问题,但这是很久以前的事了,没有任何确切的解决问题。 So here is my question: I'm using standard prestashop cart module and when i'm adding a product to the cart i got an error in console 所以这是我的问题:我使用的是标准的prestashop购物车模块,当我向购物车中添加产品时,控制台出现错误

ajax-cart.js:323 Uncaught TypeError: Cannot read property 'hasError' of null
at Object.success (ajax-cart.js:323)
at j (jquery-1.11.0.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2)
at x (jquery-1.11.0.min.js:4)
at XMLHttpRequest.b (jquery-1.11.0.min.js:4)

After page reloading cart updates and we see a product there. 页面重新加载购物车更新后,我们在那里看到了产品。 The same happens when i'm trying to remove a product from cart, but for this time i have another error 当我尝试从购物车中删除产品时,也会发生同样的情况,但是这次我有另一个错误

Uncaught TypeError: Cannot read property 'hasError' of null
at Object.updateCart (ajax-cart.js:738)
at Object.success (ajax-cart.js:402)
at j (jquery-1.11.0.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2)
at x (jquery-1.11.0.min.js:4)
at XMLHttpRequest.b (jquery-1.11.0.min.js:4)

And again after page reloading everything is updated and product removed from cart. 重新加载页面后,所有内容都会更新,并且产品将从购物车中删除。 The thing is that we're receiving null in jsonData and that is why we can't check it for ther errors, it seems to be a problem on the backend. 事实是,我们在jsonData中接收到null,这就是为什么我们无法检查是否存在其他错误的原因,这在后端似乎是一个问题。 In the previous topics there were something about SmartyPlugin that can be a cause of this issue. 在前面的主题中,有关SmartyPlugin的某些内容可能是导致此问题的原因。 But even after manual cash cleaning and disabling this plugin this errors still there. 但是即使在手动现金清算并禁用此插件之后,此错误仍然存​​在。

Here is the link to the page with this issue: 这是此问题页面的链接:

cart adding issue 购物车添加问题

Is there anybody who had a deal with something like that? 有没有人处理过类似的事情? Any ideas? 有任何想法吗?

Will be very glad to any help. 任何帮助都会很高兴。

It is solved. 解决了。 In the end the problem was in __DIR__override/controllers/front/CartController.php 最后,问题出在__DIR__override / controllers / front / CartController.php中

wrong path were written in the end of the file 在文件末尾写入了错误的路径

        elseif (file_exists(_PS_MODULE_DIR_.'/ohmcart/ohmcart-ajax.php'))
        require_once(_PS_MODULE_DIR_.'/ohmcart/ohmcart-ajax.php');

instead of ohmcart must be blockcart path 代替ohmcart必须是blockcart路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM