4

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.

J.Cage
  • 369
  • 2
  • 18
  • Just post your code here . I think it might be the structure of your form . – shaik ibrahim Jun 21 '13 at 06:02
  • I haven't made any changes to the code whatsoever but it gives an error while resolving the item `try { $item = $this->getResolver()->resolve($emptyItem, $request); } catch (ItemResolvingException $exception) { // Write flash message $this->dispatchEvent(SyliusCartEvents::ITEM_ADD_ERROR, new FlashEvent($exception->getMessage())); return $this->redirectToCartSummary(); }` – J.Cage Jun 21 '13 at 10:16

1 Answers1

2

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.

Scotty Waggoner
  • 3,083
  • 2
  • 26
  • 40