Product quantity validation¶
The quantity of added products is validated in different places.
In the BasketController¶
A helper function
validateQuantity() checks if the given quantity (string) corresponds to the rules set e.g. for float value. If the quantity matches, it is converted into a valid float value.
If the quantity doesn't validate, the quantity is just returned, but not changed - it is validated in
addAction()- After the quantity is validated, the
addActionchecks if it is 0. If so it is changed to 1.
updateAction()- After the quantity is validated, the
updateActionchecks if it is 0. If so the
deleteAction()is called and removes the product from the basket.
- Checks whether the given quantity is valid (e.g. negative numbers or strings are not allowed). If it is not valid, the action is not allowed (
- Checks whether the given quantity is more than max or less than min. If so, it is set to either max or min.
In standard config in