| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
How to set minimum integer value? | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() If you look at the admin product info screen you can use your mouse scrollwheel to adjust both the Weight and the Quantity in Stock fields. The Weight field won't let you go below zero but the Quantity in Stock field will. I can't figure out how the Weight field sets the minimum value?
(I'm not trying to modify this page I'm just using it for a reference for my module) Thanks!
__________________
X-Cart Business 5.3.6.8 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() In your yaml file for the field
widgetParameters: { min: XX, max: YY } You should be able to use similar for form fields as well from the class that shows the form
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() I'm just not sure where to set the widgetParameters outside of the yaml file. I don't see any code that uses widgetParameters for the product weight field, for example.
If you inspect the HTML for the product weight it has a data-min property on the field which is what needs to happen however I have no idea how to get that value set.
__________________
X-Cart Business 5.3.6.8 |
|||||||
#4
|
|||||||||
|
|||||||||
![]() Product weight field for the form is set here
/classes/XLite/View/Model/Product.php and the range is set here - min 0 /classes/XLite/View/Form/Product/Modify/Single.php The inventory form is set here /var/www/xc5/xcart52x/classes/XLite/View/Model/InventoryTracking.php and does not have min/max values set for the quantity
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||
|
|||||||
![]() That helps, thanks! Funny enough it seems the Integer validator doesn't support a range, only the Float version. It seems it would be helpful for integers to be limited in range as well.
__________________
X-Cart Business 5.3.6.8 |
|||||||
#6
|
|||||||||
|
|||||||||
![]() Integer does support range but only positive numbers. I raised this issue with XC few months ago. I had a conversation with them and they did agree integer class as coded in XC5 is wrong and will be corrected in 5.3.x to support negative, positive and 0.
In the mean time you can overwrite the default Integer class with your own to support negative numbers as well.
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|