简体   繁体   English

将产品添加到购物车时,“提交的表单无效”:Sylius购物车包

[英]“Submitted form is invalid” when adding a product to cart : Sylius Cart Bundle

I apologize if this seems to be a very naive question..but i've just learnt Symfony2 and trying to learn the workings of Sylius . 抱歉,这似乎是一个非常幼稚的问题。.但是我刚刚学习了Symfony2,并试图了解Sylius的工作原理。

When I add a product to the cart it seems to always return the error : 当我将产品添加到购物车时,它似乎总是返回错误:

Submitted form is invalid 提交的表格无效

I have searched the solution to this but nothing seems to be documented (or have I missed it ??) 我已经搜索了此问题的解决方案,但似乎没有任何记录(或者我错过了它??)

I also commented the validation section but still get the same error. 我也评论了验证部分,但仍然收到相同的错误。 Please help and thanks in advance. 请帮助并提前致谢。

It has something to do with having options on products. 它与产品上的选择有关。 I had the same error and looking through the profiler at the Doctrine info there was an error for 2 of the objects that were being persisted to the database. 我遇到了相同的错误,并且通过分析器查看“ Doctrine”信息时,存在两个持久化到数据库的对象时出错。 Specifically, it couldn't map Sylius\\Bundle\\AssortmentBundle\\Entity\\CustomizableProduct or Sylius\\Bundle\\AssortmentBundle\\Entity\\Variant\\Variant. 具体来说,它无法映射Sylius \\ Bundle \\ AssortmentBundle \\ Entity \\ CustomizableProduct或Sylius \\ Bundle \\ AssortmentBundle \\ Entity \\ Variant \\ Variant。

To fix it I had to Generate Variants of the product which is on the product details page in the admin area. 要修复它,我必须在管理区域的“产品详细信息”页面上生成该产品的变体。 Without having variants to add to the cart, it couldn't choose a specific type of the product to add to the cart. 没有要添加到购物车的变体,它就无法选择要添加到购物车的特定类型的产品。

I feel like this should produce a better error, especially when running the app in dev mode. 我觉得这应该会产生更好的错误,尤其是在开发模式下运行应用程序时。

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

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