Prestashop 1.6.1.18网站所有页面及AJAX请求均报404错误求助
PrestaShop站点AJAX请求异常排查求助
站点基本信息
- 站点地址:420panda.ca
- 基于PrestaShop搭建
问题现象
- 产品页面可正常加载,但浏览器控制台持续抛出404错误(错误截图显示控制台存在404请求异常)
- 点击产品页「+ add to cart」按钮添加商品时,前端提示“无法将商品添加到购物车”,但返回的响应数据中
hasError标记为false - 购物车页面修改商品数量时,触发技术错误提示:无法保存数量更新
错误详情
添加商品到购物车时的前端错误
Impossible to add the product to the cart. textStatus: 'error' errorThrown: '' responseText: {"products":[{"id":2721,"link":"https:\/\/420panda.ca\/en\/calibration\/2721-calibration-weight-200gr.html","quantity":3,"image":"https:\/\/420panda.ca\/7347-home_default\/calibration-weight-200gr.jpg","image_cart":"https:\/\/420panda.ca\/7347-cart_default\/calibration-weight-200gr.jpg","priceByLine":"14,97 $","name":"Calibration weight 200gr","price":"14,97 $","price_float":14.97,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]},{"id":8332,"link":"https:\/\/420panda.ca\/en\/silicone\/8332-7-three-eyed-monster-silicone-waterpipe.html","quantity":3,"image":"https:\/\/420panda.ca\/20271-home_default\/7-three-eyed-monster-silicone-waterpipe.jpg","image_cart":"https:\/\/420panda.ca\/20271-cart_default\/7-three-eyed-monster-silicone-waterpipe.jpg","priceByLine":"44,97 $","name":"4.7\" THREE EYED MONSTER SILICONE WATERPIPE","price":"44,97 $","price_float":44.97,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]},{"id":8542,"link":"https:\/\/420panda.ca\/en\/other-brands\/8542-zeus-grinder-bolt-2.html","quantity":2,"image":"https:\/\/420panda.ca\/20810-home_default\/zeus-grinder-bolt-2.jpg","image_cart":"https:\/\/420panda.ca\/20810-cart_default\/zeus-grinder-bolt-2.jpg","priceByLine":"39,98 $","name":"ZEUS GRINDER BOLT™ 2","price":"39,98 $","price_float":39.98,"idCombination":0,"idAddressDelivery":611,"is_gift":false,"hasAttributes":false,"hasCustomizedDatas":false,"customizedDatas":[]}],"discounts":[],"shippingCost":"0,00 $","shippingCostFloat":0,"wrappingCost":"0,00 $","nbTotalProducts":8,"total":"99,92 $","productTotal":"99,92 $","freeShipping":"0,00 $","freeShippingFloat":0,"free_ship":true,"isVirtualCart":false,"hasError":false}
购物车页面修改数量时的错误
TECHNICAL ERROR: unable to save update quantity Details: Error thrown: [object Object] Text status: error
排查方向建议
- 定位404请求来源:在浏览器控制台「网络」面板中找到触发404的请求,查看请求URL和类型。如果是静态资源(JS/CSS/图片),检查主题文件完整性或资源路径配置;如果是AJAX接口,检查路由规则或伪静态配置是否正常。
- 检查AJAX请求的HTTP状态码:添加商品时前端提示错误但响应数据正常,大概率是HTTP状态码异常(如4xx/5xx)。查看该请求的状态码,若为500则去服务器查看PHP错误日志,定位后端代码问题。
- 校验PrestaShop核心文件:核心文件损坏可能导致AJAX逻辑异常,可对比官方安装包校验核心文件,或备份后重新覆盖对应版本的核心文件。
- 排查第三方模块冲突:禁用所有非官方模块,逐个启用并测试,确认是否是某个模块干扰了购物车AJAX流程,重点排查购物车、结算相关模块。
- 检查服务器环境:确认PHP版本、内存限制、执行时间符合当前PrestaShop版本要求;查看Apache/Nginx错误日志,排查权限问题、URL重写失败等异常。
- 核对路由配置:检查
config/routes.yml文件是否被篡改,确认伪静态规则(Nginx rewrite、Apache .htaccess)配置正确,保证AJAX请求能正确映射到后端接口。
内容的提问来源于stack exchange,提问作者Trig3rz
相关产品推荐
相关产品推荐

