简体   繁体   中英

“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 .

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. Specifically, it couldn't map Sylius\\Bundle\\AssortmentBundle\\Entity\\CustomizableProduct or 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.

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.

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