Shop-Feinschliff: neue Honigtexte, Seife, Essig, Reihenfolge
- Kategorien: erst alle Produkte, dann Gutschein, Patenschaft, Kurs, Abo - Gutschein und Kurs ohne Versand-, Lieferzeit- und Abfüllhinweise - Neue Beschreibungen für elf Honigsorten, Subline für Himbeerblüte - Honig-Seife: handgemacht im Untertitel, Text mit INCI-Liste - Shop-Raster zeigt den Untertitel auch bei Nicht-Honig-Produkten - Honig-Balsamico-Essig 0,25 l für 12,90 €, Grundpreis je Liter - Honiglöffel 5,90 € - Automaten: neuer Titel und Text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
import honigEssig from "../scripts/set-honig-essig";
|
||||||
|
|
||||||
|
/** Läuft einmal beim Deploy (medusa db:migrate). */
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
await honigEssig({ container });
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import honigtexte from "../scripts/set-honigtexte";
|
||||||
|
|
||||||
|
/** Läuft einmal beim Deploy (medusa db:migrate). */
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
await honigtexte({ container });
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import shopFeinschliff from "../scripts/set-shop-feinschliff";
|
||||||
|
|
||||||
|
/** Läuft einmal beim Deploy (medusa db:migrate), wie die Honigbilder. */
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
await shopFeinschliff({ container });
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/**
|
||||||
|
* Honig-Balsamico-Essig, 0,25 l, in der Kategorie "Feinkost".
|
||||||
|
*
|
||||||
|
* npx medusa exec ./src/scripts/set-honig-essig.ts
|
||||||
|
*
|
||||||
|
* Vorerst ohne Bild, Preis 12,90 €. Zutaten und Nährwerte vom Team.
|
||||||
|
* Der Grundpreis kommt über `net_volume_ml` und steht dann je Liter.
|
||||||
|
*
|
||||||
|
* Das Versandgewicht (550 g) ist geschätzt — Flasche plus Inhalt. Im Admin
|
||||||
|
* unter Variante → Gewicht korrigieren, sobald gewogen.
|
||||||
|
*
|
||||||
|
* Wiederholbar: legt nur an, was fehlt, und setzt sonst die Zielwerte.
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
createProductCategoriesWorkflow,
|
||||||
|
createProductsWorkflow,
|
||||||
|
updateProductsWorkflow,
|
||||||
|
updateProductVariantsWorkflow,
|
||||||
|
} from "@medusajs/core-flows";
|
||||||
|
|
||||||
|
const HANDLE = "honig-balsamico-essig";
|
||||||
|
const TITEL = "Honig-Balsamico-Essig";
|
||||||
|
const KATEGORIE = { name: "Feinkost", handle: "feinkost" };
|
||||||
|
const PREIS = 12.9;
|
||||||
|
const VARIANTE = {
|
||||||
|
title: "0,25 l",
|
||||||
|
weight: 550,
|
||||||
|
metadata: { net_volume_ml: 250 },
|
||||||
|
};
|
||||||
|
|
||||||
|
const BESCHREIBUNG = [
|
||||||
|
"Honig-Balsamico-Essig aus Honig und Honig-Gärungsessig – mild-säuerlich mit feiner Honigsüße.",
|
||||||
|
"Zutaten: Honig 50 %, Honig-Gärungsessig (Wasser, Honig).",
|
||||||
|
"Essigzubereitung, enthält 2,9 % Säure. Inhalt: 0,25 l.",
|
||||||
|
"Ablagerungen sind möglich, da Naturprodukt. Bitte kühl und dunkel lagern.",
|
||||||
|
"Nährwerte je 100 ml: Brennwert 807 kJ / 193 kcal · Kohlenhydrate 46,0 g, davon Zucker 46,0 g. Enthält geringfügige Mengen an Fett, gesättigten Fettsäuren, Eiweiß und Salz.",
|
||||||
|
].join("\n\n");
|
||||||
|
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
const query = container.resolve("query");
|
||||||
|
const logger = container.resolve("logger");
|
||||||
|
|
||||||
|
let { data: kategorien } = await query.graph({
|
||||||
|
entity: "product_category",
|
||||||
|
fields: ["id", "handle", "rank"],
|
||||||
|
filters: { handle: KATEGORIE.handle },
|
||||||
|
});
|
||||||
|
if (!kategorien?.[0]) {
|
||||||
|
const { result } = await createProductCategoriesWorkflow(container).run({
|
||||||
|
input: { product_categories: [{ ...KATEGORIE, is_active: true }] },
|
||||||
|
});
|
||||||
|
kategorien = result as any;
|
||||||
|
logger.info(`Kategorie "${KATEGORIE.name}" angelegt.`);
|
||||||
|
}
|
||||||
|
const kategorieId = kategorien[0].id;
|
||||||
|
|
||||||
|
const lesen = async () =>
|
||||||
|
(
|
||||||
|
await query.graph({
|
||||||
|
entity: "product",
|
||||||
|
fields: ["id", "metadata", "variants.id"],
|
||||||
|
filters: { handle: HANDLE },
|
||||||
|
})
|
||||||
|
).data?.[0];
|
||||||
|
|
||||||
|
let produkt = await lesen();
|
||||||
|
if (!produkt) {
|
||||||
|
// Jeweils der älteste, wie in set-kerzenbilder.ts.
|
||||||
|
const { data: profile } = await query.graph({
|
||||||
|
entity: "shipping_profile",
|
||||||
|
fields: ["id"],
|
||||||
|
pagination: { order: { created_at: "ASC" } },
|
||||||
|
});
|
||||||
|
const { data: kanaele } = await query.graph({
|
||||||
|
entity: "sales_channel",
|
||||||
|
fields: ["id"],
|
||||||
|
pagination: { order: { created_at: "ASC" } },
|
||||||
|
});
|
||||||
|
await createProductsWorkflow(container).run({
|
||||||
|
input: {
|
||||||
|
products: [
|
||||||
|
{
|
||||||
|
title: TITEL,
|
||||||
|
handle: HANDLE,
|
||||||
|
status: "published" as any,
|
||||||
|
description: BESCHREIBUNG,
|
||||||
|
shipping_profile_id: profile?.[0]?.id,
|
||||||
|
sales_channels: kanaele?.[0] ? [{ id: kanaele[0].id }] : undefined,
|
||||||
|
category_ids: [kategorieId],
|
||||||
|
metadata: { category: KATEGORIE.name, delivery_time: "2-3 Werktage" },
|
||||||
|
options: [{ title: "Inhalt", values: [VARIANTE.title] }],
|
||||||
|
variants: [
|
||||||
|
{
|
||||||
|
...VARIANTE,
|
||||||
|
options: { Inhalt: VARIANTE.title },
|
||||||
|
manage_inventory: false,
|
||||||
|
prices: [{ amount: PREIS, currency_code: "eur" }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
} as any,
|
||||||
|
});
|
||||||
|
logger.info(`"${TITEL}" angelegt.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await updateProductsWorkflow(container).run({
|
||||||
|
input: {
|
||||||
|
selector: { id: produkt.id },
|
||||||
|
update: {
|
||||||
|
title: TITEL,
|
||||||
|
description: BESCHREIBUNG,
|
||||||
|
category_ids: [kategorieId],
|
||||||
|
metadata: { ...(produkt.metadata ?? {}), category: KATEGORIE.name },
|
||||||
|
},
|
||||||
|
} as any,
|
||||||
|
});
|
||||||
|
for (const v of produkt.variants ?? []) {
|
||||||
|
await updateProductVariantsWorkflow(container).run({
|
||||||
|
input: {
|
||||||
|
selector: { id: v.id },
|
||||||
|
update: { ...VARIANTE, prices: [{ amount: PREIS, currency_code: "eur" }] },
|
||||||
|
} as any,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
logger.info(`"${TITEL}" aktualisiert.`);
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* Neue Beschreibungen für die Honigsorten (Texte vom Team, November 2026).
|
||||||
|
*
|
||||||
|
* npx medusa exec ./src/scripts/set-honigtexte.ts
|
||||||
|
*
|
||||||
|
* Gefunden wird über ein Stichwort im Titel, nicht über den Handle: einige
|
||||||
|
* Handles stammen aus kopierten Produkten und passen nicht zur Sorte
|
||||||
|
* (der Kornblumenhonig heißt dort "heidehonig-…-kopie").
|
||||||
|
*
|
||||||
|
* Buchweizenhonig und das Probierset bleiben, wie sie sind.
|
||||||
|
* Wiederholbar: setzt nur Zielwerte.
|
||||||
|
*/
|
||||||
|
import { updateProductsWorkflow } from "@medusajs/core-flows";
|
||||||
|
|
||||||
|
const TEXTE: { stichwort: string; text: string }[] = [
|
||||||
|
{
|
||||||
|
stichwort: "presshonig",
|
||||||
|
text: "Traditionelles Handwerk im Glas: Unser Traditionshonig wird durch das Pressen der Honigwaben gewonnen. Diese ursprüngliche Art der Honigernte macht ihn zu einer besonderen Entdeckung für Honigliebhaber – zum puren Genießen oder auf einer frischen Scheibe Brot.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "waldhonig",
|
||||||
|
text: "Dunkel, kräftig und malzig-würzig: Waldhonig verdankt seinen besonderen Charakter vor allem dem Honigtau der Bäume. Seine intensive Aromatik passt wunderbar zu rustikalem Brot, kräftigem Käse und herzhaften Dressings.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "kornblumenhonig",
|
||||||
|
text: "Kleine blaue Blüte, ausdrucksstarker Honig: Kornblumenhonig überrascht mit einem kräftigen, blumig-würzigen Aroma und einer leicht herben Note. Für alle, die gern neue Honigsorten entdecken – besonders lecker auf kräftigem Brot oder zu Käse.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "himbeerblütenhonig",
|
||||||
|
text: "Die Himbeere kann mehr als süße Früchte: Aus dem Nektar ihrer Blüten entsteht ein feiner Honig mit blumigem Aroma und zartfruchtigen Nuancen. Eine besondere Sorte für dein Frühstück – köstlich zu Naturjoghurt, frischen Beeren oder auf einem warmen Croissant.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "heidehonig",
|
||||||
|
text: "Kräftig, würzig und mit einer feinherben Note: Heidehonig ist ein Genuss für alle, die ausdrucksstarke Aromen lieben. Sein intensiver Geschmack passt besonders gut zu dunklem Brot, gereiftem Käse oder als besondere Zutat in der Küche.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "rapshonig",
|
||||||
|
text: "Hell, mild und angenehm sanft: Rapshonig ist ein Klassiker für alle, die einen dezenten Honiggeschmack mögen. Seine zurückhaltende Süße passt wunderbar auf frisches Brot und lässt auch im Quark oder Müsli den anderen Zutaten Raum.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "sonnenblumenhonig",
|
||||||
|
text: "Ein sonniger Genussmoment: Sonnenblumenhonig verbindet eine aromatische Süße mit einer feinfrischen Note. Sein warmer, goldgelber Farbton macht schon beim Öffnen Lust aufs Probieren – auf dem Frühstücksbrot, im Joghurt oder zu einem warmen Pfannkuchen.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "akazienhonig",
|
||||||
|
text: "Zart, mild und feinblumig: Unser Akazienhonig ist ideal für alle, die eine zurückhaltende Süße lieben. Er passt wunderbar in Joghurt, zu frischem Obst oder zum Süßen von Tee, ohne andere Aromen zu überdecken.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "lindenhonig",
|
||||||
|
text: "So schmeckt der Sommer unter Hamburgs Linden: Unser Lindenhonig begeistert mit einem markanten, würzigen Aroma und einer feinfrischen, leicht minzigen Note. Ein Honig mit Charakter, der auf kräftigem Brot ebenso gut schmeckt wie zu Käse.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "frühlingsblütenhonig",
|
||||||
|
text: "Hamburger Frühling im Glas: Unser Frühlingshonig vereint die Blütenvielfalt der ersten warmen Tage mit einer milden, blumigen Süße. Ein Stück Frühling für deinen Frühstückstisch – auf frischen Brötchen, im Joghurt oder einfach pur.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stichwort: "sommerblütenhonig",
|
||||||
|
text: "Hamburger Sommer im Glas: Die Blütenvielfalt der warmen Jahreszeit verleiht unserem Sommerblütenhonig seinen aromatischen Charakter. Jede Ernte erzählt ein wenig anders vom Sommer – köstlich auf dem Frühstücksbrot, zu Joghurt oder als süße Note im Dressing.",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
const query = container.resolve("query");
|
||||||
|
const logger = container.resolve("logger");
|
||||||
|
|
||||||
|
const { data: produkte } = await query.graph({ entity: "product", fields: ["id", "title"] });
|
||||||
|
|
||||||
|
for (const { stichwort, text } of TEXTE) {
|
||||||
|
// "Presshonig Hamburger Sommerblüte" enthält kein "sommerblütenhonig",
|
||||||
|
// trotzdem nur genau ein Treffer je Sorte zulassen.
|
||||||
|
const treffer = produkte.filter((p: any) => p.title.toLowerCase().includes(stichwort));
|
||||||
|
if (treffer.length !== 1) {
|
||||||
|
logger.warn(`${stichwort}: ${treffer.length} Treffer, übersprungen.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await updateProductsWorkflow(container).run({
|
||||||
|
input: { selector: { id: treffer[0].id }, update: { description: text } } as any,
|
||||||
|
});
|
||||||
|
logger.info(`${treffer[0].title}: Text aktualisiert.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -155,7 +155,7 @@ const PRODUKTE: {
|
|||||||
beschreibung:
|
beschreibung:
|
||||||
"Honiglöffel aus Holz mit der Gravur „Honigliebe“. Die Rillen nehmen den Honig auf, " +
|
"Honiglöffel aus Holz mit der Gravur „Honigliebe“. Die Rillen nehmen den Honig auf, " +
|
||||||
"er läuft nicht vom Löffel und tropft gezielt aufs Brot oder in den Tee.",
|
"er läuft nicht vom Löffel und tropft gezielt aufs Brot oder in den Tee.",
|
||||||
preis: 4.9,
|
preis: 5.9,
|
||||||
sichtbar: true,
|
sichtbar: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* Feinschliff im Shop nach der Durchsicht vom November 2026.
|
||||||
|
*
|
||||||
|
* npx medusa exec ./src/scripts/set-shop-feinschliff.ts
|
||||||
|
*
|
||||||
|
* - Reihenfolge der Kategorien: erst alle Produkte, dann Gutschein,
|
||||||
|
* Patenschaft, Kurs und Abo.
|
||||||
|
* - Text der eigenen Honig-Seife mit Zutatenliste (INCI, bei Kosmetik
|
||||||
|
* Pflicht). Der offene Hinweis dazu am Produkt fällt weg.
|
||||||
|
* - Honiglöffel ("Honigheber") kostet 5,90 €.
|
||||||
|
*
|
||||||
|
* Wiederholbar: setzt nur Zielwerte.
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
updateProductCategoriesWorkflow,
|
||||||
|
updateProductsWorkflow,
|
||||||
|
updateProductVariantsWorkflow,
|
||||||
|
} from "@medusajs/core-flows";
|
||||||
|
|
||||||
|
const REIHENFOLGE = [
|
||||||
|
"honig",
|
||||||
|
"bienenprodukte",
|
||||||
|
"süßigkeiten-mit-honig",
|
||||||
|
"pflegeprodukte",
|
||||||
|
"feinkost",
|
||||||
|
"zubehoer",
|
||||||
|
"geschenkgutschein",
|
||||||
|
"bienenpatenschaften",
|
||||||
|
"kurse",
|
||||||
|
"abo",
|
||||||
|
];
|
||||||
|
|
||||||
|
const SEIFE = {
|
||||||
|
handle: "pflegeseife-milch-honig",
|
||||||
|
subtitle: "Handgemachte Pflegeseife mit Hamburger Stadthonig.",
|
||||||
|
description: [
|
||||||
|
"Handgemacht, Stück für Stück – mit Honig aus unserer eigenen Hamburger Imkerei.",
|
||||||
|
"Ein Stück Hamburg für deine tägliche Pflege: Unsere Seife mit eigenem Hamburger Stadthonig verbindet Ziegenmilch, Sheabutter, Kokosöl und Jojobaöl mit Calendula. Dazu ein angenehm weicher, frischer Duft – für eine kleine Auszeit am Waschbecken.",
|
||||||
|
"Von Hand hergestellt in Zusammenarbeit mit der Manufaktur Meerseifen Timmendorf.",
|
||||||
|
"Inhaltsstoffe: Aqua (Wasser), Butyrospermum Parkii Butter (Shea Butter), Cocos Nucifera Oil (Kokosnußöl), Brassica Napus Seed Oil (Rapsöl), Oryza Sativa Germ Oil (Reiskeimöl), Sodium Hydroxide (Natriumhydroxid), Simmondsia Chinensis Seed Oil (Jojobaöl mit Calendulablütenauszug), Parfum (ätherisches Öl) Citrus Sinensis Peel Oil, Mel (Honig), Caprae Lac (Ziegenmilch), Maris Sal (Meersalz), CI77492 (Eisenoxid, gelb), Limonene.",
|
||||||
|
"Frischgewicht: 100 g",
|
||||||
|
].join("\n\n"),
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ({ container }: any) {
|
||||||
|
const query = container.resolve("query");
|
||||||
|
const logger = container.resolve("logger");
|
||||||
|
|
||||||
|
const { data: kategorien } = await query.graph({
|
||||||
|
entity: "product_category",
|
||||||
|
fields: ["id", "handle", "rank", "parent_category_id"],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Der Reihe nach auf Platz 0, 1, 2 … setzen. Medusa schiebt die übrigen
|
||||||
|
// Geschwister dabei weiter, am Ende stimmt die Reihenfolge.
|
||||||
|
let platz = 0;
|
||||||
|
for (const handle of REIHENFOLGE) {
|
||||||
|
const kategorie = kategorien.find((k: any) => k.handle === handle && !k.parent_category_id);
|
||||||
|
if (!kategorie) {
|
||||||
|
logger.warn(`Keine Kategorie ${handle}.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (kategorie.rank !== platz) {
|
||||||
|
await updateProductCategoriesWorkflow(container).run({
|
||||||
|
input: { selector: { id: kategorie.id }, update: { rank: platz } },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
platz++;
|
||||||
|
}
|
||||||
|
logger.info("Kategorien neu sortiert.");
|
||||||
|
|
||||||
|
const { data: produkte } = await query.graph({
|
||||||
|
entity: "product",
|
||||||
|
fields: ["id"],
|
||||||
|
filters: { handle: SEIFE.handle },
|
||||||
|
});
|
||||||
|
if (produkte?.[0]) {
|
||||||
|
await updateProductsWorkflow(container).run({
|
||||||
|
input: {
|
||||||
|
selector: { id: produkte[0].id },
|
||||||
|
update: {
|
||||||
|
subtitle: SEIFE.subtitle,
|
||||||
|
description: SEIFE.description,
|
||||||
|
// Leerer Wert entfernt den Schlüssel.
|
||||||
|
metadata: { offen: "" },
|
||||||
|
},
|
||||||
|
} as any,
|
||||||
|
});
|
||||||
|
logger.info("Text der Honig-Seife aktualisiert.");
|
||||||
|
} else {
|
||||||
|
logger.warn(`Kein Produkt mit Handle ${SEIFE.handle}.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data: loeffel } = await query.graph({
|
||||||
|
entity: "product",
|
||||||
|
fields: ["id", "variants.id"],
|
||||||
|
filters: { handle: "honigdipper" },
|
||||||
|
});
|
||||||
|
for (const v of loeffel?.[0]?.variants ?? []) {
|
||||||
|
await updateProductVariantsWorkflow(container).run({
|
||||||
|
input: { selector: { id: v.id }, update: { prices: [{ amount: 5.9, currency_code: "eur" }] } } as any,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (loeffel?.[0]) logger.info("Honiglöffel: 5,90 €.");
|
||||||
|
}
|
||||||
@@ -7,6 +7,19 @@ export function formatGrundpreis(amount: number, netWeightGrams: number): string
|
|||||||
return `${formatEUR(perKg)}/kg`;
|
return `${formatEUR(perKg)}/kg`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grundpreis aus den Metadaten einer Variante: je Kilogramm bei
|
||||||
|
* `net_weight_grams`, je Liter bei `net_volume_ml` (z. B. Essig).
|
||||||
|
*/
|
||||||
|
export function grundpreisAus(
|
||||||
|
amount: number,
|
||||||
|
metadata?: { net_weight_grams?: number; net_volume_ml?: number } | null
|
||||||
|
): string | null {
|
||||||
|
if (metadata?.net_weight_grams) return formatGrundpreis(amount, metadata.net_weight_grams);
|
||||||
|
if (metadata?.net_volume_ml) return `${formatEUR((amount / metadata.net_volume_ml) * 1000)}/l`;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wie formatEUR, aber ohne "‚00" bei glatten Beträgen — "60 €" statt
|
* Wie formatEUR, aber ohne "‚00" bei glatten Beträgen — "60 €" statt
|
||||||
* "60,00 €". Für Angaben wie die Versandfreigrenze, die immer rund ist.
|
* "60,00 €". Für Angaben wie die Versandfreigrenze, die immer rund ist.
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ export interface MedusaVariant {
|
|||||||
calculated_price?: { calculated_amount: number; currency_code: string };
|
calculated_price?: { calculated_amount: number; currency_code: string };
|
||||||
metadata?: {
|
metadata?: {
|
||||||
net_weight_grams?: number;
|
net_weight_grams?: number;
|
||||||
|
/** Füllmenge in Millilitern bei Flüssigkeiten; Grundpreis dann je Liter. */
|
||||||
|
net_volume_ml?: number;
|
||||||
/** Nur am Abo-Produkt: "monthly" | "quarterly" | "biannual". */
|
/** Nur am Abo-Produkt: "monthly" | "quarterly" | "biannual". */
|
||||||
subscription_interval?: string;
|
subscription_interval?: string;
|
||||||
/** Nur am Abo-Produkt: Glasgröße, z. B. "250 Gramm". */
|
/** Nur am Abo-Produkt: Glasgröße, z. B. "250 Gramm". */
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export interface Variety {
|
|||||||
match: string;
|
match: string;
|
||||||
/** Sortenname laut Briefing. */
|
/** Sortenname laut Briefing. */
|
||||||
name: string;
|
name: string;
|
||||||
/** Subline laut Briefing. Fehlt im Briefing bei Himbeerblütenhonig. */
|
/** Subline laut Briefing. */
|
||||||
subline?: string;
|
subline?: string;
|
||||||
collection: Collection;
|
collection: Collection;
|
||||||
/**
|
/**
|
||||||
@@ -86,8 +86,8 @@ export const varieties: Variety[] = [
|
|||||||
{ match: "akazienhonig", name: "Akazienhonig", subline: "Mild. Klar. Elegant.", collection: "country", color: FARBWELT.stone },
|
{ match: "akazienhonig", name: "Akazienhonig", subline: "Mild. Klar. Elegant.", collection: "country", color: FARBWELT.stone },
|
||||||
{ match: "sonnenblumenhonig", name: "Sonnenblumenhonig", subline: "Gute Laune pur", collection: "country", color: FARBWELT.apricot },
|
{ match: "sonnenblumenhonig", name: "Sonnenblumenhonig", subline: "Gute Laune pur", collection: "country", color: FARBWELT.apricot },
|
||||||
{ match: "waldhonig", name: "Waldhonig", subline: "Die Kraft des Waldes", collection: "country", color: FARBWELT.forest },
|
{ match: "waldhonig", name: "Waldhonig", subline: "Die Kraft des Waldes", collection: "country", color: FARBWELT.forest },
|
||||||
// Im Briefing ohne Subline — hier bewusst leer statt erfunden.
|
// Im Briefing ohne Subline; ergänzt nach Rückmeldung, Wortlaut noch offen.
|
||||||
{ match: "himbeerblütenhonig", name: "Himbeerblütenhonig", collection: "country", color: FARBWELT.rust },
|
{ match: "himbeerblütenhonig", name: "Himbeerblütenhonig", subline: "Fruchtig. Fein. Selten.", collection: "country", color: FARBWELT.rust },
|
||||||
{ match: "heidehonig", name: "Heidehonig", subline: "Der Charakter des Nordens", collection: "country", color: FARBWELT.heather },
|
{ match: "heidehonig", name: "Heidehonig", subline: "Der Charakter des Nordens", collection: "country", color: FARBWELT.heather },
|
||||||
{ match: "kornblumenhonig", name: "Kornblumenhonig", subline: "Zwischen Himmel und Kornfeld", collection: "country", color: FARBWELT.cornflower },
|
{ match: "kornblumenhonig", name: "Kornblumenhonig", subline: "Zwischen Himmel und Kornfeld", collection: "country", color: FARBWELT.cornflower },
|
||||||
// Das Briefing nennt die Sorte "Traditionshonig", im Katalog heißt sie
|
// Das Briefing nennt die Sorte "Traditionshonig", im Katalog heißt sie
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ const standorte = automaten.map((automat, i) => ({
|
|||||||
>
|
>
|
||||||
<PageHero
|
<PageHero
|
||||||
label="Rund um die Uhr"
|
label="Rund um die Uhr"
|
||||||
title="Honig aus dem Automaten"
|
title="Lust auf Honig & Co.? Jetzt 10x in Hamburg!"
|
||||||
lede="Acht Automaten in Hamburg, jeden Tag geöffnet. Kein Ladenschluss, keine Schlange — Glas ziehen und mitnehmen."
|
lede="Ab sofort gibt es alle unsere Produkte in unseren eigenen PLACE4BEES Honigautomaten in Hamburg. Jeden Tag geöffnet, kein Ladenschluss, keine Schlange — Glas ziehen und mitnehmen."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<section class="brand-section bg-brand-surface py-[var(--section-y)]">
|
<section class="brand-section bg-brand-surface py-[var(--section-y)]">
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export const GET: APIRoute = async () => {
|
|||||||
<g:brand>PLACE4BEES</g:brand>
|
<g:brand>PLACE4BEES</g:brand>
|
||||||
<g:identifier_exists>no</g:identifier_exists>
|
<g:identifier_exists>no</g:identifier_exists>
|
||||||
${variante.metadata?.net_weight_grams ? `<g:unit_pricing_measure>${variante.metadata.net_weight_grams} g</g:unit_pricing_measure>\n <g:unit_pricing_base_measure>1000 g</g:unit_pricing_base_measure>` : ""}
|
${variante.metadata?.net_weight_grams ? `<g:unit_pricing_measure>${variante.metadata.net_weight_grams} g</g:unit_pricing_measure>\n <g:unit_pricing_base_measure>1000 g</g:unit_pricing_base_measure>` : ""}
|
||||||
|
${variante.metadata?.net_volume_ml ? `<g:unit_pricing_measure>${variante.metadata.net_volume_ml} ml</g:unit_pricing_measure>\n <g:unit_pricing_base_measure>1 l</g:unit_pricing_base_measure>` : ""}
|
||||||
<g:google_product_category>424</g:google_product_category>
|
<g:google_product_category>424</g:google_product_category>
|
||||||
</item>`
|
</item>`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import SubscriptionOptions from "../../components/SubscriptionOptions.astro";
|
|||||||
import SponsorshipOptions from "../../components/SponsorshipOptions.astro";
|
import SponsorshipOptions from "../../components/SponsorshipOptions.astro";
|
||||||
import GiftVoucherOptions from "../../components/GiftVoucherOptions.astro";
|
import GiftVoucherOptions from "../../components/GiftVoucherOptions.astro";
|
||||||
import { getProductByHandle, getDefaultRegion, listHoneyVarieties, getShopSettings, getGiftShippingSurcharge } from "../../lib/medusa";
|
import { getProductByHandle, getDefaultRegion, listHoneyVarieties, getShopSettings, getGiftShippingSurcharge } from "../../lib/medusa";
|
||||||
import { formatEUR, formatEURKurz, formatGrundpreis } from "../../lib/format";
|
import { formatEUR, formatEURKurz, grundpreisAus } from "../../lib/format";
|
||||||
import { findVariety, COLLECTION_LABELS } from "../../lib/varieties";
|
import { findVariety, COLLECTION_LABELS } from "../../lib/varieties";
|
||||||
import { PRIMARY_DOMAIN } from "../../lib/sections";
|
import { PRIMARY_DOMAIN } from "../../lib/sections";
|
||||||
|
|
||||||
@@ -24,9 +24,8 @@ const infoByVariant = Object.fromEntries(
|
|||||||
variant.id,
|
variant.id,
|
||||||
{
|
{
|
||||||
price: variant.calculated_price ? formatEUR(variant.calculated_price.calculated_amount) : "",
|
price: variant.calculated_price ? formatEUR(variant.calculated_price.calculated_amount) : "",
|
||||||
grundpreis:
|
grundpreis: variant.calculated_price
|
||||||
variant.calculated_price && variant.metadata?.net_weight_grams
|
? grundpreisAus(variant.calculated_price.calculated_amount, variant.metadata)
|
||||||
? formatGrundpreis(variant.calculated_price.calculated_amount, variant.metadata.net_weight_grams)
|
|
||||||
: null,
|
: null,
|
||||||
// Only set in the Medusa admin per variant (Produkt → Variante →
|
// Only set in the Medusa admin per variant (Produkt → Variante →
|
||||||
// Bild) — most variants don't have one yet, so the gallery simply
|
// Bild) — most variants don't have one yet, so the gallery simply
|
||||||
@@ -50,6 +49,9 @@ const isSponsorship = Boolean(product.metadata?.sponsorship);
|
|||||||
// Der Geschenkgutschein kommt per E-Mail: kein Versand, keine Lieferzeit,
|
// Der Geschenkgutschein kommt per E-Mail: kein Versand, keine Lieferzeit,
|
||||||
// dafür wahlweise die Adresse des Beschenkten.
|
// dafür wahlweise die Adresse des Beschenkten.
|
||||||
const isGiftVoucher = Boolean(product.metadata?.gift_voucher);
|
const isGiftVoucher = Boolean(product.metadata?.gift_voucher);
|
||||||
|
// Beim Kurs wird nichts verschickt und nichts abgefüllt.
|
||||||
|
const isCourse = categoryName === "Kurse";
|
||||||
|
const ohneVersand = isGiftVoucher || isCourse;
|
||||||
const honeyVarieties = isSubscription ? await listHoneyVarieties(region.id) : [];
|
const honeyVarieties = isSubscription ? await listHoneyVarieties(region.id) : [];
|
||||||
|
|
||||||
// Beim Geschenk-Abo: ob jedes Paket seinen Versand trägt. Steht als
|
// Beim Geschenk-Abo: ob jedes Paket seinen Versand trägt. Steht als
|
||||||
@@ -208,7 +210,7 @@ const brotkrumenDaten = {
|
|||||||
{/* Die Eckdaten standen bisher als Tabelle unter dem Kaufknopf und
|
{/* Die Eckdaten standen bisher als Tabelle unter dem Kaufknopf und
|
||||||
damit hinter der Entscheidung. Jetzt stehen sie davor. */}
|
damit hinter der Entscheidung. Jetzt stehen sie davor. */}
|
||||||
<ul class="eckdaten mt-8">
|
<ul class="eckdaten mt-8">
|
||||||
{freeShippingThreshold != null && !isGiftVoucher && (
|
{freeShippingThreshold != null && !ohneVersand && (
|
||||||
<li>
|
<li>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
||||||
<circle cx="12" cy="12" r="9" />
|
<circle cx="12" cy="12" r="9" />
|
||||||
@@ -235,7 +237,7 @@ const brotkrumenDaten = {
|
|||||||
Restguthaben bleibt erhalten
|
Restguthaben bleibt erhalten
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
{deliveryTime && !isGiftVoucher && (
|
{deliveryTime && !ohneVersand && (
|
||||||
<li>
|
<li>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
||||||
<rect x="1" y="6" width="14" height="11" rx="1.5" />
|
<rect x="1" y="6" width="14" height="11" rx="1.5" />
|
||||||
@@ -253,6 +255,7 @@ const brotkrumenDaten = {
|
|||||||
</svg>
|
</svg>
|
||||||
Regional aus Hamburg
|
Regional aus Hamburg
|
||||||
</li>
|
</li>
|
||||||
|
{!ohneVersand && (
|
||||||
<li>
|
<li>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
|
||||||
<path d="M12 20c0-6 3.5-9.5 8-10-.5 6-4 9.5-8 10z" stroke-linejoin="round" />
|
<path d="M12 20c0-6 3.5-9.5 8-10-.5 6-4 9.5-8 10z" stroke-linejoin="round" />
|
||||||
@@ -261,6 +264,7 @@ const brotkrumenDaten = {
|
|||||||
</svg>
|
</svg>
|
||||||
Nachhaltig, von Hand abgefüllt
|
Nachhaltig, von Hand abgefüllt
|
||||||
</li>
|
</li>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export const prerender = false;
|
|||||||
|
|
||||||
import Layout from "../../layouts/Layout.astro";
|
import Layout from "../../layouts/Layout.astro";
|
||||||
import { listProducts, getDefaultRegion } from "../../lib/medusa";
|
import { listProducts, getDefaultRegion } from "../../lib/medusa";
|
||||||
import { formatEUR, formatGrundpreis } from "../../lib/format";
|
import { formatEUR, grundpreisAus } from "../../lib/format";
|
||||||
import { CLAIM } from "../../lib/sections";
|
import { CLAIM } from "../../lib/sections";
|
||||||
import {
|
import {
|
||||||
findVariety,
|
findVariety,
|
||||||
@@ -42,9 +42,9 @@ function priceLabel(product: (typeof products)[number]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function grundpreisLabel(product: (typeof products)[number]) {
|
function grundpreisLabel(product: (typeof products)[number]) {
|
||||||
const variant = product.variants.find((v) => v.metadata?.net_weight_grams);
|
const variant = product.variants.find((v) => v.metadata?.net_weight_grams || v.metadata?.net_volume_ml);
|
||||||
if (!variant?.calculated_price || !variant.metadata?.net_weight_grams) return null;
|
if (!variant?.calculated_price) return null;
|
||||||
return formatGrundpreis(variant.calculated_price.calculated_amount, variant.metadata.net_weight_grams);
|
return grundpreisAus(variant.calculated_price.calculated_amount, variant.metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -239,7 +239,11 @@ const groups = [
|
|||||||
{/* Der kurze Sortenname aus dem Briefing statt des vollen
|
{/* Der kurze Sortenname aus dem Briefing statt des vollen
|
||||||
Katalogtitels — der beschreibende Teil steht darunter. */}
|
Katalogtitels — der beschreibende Teil steht darunter. */}
|
||||||
<h3 class="shop-karte-titel">{varietyName(product.title)}</h3>
|
<h3 class="shop-karte-titel">{varietyName(product.title)}</h3>
|
||||||
{variety?.subline && <p class="shop-karte-unterzeile">{variety.subline}</p>}
|
{/* Ohne Sorte der Untertitel aus Medusa — so steht z. B. bei der
|
||||||
|
eigenen Seife „handgemacht" direkt neben der Fertigware. */}
|
||||||
|
{(variety?.subline ?? product.subtitle) && (
|
||||||
|
<p class="shop-karte-unterzeile">{variety?.subline ?? product.subtitle}</p>
|
||||||
|
)}
|
||||||
{price && <p class="shop-karte-preis">{price}</p>}
|
{price && <p class="shop-karte-preis">{price}</p>}
|
||||||
{grundpreis && <p class="shop-karte-grundpreis">{grundpreis}</p>}
|
{grundpreis && <p class="shop-karte-grundpreis">{grundpreis}</p>}
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Reference in New Issue
Block a user