Compare commits

...
Author SHA1 Message Date
LarsandClaude Sonnet 5.5 6160e95d57 Merge remote-tracking branch 'origin/develop' into feature/shop-aufraeumen
CI Feature / test (push) In progress
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-26 09:25:08 +01:00
LarsandClaude Sonnet 5.5 f0ffb47210 Biete in der Shopliste Auswahl, Reihenfolge, Listenansicht und Seiten
CI Feature / test (push) Successful in 6m4s
- ShopCatalog::listing mit Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Ansicht und Seiten
- Listenansicht shop/zeile, gemeinsame Liste fuer Shopseite und Widget (Variante Liste, Einstellung Auswahl fuer Besucher)
- Werte aus dem Abfragetext werden gegen vorhandene Werte geprueft, Felder als Liste und Zahlen ausserhalb des Bereichs sind harmlos
- Suchfeld heisst nach dem Umbau Zurücksetzen statt Suche zuruecksetzen (Test bewusst angepasst)
- ADR-57

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-26 08:35:33 +01:00
15 changed files with 651 additions and 73 deletions

No files matched your search

@@ -79,6 +79,7 @@ public function variants(): array
{
return [
'kacheln' => 'Kacheln mit Bild',
'liste' => 'Liste mit kleinem Bild',
];
}
@@ -88,6 +89,7 @@ public function settings(): array
'sort' => ['name' => 'Alphabetisch', 'neu' => 'Neueste zuerst', 'preis' => 'Preis aufsteigend'],
'limit' => ['alle' => 'Alle Produkte', 'n3' => '3 Produkte', 'n6' => '6 Produkte', 'n9' => '9 Produkte', 'n12' => '12 Produkte', 'n24' => '24 Produkte'],
'search' => ['aus' => 'Ohne Suchfeld', 'an' => 'Mit Suchfeld'],
'filter' => ['aus' => 'Ohne Auswahl', 'an' => 'Mit Suche, Auswahl, Ansicht und Seiten'],
];
}
@@ -96,13 +98,14 @@ public function settingLabels(): array
return [
'sort' => ['Reihenfolge', 'Ohne Wahl gilt die Reihenfolge der Shopseite: Altbestand, Artikel, Pakete.'],
'limit' => ['Anzahl', 'Wie viele Produkte höchstens erscheinen. Ohne Wahl erscheinen alle.'],
'search' => ['Suchfeld', 'Ein Suchfeld über den Kacheln. Es wirkt auf der Shopseite; auf anderen Seiten führt die Suche in den Shop.'],
'search' => ['Suchfeld', 'Ein einfaches Suchfeld über den Kacheln. Es sendet an die Seite, auf der das Widget steht.'],
'filter' => ['Auswahl für Besucher', 'Suche, Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Umschalter Kacheln und Liste und Seiten. Sinnvoll auf der Shopseite mit vielen Produkten. Ersetzt das einfache Suchfeld und die Einstellung „Anzahl“.'],
];
}
public function settingGroups(): array
{
return ['Auswahl' => ['sort', 'limit', 'search']];
return ['Auswahl' => ['sort', 'limit', 'search', 'filter']];
}
public function dataRules(): array
@@ -165,21 +168,28 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
public function resolve(array $widget, RenderContext $context): array
{
if (! Shop::visible()) {
return ['cards' => [], 'term' => '', 'shopVisible' => false];
return ['listing' => null, 'cards' => [], 'term' => '', 'shopVisible' => false];
}
$settings = is_array($widget['settings'] ?? null) ? $widget['settings'] : [];
$filters = ($settings['filter'] ?? 'aus') === 'an';
$search = ($settings['search'] ?? 'aus') === 'an';
$term = $search && ! $context->preview ? trim((string) request()->query('suche', '')) : '';
$limit = preg_match('/^n(\d+)$/', (string) ($settings['limit'] ?? ''), $match) === 1 ? (int) $match[1] : null;
$limit = preg_match('/^n(\\d+)$/', (string) ($settings['limit'] ?? ''), $match) === 1 ? (int) $match[1] : null;
$query = $context->preview ? [] : request()->query();
$term = ($search || $filters) && isset($query['suche']) && is_string($query['suche']) ? mb_substr(trim($query['suche']), 0, 100) : '';
$fixed = [
'pillar' => $widget['data']['pillar'] ?? null,
'kind' => $widget['data']['kind'] ?? null,
'sort' => $settings['sort'] ?? null,
'limit' => $filters ? null : $limit,
'view' => ($widget['variant'] ?? 'kacheln') === 'liste' ? 'liste' : 'kacheln',
'filters' => $filters,
];
$listing = app(ShopCatalog::class)->listing($filters ? $query : ['suche' => $term], $fixed);
return [
'cards' => app(ShopCatalog::class)->cards($term, [
'pillar' => $widget['data']['pillar'] ?? null,
'kind' => $widget['data']['kind'] ?? null,
'sort' => $settings['sort'] ?? null,
'limit' => $limit,
]),
'listing' => $listing,
'cards' => $listing['cards'],
'term' => $term,
'shopVisible' => true,
];
+6 -4
View File
@@ -210,7 +210,7 @@ private function optionsFor(string $key): array
/**
* Günstigster Preis und Zahl der Optionen je Seite einer Art ('a', 'b' oder 'c'): Kennung => Zusammenfassung.
*
* @return array<int, array{from_cents: int, count: int}>
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
*/
private function summariesOf(string $kind): array
{
@@ -224,6 +224,8 @@ private function summariesOf(string $kind): array
$summary[(int) substr($key, 2)] = [
'from_cents' => min(array_map(fn (array $row): int => (int) $row['version']->price_cents, $rows)),
'count' => count($rows),
'holders' => array_values(array_unique(array_map(fn (array $row): string => (string) $row['version']->holder_kind, $rows))),
'scopes' => array_values(array_unique(array_filter(array_map(fn (array $row): ?string => $row['version']->licence_scope, $rows)))),
];
}
@@ -233,7 +235,7 @@ private function summariesOf(string $kind): array
/**
* Artikel mit kaufbarer Option: Artikelkennung => günstigster Preis und Zahl der Optionen.
*
* @return array<int, array{from_cents: int, count: int}>
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
*/
public function articleSummaries(): array
{
@@ -243,7 +245,7 @@ public function articleSummaries(): array
/**
* Pakete mit kaufbarer Option: Paketkennung => günstigster Preis und Zahl der Optionen.
*
* @return array<int, array{from_cents: int, count: int}>
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
*/
public function bundleSummaries(): array
{
@@ -253,7 +255,7 @@ public function bundleSummaries(): array
/**
* Altbestand: Programmseiten mit kaufbaren Optionen (Angebote mit mehreren Positionen).
*
* @return array<int, array{from_cents: int, count: int}>
* @return array<int, array{from_cents: int, count: int, holders: list<string>, scopes: list<string>}>
*/
public function summaries(): array
{
+140 -11
View File
@@ -6,6 +6,7 @@
use App\Domain\Catalog\Composition;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\FormattedText;
use App\Domain\Catalog\LicenceScope;
use App\Domain\Catalog\LicenseArticle;
use App\Domain\Catalog\Pillar;
use App\Domain\Catalog\PresentationMedia;
@@ -37,11 +38,21 @@ public function __construct(
public const SORTS = ['name' => 'Alphabetisch', 'neu' => 'Neueste zuerst', 'preis' => 'Preis aufsteigend'];
/**
* @param array{pillar?: int|null, kind?: int|null, sort?: string|null, limit?: int|null} $options Filter nach Säule
* und Materialart, Sortierung (name, neu, preis) und Höchstzahl
* @param array{pillar?: int|null, kind?: int|null, holder?: string|null, scope?: string|null, sort?: string|null, limit?: int|null} $options Filter
* nach Säule, Materialart, Eignung und Nutzerkreis, Sortierung (name, neu, preis) und Höchstzahl
* @return list<array<string, mixed>>
*/
public function cards(string $term = '', array $options = []): array
{
return $this->arrange($this->all($term), $options);
}
/**
* Alle Kacheln zu einem Suchbegriff, ungefiltert und in der Reihenfolge der Quellen.
*
* @return list<array<string, mixed>>
*/
public function all(string $term = ''): array
{
$term = mb_strtolower(mb_substr(trim($term), 0, 100));
$cards = [];
@@ -56,10 +67,13 @@ public function cards(string $term = '', array $options = []): array
$title = (string) ($composition->display_title ?: $composition->designation);
$teaser = (string) ($composition->teaser ?: FormattedText::plain($composition->summary));
$pillars = $this->pillarNames($composition->pillars);
$pillarMap = $this->publishedPillars($composition->pillars);
$pillars = array_values($pillarMap);
$card = $this->card('c:'.$composition->id, 'programm', route('public.program', $composition), $title, $teaser, $summaries[$composition->id], 'Programm', null, $pillars, [], $this->image($composition));
$card['pillar_ids'] = $composition->pillars->pluck('id')->map(fn ($id): int => (int) $id)->all();
$card['pillar_ids'] = array_keys($pillarMap);
$card['kind_id'] = $composition->editorial_content_kind_id !== null ? (int) $composition->editorial_content_kind_id : null;
$card['holders'] = $summaries[$composition->id]['holders'] ?? [];
$card['scopes'] = $summaries[$composition->id]['scopes'] ?? [];
if ($this->matches($term, $title.' '.$teaser.' '.FormattedText::plain($composition->summary).' '.$composition->search_terms.' '.implode(' ', $pillars))) {
$cards[] = $card;
@@ -74,15 +88,18 @@ public function cards(string $term = '', array $options = []): array
$title = $this->products->articleTitle($article);
$teaser = (string) ($profile->value('teaser') ?: $profile->value('summary'));
$kind = $article->editorialContentKind;
$pillars = $this->pillarNames($article->pillars);
$pillarMap = $this->publishedPillars($article->pillars);
$pillars = array_values($pillarMap);
$offerIds = array_map(fn ($offer): int => (int) $offer->id, $this->products->offersOfArticle($article));
$card = $this->card(
'a:'.$article->id, 'artikel', route('shop.article', $article), $title, $teaser, $articleSummaries[$article->id],
(string) ($kind?->label ?? ''), $this->symbol($kind?->symbol), $pillars, $this->markers->visible($article, $offerIds), $this->image($article),
);
$card['pillar_ids'] = $article->pillars->pluck('id')->map(fn ($id): int => (int) $id)->all();
$card['pillar_ids'] = array_keys($pillarMap);
$card['kind_id'] = $kind !== null ? (int) $kind->id : null;
$card['since'] = $this->markers->firstOffered($offerIds)?->getTimestamp() ?? 0;
$card['holders'] = $articleSummaries[$article->id]['holders'] ?? [];
$card['scopes'] = $articleSummaries[$article->id]['scopes'] ?? [];
if ($this->matches($term, $title.' '.$teaser.' '.$profile->value('summary').' '.$profile->searchTerms.' '.($kind?->label ?? '').' '.implode(' ', $pillars))) {
$cards[] = $card;
@@ -97,13 +114,15 @@ public function cards(string $term = '', array $options = []): array
$names = implode(', ', array_column($contents, 'title'));
$teaser = 'Paket mit '.count($contents).' '.(count($contents) === 1 ? 'Inhalt' : 'Inhalten').($names !== '' ? ': '.$names : '');
$card = $this->card('b:'.$bundle->id, 'paket', route('public.package', $bundle), (string) $bundle->name, $teaser, $bundleSummaries[$bundle->id], 'Paket', null, [], [], $this->image($bundle));
$card['holders'] = $bundleSummaries[$bundle->id]['holders'] ?? [];
$card['scopes'] = $bundleSummaries[$bundle->id]['scopes'] ?? [];
if ($this->matches($term, $bundle->name.' '.$names)) {
$cards[] = $card;
}
}
return $this->arrange($cards, $options);
return $cards;
}
/**
@@ -114,7 +133,7 @@ public function cards(string $term = '', array $options = []): array
* @param array<string, mixed> $options
* @return list<array<string, mixed>>
*/
private function arrange(array $cards, array $options): array
public function arrange(array $cards, array $options): array
{
$pillar = isset($options['pillar']) ? (int) $options['pillar'] : 0;
$kind = isset($options['kind']) ? (int) $options['kind'] : 0;
@@ -127,6 +146,17 @@ private function arrange(array $cards, array $options): array
$cards = array_filter($cards, fn (array $card): bool => ($card['kind_id'] ?? null) === $kind);
}
$holder = (string) ($options['holder'] ?? '');
$scope = (string) ($options['scope'] ?? '');
if ($holder !== '') {
$cards = array_filter($cards, fn (array $card): bool => in_array($holder, $card['holders'] ?? [], true));
}
if ($scope !== '') {
$cards = array_filter($cards, fn (array $card): bool => in_array($scope, $card['scopes'] ?? [], true));
}
$cards = array_values($cards);
match ($options['sort'] ?? null) {
@@ -141,6 +171,103 @@ private function arrange(array $cards, array $options): array
return $limit > 0 ? array_slice($cards, 0, $limit) : $cards;
}
public const HOLDERS = ['person' => 'Privatpersonen', 'organisation' => 'Organisationen und Vereine'];
public const SCOPES = [LicenceScope::SINGLE => 'Einzellizenz', LicenceScope::MULTI => 'Mehrfachlizenz'];
/**
* Die Auswahl, die ein Besucher bei diesen Kacheln hat: nur Werte, die es gibt, und nur Auswahlfelder mit mindestens
* zwei Werten (sonst filtert nichts).
*
* @param list<array<string, mixed>> $cards
* @return array{pillar: array<int, string>, kind: array<int, string>, holder: array<string, string>, scope: array<string, string>}
*/
public function facets(array $cards): array
{
$pillars = [];
$kinds = [];
$holders = [];
$scopes = [];
foreach ($cards as $card) {
foreach (array_values($card['pillar_ids'] ?? []) as $index => $id) {
$pillars[(int) $id] = (string) ($card['pillars'][$index] ?? '');
}
if (($card['kind_id'] ?? null) !== null && ($card['kind_label'] ?? '') !== '') {
$kinds[(int) $card['kind_id']] = (string) $card['kind_label'];
}
foreach ($card['holders'] ?? [] as $holder) {
if (isset(self::HOLDERS[$holder])) {
$holders[$holder] = self::HOLDERS[$holder];
}
}
foreach ($card['scopes'] ?? [] as $scope) {
if (isset(self::SCOPES[$scope])) {
$scopes[$scope] = self::SCOPES[$scope];
}
}
}
asort($pillars);
asort($kinds);
$facets = ['pillar' => $pillars, 'kind' => $kinds, 'holder' => $holders, 'scope' => $scopes];
return array_map(fn (array $values): array => count($values) >= 2 ? $values : [], $facets);
}
/**
* Die Produktliste für Shopseite und Widget: Suche, Auswahl des Besuchers (Säule, Materialart, Eignung,
* Nutzerkreis), Reihenfolge, Ansicht und Seiten. Alles kommt aus dem Abfragetext und wird gegen feste Werte
* geprüft; unbekannte Werte entfallen.
*
* @param array<string, mixed> $query Abfrage des Besuchers (suche, saeule, art, eignung, kreis, sort, ansicht, seite)
* @param array<string, mixed> $fixed Vorgaben der Seite (pillar, kind, sort, limit, view, filters)
* @return array<string, mixed>
*/
public function listing(array $query, array $fixed = []): array
{
$text = fn (string $key): string => isset($query[$key]) && (is_string($query[$key]) || is_int($query[$key])) ? trim((string) $query[$key]) : '';
$filters = (bool) ($fixed['filters'] ?? true);
$term = mb_substr($text('suche'), 0, 100);
$base = $this->arrange($this->all($term), array_intersect_key($fixed, ['pillar' => 1, 'kind' => 1]));
$facets = $filters ? $this->facets($base) : ['pillar' => [], 'kind' => [], 'holder' => [], 'scope' => []];
$pick = function (string $key, string $facet) use ($text, $facets, $filters): int|string|null {
$value = $text($key);
return $filters && $value !== '' && array_key_exists($value, $facets[$facet]) ? (ctype_digit($value) ? (int) $value : $value) : null;
};
$chosen = [
'pillar' => $pick('saeule', 'pillar'),
'kind' => $pick('art', 'kind'),
'holder' => $pick('eignung', 'holder'),
'scope' => $pick('kreis', 'scope'),
];
$sort = $filters && isset(self::SORTS[$text('sort')]) ? $text('sort') : ($fixed['sort'] ?? null);
$view = $filters && in_array($text('ansicht'), ['kacheln', 'liste'], true) ? $text('ansicht') : (string) ($fixed['view'] ?? 'kacheln');
$cards = $this->arrange($base, $chosen + ['sort' => $sort, 'limit' => $fixed['limit'] ?? null]);
$perPage = max(1, (int) config('shop.per_page', 12));
$pages = max(1, (int) ceil(count($cards) / $perPage));
$page = $filters ? min($pages, max(1, (int) $text('seite'))) : 1;
$shown = $filters ? array_slice($cards, ($page - 1) * $perPage, $perPage) : $cards;
return [
'cards' => $shown,
'total' => count($cards),
'page' => $page,
'pages' => $filters ? $pages : 1,
'facets' => $facets,
'chosen' => $chosen,
'sort' => $sort,
'view' => $view,
'term' => $term,
'filters' => $filters,
];
}
/**
* @param array{from_cents: int, count: int} $summary
* @param list<string> $pillars
@@ -167,6 +294,8 @@ private function card(string $key, string $kind, string $url, string $title, str
'pillar_ids' => [],
'kind_id' => null,
'since' => 0,
'holders' => [],
'scopes' => [],
];
}
@@ -179,11 +308,11 @@ private function matches(string $term, string $haystack): bool
* Nur veröffentlichte Säulen sind öffentlich (Säulenverwaltung).
*
* @param Collection<int, Pillar> $pillars
* @return list<string>
* @return array<int, string> Kennung => Name
*/
private function pillarNames(Collection $pillars): array
private function publishedPillars(Collection $pillars): array
{
return $pillars->filter(fn (Pillar $pillar): bool => $pillar->published_at !== null)->map(fn (Pillar $pillar): string => (string) $pillar->name)->values()->all();
return $pillars->filter(fn (Pillar $pillar): bool => $pillar->published_at !== null)->mapWithKeys(fn (Pillar $pillar): array => [(int) $pillar->id => (string) $pillar->name])->all();
}
/** Ein Symbol zeigt nur, was die Symbolbibliothek kennt (die Auswahl wird an der Materialart geprüft, hier noch einmal). */
+1 -3
View File
@@ -35,8 +35,6 @@ public function index(Request $request, ShopCatalog $catalog, PageController $pa
return $pages->showPage($page);
}
$term = trim((string) $request->query('suche', ''));
return view('shop.index', ['cards' => $catalog->cards($term), 'term' => $term]);
return view('shop.index', ['listing' => $catalog->listing($request->query())]);
}
}
+4
View File
@@ -33,6 +33,10 @@
'marker_days' => 30,
/* Produkte je Seite in der Shopliste (Kacheln und Liste). */
'per_page' => 12,
/*
| Kauf auf Rechnung für Vereine und Organisationen (PAY-006): auf Anfrage, Rechnung manuell durch den Betreiber.
| Standardmäßig aus: Das Mitglied sieht die Möglichkeit erst, wenn der Prozess vollständig ist (Rechnungserstellung
+1 -1
View File
@@ -28,7 +28,7 @@ ## Phasen
| 2 | Kachel und Datenquelle: ein Dienst für Liste und Widget, Titelbild über die Website-Freigabe, Säulen und Materialart als Gruppen, Symbol je Materialart, Marker | umgesetzt (ADR-54) |
| 3 | CMS: Seite „shop“ mit Abschnitten, Widget „Shop-Produkte“, Kacheln auf der Mitgliederseite (ADR-55) | umgesetzt; „Für dich“ folgt mit Phase 4 |
| 4 | Regelmodell für freie Artikel: für alle, besitzt einen Artikel, bestimmte Konten (Freigabe je Angebot und Konto, wie bei Rabattcodes), „Für dich“ | umgesetzt (ADR-56) |
| 5 | Viele Produkte: Listenansicht, Filter, Sortierung, Seiten | offen |
| 5 | Viele Produkte: Listenansicht, Filter, Sortierung, Seiten | umgesetzt (ADR-57) |
Jede Phase wird mit Tests, einer Sicherheitsdurchsicht und (bei Oberfläche) der Abnahme auf `luf-test` belegt (`docs/ux/verwaltung/abnahme/etappe-1.md`).
@@ -837,3 +837,16 @@ ## ADR-56 – Regeln für freie Artikel und „Für dich“ im Mitgliederbereich
**Nicht Teil dieses Schritts.** Keine Benachrichtigung per E-Mail bei einer Freigabe (das Konto sieht sie bei seinem nächsten Besuch); Gruppen und „Konto seit …“ als weitere Regeln; ein Ende des Abrufs je Angebot (dafür gibt es das Beenden der Fassung).
**Folgen.** Eine additive Migration (zwei Spalten an `offers`, Tabelle `offer_releases`). **Bis zum Deployment gilt weiter die Regel „alle“** für jedes Angebot auf Abruf; die Vorgabe ändert kein bestehendes Verhalten. Wer ein Angebot auf Abruf nur bestimmten Konten geben will, stellt die Regel um, bevor er es aktiviert.
**Quelle.** Anfrage von Lars vom 26.11.2026; ADR-09, ADR-47, ADR-52, ADR-55.
## ADR-57 – Shopliste für viele Produkte: Auswahl, Reihenfolge, Listenansicht und Seiten
**Status am 26.11.2026:** Umgesetzt auf `feature/shop-aufraeumen` (Phase 5 des Plans `docs/analysen/shop-umbauplan-2026-11-26.md`); Abnahme siehe `docs/ux/verwaltung/abnahme/etappe-1.md`, Abschnitt „Shopliste für viele Produkte“. Die Produktivfreigabe bleibt bei Lars.
**Kontext.** Kacheln sind für wenige Produkte übersichtlich; mit größeren Mengen wird die Shopseite unübersichtlich.
**Entscheidung (Auftrag von Lars, 26.11.2026).**
- **Eine Liste für Shopseite und Widget** (`ShopCatalog::listing`, `shop/liste.blade.php`): Suche, Auswahl nach **Thema** (veröffentlichte Säule), **Materialart**, **Eignung** (Privatpersonen, Organisationen und Vereine) und **Nutzerkreis** (Einzel- oder Mehrfachlizenz), **Reihenfolge** (alphabetisch, neueste zuerst, Preis aufsteigend), **Ansicht** (Kacheln oder Liste) und **Seiten** (`shop.per_page`, Vorgabe 12). Ein Auswahlfeld erscheint nur, wenn es mindestens zwei Werte gibt, die es bei den Produkten tatsächlich gibt.
- **Alles im Abfragetext, ohne Script.** Das Formular sendet per GET; Seiten- und Ansichtsumschalter sind Links, die die Auswahl behalten. Jeder Wert wird gegen die vorhandenen Werte geprüft; unbekannte, fehlerhafte oder als Liste gesendete Werte entfallen, nie ein Fehler. Der Suchbegriff ist auf 100 Zeichen gekürzt und maskiert; eine Seitenzahl außerhalb des Bereichs wird auf die erste oder letzte Seite gesetzt.
- **Listenansicht** (`shop/zeile.blade.php`) mit denselben Angaben wie die Kachel: kleines Bild oder Symbol, Art, Marker mit Wort, Titel als Link, Kurztext, Themen, Preis ab und Zahl der Optionen. Bei schmalem Fenster steht der Preis unter dem Text.
- **Widget.** Variante „Liste mit kleinem Bild“ und die Einstellung „Auswahl für Besucher“ (an: Suche, Auswahl, Ansicht, Seiten; aus: wie bisher mit Anzahl und einfachem Suchfeld). Festlegungen im Widget (Säule, Materialart) gelten immer und lassen sich vom Besucher nicht aufheben.
**Grenzen.** Die Kacheln werden bei jedem Aufruf aus den Fachdaten gebildet (kein Zwischenspeicher). Für die erwartete Zahl von Produkten (Dutzende bis wenige Hundert) genügt das; bei deutlich mehr wird ein Zwischenspeicher nötig. Pakete haben keine Materialart und kein Thema und erscheinen daher bei diesen Auswahlen nicht.
**Folgen.** Kein Schema, keine Migration. Die bisherige Suche der Shopseite bleibt (Feld „Shop durchsuchen“).
**Quelle.** Anfrage von Lars vom 26.11.2026; ADR-54, ADR-55.
+1 -1
View File
@@ -82,7 +82,7 @@ ## 4. Registrierte Widget-Arten
| `program_card` | Programm- oder Modulkarte, Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.composition`, `refs.image` |
| `call_to_action` | Handlungsaufruf | 1 | `standard` | 1–4 | `auto` (Vorgabe), `fill` (Abschnittshöhe füllen) | – |
| `faq` | FAQ | 1 | `standard` | 2–4 | – | – |
| `shop_products` | Shop-Produkte (Kacheln aus `ShopCatalog`, ADR-55) | 1 | `kacheln` | 2–4 | – | – (Filter `data.pillar`, `data.kind`; Einstellungen `sort`, `limit`, `search`) |
| `shop_products` | Shop-Produkte (Kacheln aus `ShopCatalog`, ADR-55, ADR-57) | 1 | `kacheln`, `liste` | 2–4 | – | – (Filter `data.pillar`, `data.kind`; Einstellungen `sort`, `limit`, `search`, `filter`) |
Darstellungsklassen an der Widget-Hülle: `widget widget-<typ> widget-variant-<variante>` und, wenn die Art Höhen anbietet, `widget-height-<höhe>`. Premium-Ansichten: `lf-hero lf-hero--{photo-split|editorial-solid} lf-hero--height-<höhe> lf-hero--accent-<akzent>` und `lf-bt lf-bt--{cream|clear|navy} lf-bt--image-{left|right} lf-bt--height-<höhe>`.
+154
View File
@@ -563,3 +563,157 @@ .shop-marker-beliebt {
border-color: var(--color-success);
color: var(--color-success);
}
/*
* Auswahl, Listenansicht und Seiten (ADR-57). Alles ohne Script bedienbar; die Auswahl steht im Abfragetext.
*/
.shop-filter {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
gap: var(--space-3) var(--space-4);
align-items: end;
max-width: none;
}
.shop-filter-field {
display: grid;
gap: var(--space-1);
}
.shop-filter-search {
grid-column: 1 / -1;
}
.shop-filter-actions {
display: flex;
flex-wrap: wrap;
gap: var(--space-2);
}
.shop-viewbar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
margin: var(--space-4) 0 0;
}
.shop-view {
display: flex;
gap: var(--space-2);
margin: 0;
}
.shop-view a {
padding: 0.2rem 0.8rem;
border: 2px solid var(--color-border-strong);
border-radius: var(--radius-pill);
text-decoration: none;
font-weight: 600;
}
.shop-view a[aria-current='true'] {
background: var(--lf-navy);
border-color: var(--lf-navy);
color: var(--lf-white);
}
.shop-rows {
list-style: none;
margin: var(--space-5) 0;
padding: 0;
display: grid;
gap: var(--space-3);
}
.shop-row {
position: relative;
display: grid;
grid-template-columns: 7rem minmax(0, 1fr) auto;
gap: var(--space-4);
align-items: center;
background: var(--color-surface-raised);
border: 1px solid var(--color-border);
border-radius: var(--radius-card);
padding: var(--space-3) var(--space-4);
}
.shop-row-media {
aspect-ratio: 16 / 9;
background: var(--color-surface-subtle);
border-radius: var(--radius-card);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.shop-row-media img {
inline-size: 100%;
block-size: 100%;
object-fit: cover;
}
.shop-row-symbol {
--sym-s: 2.5rem;
}
.shop-row-body h2 {
margin: 0 0 var(--space-1);
font-size: var(--text-h3);
}
.shop-row-body h2 a {
color: inherit;
text-decoration: none;
}
.shop-row-body h2 a:hover,
.shop-row-body h2 a:focus-visible {
text-decoration: underline;
}
.shop-row-body h2 a::after {
content: '';
position: absolute;
inset: 0;
}
.shop-row .shop-tile-kind {
flex-wrap: wrap;
}
.shop-row-price {
margin: 0;
font-weight: 700;
text-align: end;
white-space: nowrap;
}
.shop-row-price span {
display: block;
font-weight: 400;
font-size: var(--text-small);
color: var(--color-text-muted);
}
.shop-pages {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: var(--space-4);
margin: var(--space-5) 0;
}
@media (max-width: 40rem) {
.shop-row {
grid-template-columns: 4.5rem minmax(0, 1fr);
}
.shop-row-price {
grid-column: 1 / -1;
text-align: start;
}
}
+1 -22
View File
@@ -6,26 +6,5 @@
<h1>Shop</h1>
<p class="lede">Hier findest du kaufbare Produkte und Pakete. Jede Kachel öffnet die Produktseite mit Inhalt und den verfügbaren Lizenzoptionen.</p>
<form class="shop-search" method="get" action="{{ route('shop') }}" role="search">
<label for="shop-suche">Shop durchsuchen</label>
<input id="shop-suche" type="search" name="suche" value="{{ $term }}" autocomplete="off">
<button class="button" type="submit">Suchen</button>
@if ($term !== '')
<a class="button button-quiet" href="{{ route('shop') }}">Suche zurücksetzen</a>
@endif
</form>
@if ($cards === [])
<div class="empty">
<h2>{{ $term !== '' ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h2>
<p>{{ $term !== '' ? 'Zu „'.$term.'“ gibt es keine kaufbaren Produkte. Prüfe die Schreibweise oder setze die Suche zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
</div>
@else
<p class="shop-count" role="status">{{ count($cards) }} {{ count($cards) === 1 ? 'Produkt' : 'Produkte' }}</p>
<ul class="shop-tiles">
@foreach ($cards as $card)
@include('shop.kachel', ['card' => $card])
@endforeach
</ul>
@endif
@include('shop.liste', ['listing' => $listing, 'action' => route('shop'), 'uid' => 'seite'])
@endsection
+89
View File
@@ -0,0 +1,89 @@
{{--
Die Produktliste des Shops: Suche, Auswahl (Säule, Materialart, Eignung, Nutzerkreis), Reihenfolge, Ansicht und Seiten.
Parameter: $listing (ShopCatalog::listing), $action (Adresse der Seite, an die das Formular sendet), $uid (Kennung
für die Feldnamen). Die Auswahl steht im Abfragetext; ohne Script bleibt alles bedienbar.
--}}
@php
$keep = ['suche', 'saeule', 'art', 'eignung', 'kreis', 'sort', 'ansicht'];
$link = fn (array $extra): string => $action.'?'.http_build_query(array_filter(array_merge(request()->only($keep), $extra), fn ($value): bool => $value !== null && $value !== ''));
$chosen = $listing['chosen'];
$facets = $listing['facets'];
$active = count(array_filter($chosen, fn ($value): bool => $value !== null)) + ($listing['term'] !== '' ? 1 : 0);
@endphp
@if ($listing['filters'])
<form class="shop-search shop-filter" method="get" action="{{ $action }}" role="search" aria-label="Shop durchsuchen und filtern">
<div class="shop-filter-field shop-filter-search">
<label for="shop-suche-{{ $uid }}">Shop durchsuchen</label>
<input id="shop-suche-{{ $uid }}" type="search" name="suche" value="{{ $listing['term'] }}" maxlength="100" autocomplete="off">
</div>
@foreach ([['saeule', 'pillar', 'Thema'], ['art', 'kind', 'Materialart'], ['eignung', 'holder', 'Geeignet für'], ['kreis', 'scope', 'Nutzerkreis']] as [$name, $facet, $label])
@if ($facets[$facet] !== [])
<div class="shop-filter-field">
<label for="shop-{{ $name }}-{{ $uid }}">{{ $label }}</label>
<select id="shop-{{ $name }}-{{ $uid }}" name="{{ $name }}">
<option value="">Alle</option>
@foreach ($facets[$facet] as $value => $text)
<option value="{{ $value }}" @selected((string) ($chosen[$facet] ?? '') === (string) $value)>{{ $text }}</option>
@endforeach
</select>
</div>
@endif
@endforeach
<div class="shop-filter-field">
<label for="shop-sort-{{ $uid }}">Reihenfolge</label>
<select id="shop-sort-{{ $uid }}" name="sort">
<option value="">Standard</option>
@foreach (\App\Domain\Commerce\ShopCatalog::SORTS as $value => $text)
<option value="{{ $value }}" @selected(($listing['sort'] ?? '') === $value)>{{ $text }}</option>
@endforeach
</select>
</div>
<input type="hidden" name="ansicht" value="{{ $listing['view'] }}">
<div class="shop-filter-actions">
<button class="button" type="submit">Anwenden</button>
@if ($active > 0)
<a class="button button-quiet" href="{{ $action }}?ansicht={{ $listing['view'] }}">Zurücksetzen</a>
@endif
</div>
</form>
<div class="shop-viewbar">
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}@if ($listing['pages'] > 1), Seite {{ $listing['page'] }} von {{ $listing['pages'] }}@endif</p>
<p class="shop-view" aria-label="Ansicht">
<a href="{{ $link(['ansicht' => 'kacheln', 'seite' => null]) }}" @if ($listing['view'] === 'kacheln') aria-current="true" @endif>Kacheln</a>
<a href="{{ $link(['ansicht' => 'liste', 'seite' => null]) }}" @if ($listing['view'] === 'liste') aria-current="true" @endif>Liste</a>
</p>
</div>
@elseif ($listing['cards'] !== [])
<p class="shop-count" role="status">{{ $listing['total'] }} {{ $listing['total'] === 1 ? 'Produkt' : 'Produkte' }}</p>
@endif
@if ($listing['cards'] === [])
<div class="empty">
<h3>{{ $active > 0 ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h3>
<p>{{ $active > 0 ? 'Zu dieser Auswahl gibt es keine kaufbaren Produkte. Ändere die Auswahl oder setze sie zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
</div>
@elseif ($listing['view'] === 'liste')
<ul class="shop-rows">
@foreach ($listing['cards'] as $card)
@include('shop.zeile', ['card' => $card])
@endforeach
</ul>
@else
<ul class="shop-tiles">
@foreach ($listing['cards'] as $card)
@include('shop.kachel', ['card' => $card])
@endforeach
</ul>
@endif
@if ($listing['pages'] > 1)
<nav class="shop-pages" aria-label="Seiten">
@if ($listing['page'] > 1)
<a href="{{ $link(['seite' => $listing['page'] - 1]) }}" rel="prev">Zurück</a>
@endif
<span>Seite {{ $listing['page'] }} von {{ $listing['pages'] }}</span>
@if ($listing['page'] < $listing['pages'])
<a href="{{ $link(['seite' => $listing['page'] + 1]) }}" rel="next">Weiter</a>
@endif
</nav>
@endif
+31
View File
@@ -0,0 +1,31 @@
{{--
Ein Produkt in der Listenansicht. Die Zeile trägt dieselben Angaben wie die Kachel: kleines Bild oder Symbol, Art,
Marker mit Wort, Titel als Link, Kurztext, Themen und Preis.
--}}
<li class="shop-row">
<div class="shop-row-media @if ($card['image'] === null) is-placeholder @endif" aria-hidden="true">
@if ($card['image'] !== null)
<img src="{{ $card['image']['url'] }}" alt="" loading="lazy" decoding="async">
@elseif ($card['symbol'] !== null)
<x-brand.symbol :name="$card['symbol']" class="shop-row-symbol" />
@endif
</div>
<div class="shop-row-body">
<p class="shop-tile-kind">
@if ($card['kind_label'] !== '')<span>{{ $card['kind_label'] }}</span>@endif
@foreach ($card['markers'] as $marker)
<span class="shop-marker shop-marker-{{ $marker['key'] }}">{{ $marker['label'] }}</span>
@endforeach
</p>
<h2><a href="{{ $card['url'] }}">{{ $card['title'] }}</a></h2>
@if ($card['teaser'] !== '')<p class="shop-tile-teaser">{{ $card['teaser'] }}</p>@endif
@if ($card['pillars'] !== [])
<ul class="shop-tile-pillars" aria-label="Themen">
@foreach (array_slice($card['pillars'], 0, 3) as $pillar)
<li>{{ $pillar }}</li>
@endforeach
</ul>
@endif
</div>
<p class="shop-row-price">ab {{ $card['from'] }}<span>{{ $card['count'] }} {{ $card['count'] === 1 ? 'Lizenzoption' : 'Lizenzoptionen' }}</span></p>
</li>
@@ -1,6 +1,6 @@
{{--
Shop-Produkte (ADR-55). Die Kacheln kommen aus ShopCatalog, nichts davon wird im CMS gespeichert. Ist der Shop nicht
sichtbar, bleibt der Abschnitt öffentlich leer; die Redaktionsvorschau zeigt einen Hinweis.
Shop-Produkte (ADR-55, ADR-57). Die Produkte kommen aus ShopCatalog, nichts davon wird im CMS gespeichert. Ist der Shop
nicht sichtbar, bleibt der Abschnitt öffentlich leer; die Redaktionsvorschau zeigt einen Hinweis.
--}}
@if ($shopVisible || $context->preview)
<div class="shop-products">
@@ -13,29 +13,17 @@
@unless ($shopVisible)
<p class="preview-note">Der Shop ist zurzeit nicht sichtbar. Öffentlich erscheint dieser Abschnitt nicht.</p>
@else
@if (($settings['search'] ?? 'aus') === 'an')
<form class="shop-search" method="get" action="{{ route('shop') }}" role="search">
@if (($settings['search'] ?? 'aus') === 'an' && ($settings['filter'] ?? 'aus') !== 'an')
<form class="shop-search" method="get" action="{{ url()->current() }}" role="search">
<label for="shop-suche-{{ $widget['id'] ?? 'w' }}">Shop durchsuchen</label>
<input id="shop-suche-{{ $widget['id'] ?? 'w' }}" type="search" name="suche" value="{{ $term }}" autocomplete="off">
<input id="shop-suche-{{ $widget['id'] ?? 'w' }}" type="search" name="suche" value="{{ $term }}" maxlength="100" autocomplete="off">
<button class="button" type="submit">Suchen</button>
@if ($term !== '')
<a class="button button-quiet" href="{{ route('shop') }}">Suche zurücksetzen</a>
<a class="button button-quiet" href="{{ url()->current() }}">Suche zurücksetzen</a>
@endif
</form>
@endif
@if ($cards === [])
<div class="empty">
<h3>{{ $term !== '' ? 'Keine Treffer' : 'Noch keine kaufbaren Produkte' }}</h3>
<p>{{ $term !== '' ? 'Zu „'.$term.'“ gibt es keine kaufbaren Produkte. Prüfe die Schreibweise oder setze die Suche zurück.' : 'Sobald ein Angebot aktiv ist, erscheint es hier.' }}</p>
</div>
@else
<p class="shop-count" role="status">{{ count($cards) }} {{ count($cards) === 1 ? 'Produkt' : 'Produkte' }}</p>
<ul class="shop-tiles">
@foreach ($cards as $card)
@include('shop.kachel', ['card' => $card])
@endforeach
</ul>
@endif
@include('shop.liste', ['listing' => $listing, 'action' => url()->current(), 'uid' => $widget['id'] ?? 'w'])
@endunless
</div>
@endif
+181
View File
@@ -0,0 +1,181 @@
<?php
namespace Tests\Feature;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\PillarService;
use App\Domain\Cms\Page;
use App\Domain\Cms\PageService;
use App\Domain\Commerce\ShopCatalog;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\Support\BuildsShop;
use Tests\TestCase;
/**
* Viele Produkte (ADR-57): Auswahl nach Thema, Materialart, Eignung und Nutzerkreis, Reihenfolge, Ansicht (Kacheln oder
* Liste) und Seiten. Alles kommt aus dem Abfragetext und wird gegen feste Werte geprüft.
*/
class ShopListingTest extends TestCase
{
use BuildsShop;
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->seedShop();
}
/** Zwei Säulen, je ein Artikel; zwei Materialarten. */
private function classify(): array
{
$service = app(PillarService::class);
$grenzen = $service->create('Grenzen');
$service->present($grenzen, 'Grenzen', 'grenzen-saeule', null, true, 10);
$konflikte = $service->create('Konfliktklärung');
$service->present($konflikte, 'Konfliktklärung', 'konfliktklaerung', null, true, 20);
$service->assign($this->article('shop-grenzen'), [$grenzen->id]);
$service->assign($this->article('shop-konflikte'), [$konflikte->id]);
$programm = EditorialContentKind::query()->where('slug', 'programm')->firstOrFail();
$modul = EditorialContentKind::query()->where('slug', 'modul')->firstOrFail();
$this->article('shop-grenzen')->forceFill(['editorial_content_kind_id' => $programm->id])->save();
$this->article('shop-konflikte')->forceFill(['editorial_content_kind_id' => $modul->id])->save();
return [$grenzen, $konflikte, $programm, $modul];
}
private function titles(array $listing): array
{
return array_column($listing['cards'], 'title');
}
public function test_the_choices_offer_only_values_that_exist_and_only_when_there_is_a_real_choice(): void
{
[$grenzen, $konflikte, $programm, $modul] = $this->classify();
$facets = app(ShopCatalog::class)->listing([])['facets'];
$this->assertSame([$grenzen->id => 'Grenzen', $konflikte->id => 'Konfliktklärung'], $facets['pillar']);
$this->assertEquals([$programm->id => $programm->label, $modul->id => $modul->label], $facets['kind']);
$this->assertArrayHasKey('person', $facets['holder']);
$this->assertArrayHasKey('organisation', $facets['holder']);
$html = $this->get(route('shop'))->assertOk()->getContent();
$this->assertStringContainsString('name="saeule"', $html);
$this->assertStringContainsString('name="art"', $html);
$this->assertStringContainsString('name="eignung"', $html);
$this->assertStringContainsString('name="sort"', $html);
}
public function test_a_choice_narrows_the_list_and_unknown_or_junk_values_are_ignored(): void
{
[$grenzen, , , $modul] = $this->classify();
$catalog = app(ShopCatalog::class);
$this->assertSame(['Grenzen setzen im Verein'], $this->titles($catalog->listing(['saeule' => (string) $grenzen->id])));
$this->assertSame(['Konflikte im Training'], $this->titles($catalog->listing(['art' => (string) $modul->id])));
$this->assertCount(3, $catalog->listing(['saeule' => '999999'])['cards'], 'Eine unbekannte Säule filtert nichts.');
$this->assertCount(3, $catalog->listing(['saeule' => '1 OR 1=1', 'art' => '../x', 'eignung' => 'alle', 'kreis' => '<script>'])['cards']);
$this->assertSame(3, $catalog->listing(['saeule' => ['1'], 'suche' => ['x'], 'sort' => ['name'], 'seite' => ['9'], 'ansicht' => ['liste']])['total'], 'Felder als Liste werden ignoriert, nie ein Fehler.');
$this->get(route('shop', ['saeule' => ['1'], 'suche' => ['x'], 'seite' => ['2']]))->assertOk();
}
public function test_holder_and_licence_scope_filter_by_the_options_a_product_has(): void
{
$this->classify();
$catalog = app(ShopCatalog::class);
$organisation = $catalog->listing(['eignung' => 'organisation']);
$this->assertContains('Konflikte im Training', $this->titles($organisation), 'Die Vereinslizenz gehört zu Konflikte im Training.');
$this->assertNotContains('Starterpaket', $this->titles($organisation), 'Das Starterpaket gibt es nur für Privatpersonen.');
$person = $catalog->listing(['eignung' => 'person']);
$this->assertContains('Starterpaket', $this->titles($person));
}
public function test_the_order_can_be_chosen_and_an_unknown_order_is_ignored(): void
{
$catalog = app(ShopCatalog::class);
$this->assertSame(['Grenzen setzen im Verein', 'Konflikte im Training', 'Starterpaket'], $this->titles($catalog->listing(['sort' => 'name'])));
$this->assertSame(['Grenzen setzen im Verein', 'Konflikte im Training', 'Starterpaket'], $this->titles($catalog->listing(['sort' => 'preis'])));
$this->assertSame($this->titles($catalog->listing([])), $this->titles($catalog->listing(['sort' => 'zufall'])));
}
public function test_the_list_is_split_into_pages_and_a_page_number_is_clamped(): void
{
config(['shop.per_page' => 2]);
$catalog = app(ShopCatalog::class);
$first = $catalog->listing([]);
$this->assertSame([2, 1, 2, 3], [count($first['cards']), $first['page'], $first['pages'], $first['total']]);
$this->assertCount(1, $catalog->listing(['seite' => '2'])['cards']);
$this->assertSame(2, $catalog->listing(['seite' => '99'])['page']);
$this->assertSame(1, $catalog->listing(['seite' => '-4'])['page']);
$this->assertSame(1, $catalog->listing(['seite' => 'abc'])['page']);
$page = $this->get(route('shop'))->assertOk();
$page->assertSee('Seite 1 von 2')->assertSee('rel="next"', false)->assertDontSee('rel="prev"', false);
$this->get(route('shop', ['seite' => 2]))->assertOk()->assertSee('rel="prev"', false)->assertDontSee('rel="next"', false);
}
public function test_page_links_keep_the_choice_and_the_view(): void
{
config(['shop.per_page' => 1]);
$html = $this->get(route('shop', ['sort' => 'preis', 'ansicht' => 'liste']))->assertOk()->getContent();
$this->assertStringContainsString('sort=preis', $html);
$this->assertMatchesRegularExpression('#rel="next"#', $html);
$this->assertMatchesRegularExpression('#href="[^"]*ansicht=liste[^"]*seite=2[^"]*"|href="[^"]*seite=2[^"]*ansicht=liste[^"]*"#', $html);
}
public function test_the_view_can_be_switched_between_tiles_and_list_and_the_list_carries_the_same_facts(): void
{
$this->classify();
$tiles = $this->get(route('shop'))->assertOk();
$tiles->assertSee('class="shop-tiles"', false)->assertDontSee('class="shop-rows"', false);
$list = $this->get(route('shop', ['ansicht' => 'liste']))->assertOk();
$list->assertSee('class="shop-rows"', false)->assertDontSee('class="shop-tiles"', false)
->assertSee('Konflikte im Training')->assertSee('ab 49,00 €')->assertSee('2 Lizenzoptionen')->assertSee('Konfliktklärung')
->assertSee('aria-current="true"', false);
$this->get(route('shop', ['ansicht' => 'quatsch']))->assertOk()->assertSee('class="shop-tiles"', false);
}
public function test_the_filter_form_is_accessible_and_escapes_the_search_text(): void
{
$html = $this->get(route('shop', ['suche' => '"><script>alert(1)</script>']))->assertOk()->getContent();
$this->assertStringNotContainsString('<script>alert(1)</script>', $html);
$this->assertMatchesRegularExpression('#<label for="shop-suche-seite">Shop durchsuchen</label>#', $html);
$this->assertMatchesRegularExpression('#<label for="shop-sort-seite">Reihenfolge</label>#', $html);
$this->assertStringContainsString('role="search"', $html);
$this->assertStringContainsString('Keine Treffer', $html);
}
public function test_an_empty_choice_shows_an_honest_empty_state_with_a_way_back(): void
{
[$grenzen] = $this->classify();
$this->get(route('shop', ['saeule' => $grenzen->id, 'suche' => 'gibt-es-nicht']))->assertOk()
->assertSee('Keine Treffer')->assertSee('Zurücksetzen');
}
public function test_the_widget_offers_the_choice_only_when_asked_and_keeps_its_fixed_filters(): void
{
[$grenzen] = $this->classify();
$widget = fn (array $settings, array $data = [], string $variant = 'kacheln'): array => ['type' => 'shop_products', 'v' => 1, 'variant' => $variant, 'settings' => $settings, 'data' => $data];
$service = app(PageService::class);
$page = Page::query()->create(['path' => '/auswahl']);
$service->publish($page, $service->saveRevision($page, [['layout' => 'u4', 'style' => [], 'slots' => [$widget(['filter' => 'an'], [], 'liste')]]], null, null, null));
$plain = Page::query()->create(['path' => '/ohne-auswahl']);
$service->publish($plain, $service->saveRevision($plain, [['layout' => 'u4', 'style' => [], 'slots' => [$widget([])]]], null, null, null));
$fixed = Page::query()->create(['path' => '/nur-grenzen']);
$service->publish($fixed, $service->saveRevision($fixed, [['layout' => 'u4', 'style' => [], 'slots' => [$widget(['filter' => 'an'], ['pillar' => $grenzen->id])]]], null, null, null));
$this->get('/auswahl')->assertOk()->assertSee('name="saeule"', false)->assertSee('class="shop-rows"', false);
$this->get('/auswahl?ansicht=kacheln')->assertOk()->assertSee('class="shop-tiles"', false);
$this->get('/ohne-auswahl')->assertOk()->assertDontSee('name="saeule"', false)->assertDontSee('role="search"', false);
$this->get('/nur-grenzen')->assertOk()->assertSee('Grenzen setzen im Verein')->assertDontSee('Starterpaket')
->assertDontSee('name="saeule"', false);
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ public function test_the_shop_search_filters_and_shows_an_empty_state(): void
$this->get(route('shop', ['suche' => 'gibt-es-nicht']))
->assertOk()
->assertSee('Keine Treffer')
->assertSee('Suche zurücksetzen');
->assertSee('Zurücksetzen');
}
public function test_the_product_page_shows_content_and_options_with_price_rights_and_term(): void