FE: Inputfield for Quantity throws Exception if not number
Current Behavior
Formfield quantities[{product.id}] is of type text so you can enter "abc" or stuff, after submitting you get an Exception
Argument 1 passed to Extcode\Cart\Domain\Model\Cart\Product::changeQuantity() must be of the type integer, string given, called in .../typo3conf/ext/cart/Classes/Controller/Cart/CartController.php on line 133
Expected behavior/output The user should see a flash-warning or either no change at all
Environment
- TYPO3 version: 9.5.22
- cart version: 6.8
- Is your TYPO3 installation set up with Composer (Composer Mode): yes
- OS: Win10
Possible Solution 1: Set quantities[{product.id}] to type="number" same for quantities{cart:fieldName(variant:variant)} 2. Validate the values in the controller and throw a flashmessage instead of an exception
@msD8G This error does not occur in the current version which is under development (branch main).
Nonetheless it might be a good idea use a field with type="number"