Brille24 / SyliusCustomOptionsPlugin

A Sylius plugin that adds customer options
MIT License
47 stars 34 forks source link

Customer option File resume to "This value is not valid" #114

Closed Loocos closed 1 year ago

Loocos commented 2 years ago

Hi there,

I'm wondering if you guys have also the same error when adding a product to cart with customer option (File type) with Sylius >= v1.10 it say a form error : The value is not valid.

I was able to fix it by replacing this line in Form\product_theme.html.twig : <input type="hidden" name="{{full_name ~ '[data]' }}" id="{{ id ~ '_data'}}" /> To <input type="hidden" name="{{full_name }}" id="{{ id ~ '_data'}}" />

If yes, I will do a PR to fix it. Thanks for your feedback :)

mamazu commented 2 years ago

That's a good question. Currently we are only using this plugin in a headless mode but one of our developers can have a look at it. @JakobTolkemit

jeromin commented 1 year ago

Hi and thanks @Loocos for the tips but did you figured it out when the file option is mean to be required ?

Symfony Form absolutely wants to validate the file input (The value is not valid) as it is an array [ data => imgFile... ]) whereas CustomOptionPlugin validates the requirement (brille24.form.customer_options.required) but it is incompatible with setting the same input name.

mamazu commented 1 year ago

I think I found the issue. Could you check the pull request #128 ? This should fix the validation for files.