...
Codeblock | ||||
---|---|---|---|---|
| ||||
<?php declare(strict_types=1); namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event { use Brandbox\ShopCore\Shop\Checkout; use Brandbox\ShopCore\Shop\Event; class OnBasketChangeEvent extends Event\EventAbstract implements Checkout\lib\event\onBasketChangeEventInterface { const PRIORITY = 1; public function onBasketChange(): void { // Code } } } |
ViewEvent Registrieren
Codeblock | ||||
---|---|---|---|---|
| ||||
<?php
namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event {
use Brandbox\ShopCore\Shop\Event;
use Brandbox\CmsLayoutShop\View\Checkout as ViewCheckout;
use Brandbox\MyApp\Shop\MyPackage;
class MyCheckoutConfirmedEvent extends Event\EventAbstract implements viewCheckout\lib\event\checkoutConfirmedAdditionalHtmlEventInterface {
public const PRIORITY = 1;
private int $orderID;
/**
* @param array $parameters
*/
public function __construct($parameters) {
$this->orderID = $parameters[self::PARAMETER_ORDER_ID];
}
/**
* @return Event\ViewInterface
*/
public function getView() {
return new MyPackage\Lib\Event\MyCheckoutConfirmedView($this->orderID);
}
}
}
namespace Brandbox\MyApp\Shop\MyPackage\Lib\Event {
use Brandbox\Framework\Brandbox\Controller;
use Brandbox\ShopCore\Shop\Event;
class MyCheckoutConfirmedView extends Controller\ControllerExecuteAbstract implements Event\ViewInterface
{
private int $orderID;
public function __construct($orderID)
{
$this->orderID = $orderID;
}
/**
* @return array|object
*/
public function getContext()
{
$result = new \stdClass();
return $result;
}
public function getPath(): string
{
return 'plugin/remote/brandbox/my-app/src/Shop/MyPackage/views/my-checkout-confirmed-view.hbs';
}
}
} |