At the moment, a size type is completely independent from a unit. It basically contains this information:
name
amount ("how much is in it")
Here, one elementary information is missing: the size type.
When talking about a bottle filled with 0,5 litres we always say "bottle 0,5 litres" not just "bottle 0,5".
Furthermore, "can 0,5 litres" is quite different from "can 0,5 kg" – it's two completely different concepts (imagine a beer can and a peanut can).
A product always has exactly one unit assigned, like "litre" for drinks and "kilogram" for food.
When assigning a size type to a product we must only select those size types with the same unit.
Otherwise it's possible to create combinations like "bottle 0,5 piece" or "piece 1 litre" which don't make sense.
Thus, a size type should always reference a unit. When assigning a size type to a product, we must only see those with the same unit.
Possible TODOs for the backend
extend size_types table by refUnit column
extend SizeType model (and factory) by unit property
change SQL queries
every time a sizeType and no product is queried we need the additionally joined "unit" field
size type filtering by unit can be done in the frontend
Those are some current screens which lack the unit information or display senseless combinations (which is not cool).
At the moment, a size type is completely independent from a unit. It basically contains this information:
name
amount
("how much is in it")Here, one elementary information is missing: the size type. When talking about a bottle filled with 0,5 litres we always say "bottle 0,5 litres" not just "bottle 0,5". Furthermore, "can 0,5 litres" is quite different from "can 0,5 kg" – it's two completely different concepts (imagine a beer can and a peanut can).
A product always has exactly one unit assigned, like "litre" for drinks and "kilogram" for food. When assigning a size type to a product we must only select those size types with the same unit. Otherwise it's possible to create combinations like "bottle 0,5 piece" or "piece 1 litre" which don't make sense.
Thus, a size type should always reference a unit. When assigning a size type to a product, we must only see those with the same unit.
Possible TODOs for the backend
size_types
table byrefUnit
columnSizeType
model (and factory) byunit
propertyThose are some current screens which lack the unit information or display senseless combinations (which is not cool).