Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.
Base prices
Base prices show the unit price per a defined reference quantity (e.g. per 1 kg, per 1 l, per 100 g) in addition to the sales price. This helps customers compare products and complies with EU price indication rules.
How it works in the shop
- In the product record you define the net content of the product and its unit (e.g. 750 ml, 2 kg, 100 g, 3 l, ...).
- You also define the reference quantity and its unit for which the base price should be displayed (e.g. 1 l, 1 kg, 100 g, ...).
- The shop calculates the base price dynamically from the current sales price (including discounts) and displays it in the frontend.
Product fields involved
- Net content: Numeric content amount stored in field "nettoContent"
- Content unit: Measurement unit of the net content (e.g. g, kg, ml, l)
- Base price reference quantity: Numeric reference amount stored in field "basePriceContent"
- Base price unit: Measurement unit of the base price reference quantity
Example
- Product price: 3.75 €
- Net content: 750 ml
- Base price reference: 1 l
- Resulting base price: 5.00 € per 1 l
Fluid usage
<f:if condition="{product.basePriceAsFloat}">
<small class="{settings.detail.css.class.infos.price.basePrice}">
<f:render partial="Price" arguments="{settings: settings, price: product.basePriceAsFloat}"/> <f:translate key="tx_shop_label.base_price_per" /> {product.basePriceUnitArray.label}
</small>
</f:if>
Notes
- Base prices are only calculated if both the net content and the base price reference (including units) are set and valid.
- The calculation always uses the current product price after discounts.
- Rounding follows standard business rounding to 2 decimals.
Examples
Example data table
label | short | factor | Anmerkung/Faktor-Basis |
---|---|---|---|
Milliliter | ml | 1 | Flüssigkeiten: Basis ist 1 ml |
Liter | l | 1000 | 1 l = 1000 ml |
Milligramm | mg | 1 | Trockengewicht: Basis ist 1 mg |
Gramm | g | 1000 | 1 g = 1000 mg |
Kilogramm | kg | 1000000 | 1 kg = 1000 g = 1 000 000 mg |
Stück | Stk | 1 | Zählbare Einheiten, Basis ist 1 Stück |
Zentimeter | cm | 1 | Länge: Basis ist 1 cm |
Meter | m | 100 | 1 m = 100 cm |
Quadratmeter | m² | 10000 | Fläche: Basis ist 1 cm², 1 m² = 100 cm × 100 cm = 10 000 cm² |
Kubikmeter | m³ | 1000000 | Volumen: Basis ist 1 cm³, 1 m³ = 100 cm × 100 cm × 100 cm = 1 000 000 cm³ |
Example SQL inserts
INSERT INTO tx_shop_domain_model_productmeasurement
(pid, label, short, factor, tstamp, crdate, cruser_id, deleted, hidden)
VALUES
(0, 'Milliliter', 'ml', 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Liter', 'l', 1000, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Milligramm', 'mg', 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Gramm', 'g', 1000, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Kilogramm', 'kg', 1000000, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Stück', 'Stk', 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Zentimeter', 'cm', 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Meter', 'm', 100, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Quadratmeter', 'm²', 10000, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0),
(0, 'Kubikmeter', 'm³', 1000000, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0, 0, 0);