How to configure units switcher?
Version available: 0.10.31+
Version 1.0.0 support: not supported
An ability to setup default measuring unit and to change measuring system from UI (metric or imperial).
Supported Units:
- Metric: mm, cm, m
- Imperial: in, ft
Setup:
- Default unit: select default unit (from the list above)
- Enable units switch: select secondary unit from another system
- Switch between unit systems will be available
For config.json setup please refer to Config Options Documentation (search for defaultUnit
and secondaryUnit
).
Usage Notes:
- Units for products setup (e.g. default product width/height) are the same as default unit for user.
This means that the "default unit" is the unit you have used to setup products in the admin area / static .json files.
Integration Notes:
- All measurements in services (save/quote) are in
defaultUnit
, regardless user choice product.location.editableAreaUnits
,product.editableAerSizes
usesdefaultUnit
- How It Works Diagram: Draw IO schema (Open app for better scaling)
- Available to preselect unit - use
defaultProductAttributes.selectedUnit
. Read more in Initial Options Documentation
Questions/Answers:
Q: Default unit is in
, but I see ft
in the ruler
A: Product size is upscaled/downscaled beneath measurement system to show at least 2 units.
Explanation screenshots:
- same units: http://img.newtonideas.com/QhCaOG7qYibTQMhgahtX.png
- upscaled: http://img.newtonideas.com/MgbogkjLDhtRQhrGn0Vc.png
- downscaled: http://img.newtonideas.com/QceSb2P1I46ruwDk5Oue.png
cm
and in
? A: Yes. But for correct unit switcher please do not size labels:
- If
product.editableAreaSize.label
is set up - show label in drop-down: http://img.newtonideas.com/EY2apDKjMwTL1E8hxEsR.png- Note, if you set label "11x12in" it will be shown even if a user changed selected unit to cm
- if
product.editableAreaSize.label
is NOT set up - generate label as "productWidth x productHeight unitLabel": http://img.newtonideas.com/x0busYSCBCWpO0lgYoTZ.gif
Q: How to use step for product.location.editableAreaUnitsRange?
A: Configured step is not configured in units and this value is used for default and secondary unit.
- default unit, step 10: http://img.newtonideas.com/oPHrKwaAFkPPVFMVL6oc.png
- secondary unit, step 10: http://img.newtonideas.com/9rCHng4MW3caAQJ8xU43.png
Migration Guide:
(upgrade from 0.10.29 and lower)options.unit, options.unit2, options.unitConversionMult
are deprecated but working- we recommend to replace
options.unit
withoptions.defaultUnit
(if value suits Supported units)
Using Custom Unit:
- This feature is not recomended, but working
- Make sure that
options.defaultUnit
is not configured (it has higher priority) - Use
options.unit
with desired value (options.unit2, options.unitConversionMult are optional)