Binde den Shop ins CMS ein: Seite shop, Widget Shop-Produkte, Kacheln auf der Mitgliederseite
CI Feature / test (push) Successful in 5m29s
CI Feature / test (push) Successful in 5m29s
- Eine veroeffentlichte CMS-Seite mit dem Pfad /shop bestimmt den Aufbau von /shop, sonst gilt die Standardseite - Widget shop_products mit Filter (Saeule, Materialart), Reihenfolge, Anzahl und Suchfeld; leer, solange der Shop nicht sichtbar ist - ShopCatalog mit Filter, Sortierung und Limit; Suchbegriff auf 100 Zeichen gekuerzt - Sitemap ohne /shop, solange nicht gekauft werden kann - Mitgliederseite Angebote zeigt die neuesten Produkte als Kacheln - ADR-55, Widget-Register Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1af462e1d6
commit
61c65595e1
14 files changed
+569
-12
No files matched your search
@@ -12,6 +12,7 @@
|
||||
use App\Domain\Commerce\OrderHolders;
|
||||
use App\Domain\Commerce\SalesTerms;
|
||||
use App\Domain\Commerce\Shop;
|
||||
use App\Domain\Commerce\ShopCatalog;
|
||||
use App\Domain\Commerce\StaleOverview;
|
||||
use App\Domain\Commerce\Stripe\StripeGateway;
|
||||
use App\Domain\Entitlement\GrantIssuer;
|
||||
@@ -35,7 +36,13 @@ public function offers(): View
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
return view('member.offers', ['offers' => $offers, 'shop' => Shop::visible()]);
|
||||
$shop = Shop::visible();
|
||||
|
||||
return view('member.offers', [
|
||||
'offers' => $offers,
|
||||
'shop' => $shop,
|
||||
'cards' => $shop ? app(ShopCatalog::class)->cards('', ['sort' => 'neu', 'limit' => 6]) : [],
|
||||
]);
|
||||
}
|
||||
|
||||
public function claim(Request $request, Offer $offer, GrantIssuer $issuer): RedirectResponse
|
||||
|
||||
@@ -35,6 +35,12 @@ public function offers(): View|RedirectResponse
|
||||
return Shop::visible() ? redirect()->route('shop') : $this->show('angebote');
|
||||
}
|
||||
|
||||
/** Eine veröffentlichte CMS-Seite unter einer festen App-Adresse (der Shop unter /shop). */
|
||||
public function showPage(Page $page): View
|
||||
{
|
||||
return $this->render($page, preview: false);
|
||||
}
|
||||
|
||||
public function preview(PageRevision $revision): View
|
||||
{
|
||||
$page = $revision->page;
|
||||
@@ -60,7 +66,9 @@ public function devices(PageRevision $revision): View
|
||||
|
||||
public function sitemap(): Response
|
||||
{
|
||||
$pages = Page::query()->whereNotNull('published_revision_id')->orderBy('path')->get();
|
||||
// Der Shop gehört nicht in die Sitemap, solange man dort nicht kaufen kann (die Seiten sind dann noindex).
|
||||
$pages = Page::query()->whereNotNull('published_revision_id')->orderBy('path')->get()
|
||||
->reject(fn (Page $page): bool => $page->path === '/shop' && ! Shop::checkoutOpen());
|
||||
$themes = Pillar::query()->published()->get();
|
||||
|
||||
return response()
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Commerce\Shop;
|
||||
use App\Domain\Commerce\ShopCatalog;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* Durchsuchbarer Shop: macht kaufbare Produkte auffindbar. Treffer öffnen dieselbe öffentliche Produktseite wie die
|
||||
* Programmkacheln. Gelistet wird nur, was mindestens eine kaufbare Option hat; die Kacheln bildet ShopCatalog.
|
||||
*
|
||||
* Gibt es in der Webpräsenz eine veröffentlichte Seite „shop“, bestimmt sie den Aufbau (Banner, Grafiken, Texte und das
|
||||
* Widget „Shop-Produkte“); sonst zeigt die Anwendung die Standardseite mit Suche und Kacheln (ADR-55).
|
||||
*/
|
||||
class ShopController extends Controller
|
||||
{
|
||||
@@ -23,8 +27,14 @@ public function closed(): View|RedirectResponse
|
||||
return Shop::checkoutOpen() ? redirect()->route('shop') : view('shop.closed');
|
||||
}
|
||||
|
||||
public function index(Request $request, ShopCatalog $catalog): View
|
||||
public function index(Request $request, ShopCatalog $catalog, PageController $pages): View
|
||||
{
|
||||
$page = Page::query()->where('path', '/shop')->whereNotNull('published_revision_id')->first();
|
||||
|
||||
if ($page !== null) {
|
||||
return $pages->showPage($page);
|
||||
}
|
||||
|
||||
$term = trim((string) $request->query('suche', ''));
|
||||
|
||||
return view('shop.index', ['cards' => $catalog->cards($term), 'term' => $term]);
|
||||
|
||||
Reference in new issue
Block a user