Bartender settings
SQL
Query to get all articles with their variants and corresponding setting values.
COALESCE to select between two values where one is not null, if both are null first value is used. With this default values are overridden.
SELECT a.name AS product,
CONCAT(CONCAT(v.weight, ' '), u.display) AS weight,
a.bio AS bio,
COALESCE(v.description, a.description) AS description,
COALESCE(v.ingredients, a.ingredients) AS ingredients,
COALESCE(v.name, a.name) AS name,
COALESCE(a.bio_origin, s.bio) AS "bio origin",
COALESCE(a.mhd, s.mhd) AS mhd,
COALESCE(a.allergens_text, s.allergens_text) AS "allergens info"
FROM article AS a
INNER JOIN variant AS v ON v.article_id = a.id
INNER JOIN settings AS s ON v.article_id = v.article_id
INNER JOIN unit AS u ON v.unit_id = u.id
INNER JOIN label AS l ON v.label_id = l.id
ORDER BY a.name, v.weight ASC
HTML settings for label
Product title
<p style="text-align: center; font-size: 16px; font-family: Arial;"><b>
</b></p>
Ingredients
Allergens info
<html><head><style type='text/css'>body {font-family: Arial; font-size: 7px;}</style></head><body><p style="text-align: center; margin: 0; padding: 0;">
</p></body></html>