diff --git a/src/controller/order/Order.php b/src/controller/order/Order.php index 043c924..ef82423 100644 --- a/src/controller/order/Order.php +++ b/src/controller/order/Order.php @@ -1,14 +1,14 @@ render('order/basket.html.twig',['basket'=>$this->core->getBasket()]); + } public function selectPaymentMethod(): void {} diff --git a/src/core/Core.php b/src/core/Core.php index 8b4e9f8..473b179 100644 --- a/src/core/Core.php +++ b/src/core/Core.php @@ -51,8 +51,20 @@ final class Core implements CoreInterface $this->initTwig(); $this->initDatabase(); $this->initUser(); + $this->initBasket(); } + /** + * Loads basket by session + */ + private function initBasket(): void + { + if(!$_SESSION['basket']){ + $_SESSION['basket'] = new Order(); + } + $this->basket = $_SESSION['basket']; + } + /** * Loads user by session */ diff --git a/src/template/order/basket.html.twig b/src/template/order/basket.html.twig new file mode 100644 index 0000000..c17d05e --- /dev/null +++ b/src/template/order/basket.html.twig @@ -0,0 +1,25 @@ +{% extends 'frames/default.html.twig' %} +{% block title %} +basket +{% endblock %} +{% block content %} +
id | +name | +price(net) | +tax (%) | +price (gross) | +
---|---|---|---|---|
product.id | +product.name | +product.price.netto.float | +product.price.tax | +product.price.gross.float | +