- Zwei Schalter: Shop::visible (SHOP_PUBLIC) und Shop::checkoutOpen; ist der Shop nur sichtbar, fuehren Warenkorb, Kasse und Jetzt kaufen auf eine Hinweisseite (noindex), ohne Warenkorb und Bestellung - Einzelkauf (Checkout::place, Route member.offers.buy) entfernt; Bestellung nur aus dem Warenkorb - Jetzt kaufen an der Produktseite oeffnet die Bestellübersicht, Bereits erworben auf der Produktseite - Menuepunkte in den Shop nur bei sichtbarem Shop, /angebote leitet auf /shop, Seeder fuehrt Shop - Mitgliederseite Angebote zeigt nur kostenlose Angebote zum Uebernehmen - Middleware EnsureCheckoutOpen laeuft vor der Anmeldepruefung - Plan und ADR-53, DEPLOYMENT.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
80 lines
3.0 KiB
PHP
80 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Domain\Catalog\Bundle;
|
|
use App\Domain\Catalog\Composition;
|
|
use App\Domain\Catalog\CompositionStructureReader;
|
|
use App\Domain\Catalog\EditorialProfileReader;
|
|
use App\Domain\Catalog\LicenseArticle;
|
|
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
|
use App\Domain\Commerce\Cart;
|
|
use App\Domain\Commerce\ProductOptions;
|
|
use App\Domain\Commerce\Shop;
|
|
use Illuminate\View\View;
|
|
|
|
class PublicCatalogController extends Controller
|
|
{
|
|
public function index(PublicCatalogReader $catalog): View
|
|
{
|
|
return view('public.programs', ['programs' => $catalog->publicPrograms()]);
|
|
}
|
|
|
|
/**
|
|
* Eigene Produktseite eines Pakets, das für sich vermarktet wird: Sie zeigt den tatsächlichen Umfang des Pakets
|
|
* (die enthaltenen Artikel) und darunter die kaufbaren Lizenzoptionen. Ohne kaufbare Option gibt es sie nicht.
|
|
*/
|
|
public function package(Bundle $bundle, ProductOptions $products, Cart $cart): View
|
|
{
|
|
abort_unless(Shop::visible(), 404);
|
|
$options = $products->forBundle($bundle);
|
|
abort_if($options === [], 404);
|
|
|
|
return view('public.package', [
|
|
'bundle' => $bundle,
|
|
'contents' => $products->bundleContents($options),
|
|
'options' => $options,
|
|
'cart' => $cart,
|
|
'switchTo' => session('shop.switch'),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Produktseite eines Lizenzartikels: Titel und Beschreibung aus der Redaktion des Artikels (sonst aus seinem Inhalt),
|
|
* der Aufbau des verkauften Inhalts und darunter die kaufbaren Lizenzoptionen. Ohne kaufbare Option gibt es sie nicht.
|
|
*/
|
|
public function article(LicenseArticle $article, ProductOptions $products, Cart $cart): View
|
|
{
|
|
abort_unless(Shop::visible() && $article->archived_at === null, 404);
|
|
$options = $products->forArticle($article);
|
|
abort_if($options === [], 404);
|
|
|
|
return view('public.article', [
|
|
'article' => $article,
|
|
'title' => $products->articleTitle($article),
|
|
'profile' => app(EditorialProfileReader::class)->read($article, 'detail'),
|
|
'goal' => $products->articleGoal($article),
|
|
'nodes' => $products->articleStructure($article),
|
|
'options' => $options,
|
|
'cart' => $cart,
|
|
'switchTo' => session('shop.switch'),
|
|
]);
|
|
}
|
|
|
|
public function program(Composition $composition, PublicCatalogReader $catalog, ProductOptions $products, Cart $cart): View
|
|
{
|
|
$version = $catalog->shownVersion($composition);
|
|
abort_if($version === null, 404);
|
|
|
|
return view('public.program', [
|
|
'composition' => $composition,
|
|
'version' => $version,
|
|
'nodes' => app(CompositionStructureReader::class)->tree($version),
|
|
'options' => Shop::visible() ? $products->forComposition($composition) : [],
|
|
'articles' => Shop::visible() ? $products->articlesOf($composition) : [],
|
|
'cart' => $cart,
|
|
'switchTo' => session('shop.switch'),
|
|
]);
|
|
}
|
|
}
|