From 3fdcd47e9cdd0da11beee403a24f5a6b6cd5cf5b Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 15 Jul 2018 14:32:56 +0200 Subject: [PATCH] Optimized twig and payment methods --- src/controller/order/Order.php | 7 +++---- src/controller/order/OrderInterface.php | 2 -- src/entity/payment/AbstractPayment.php | 15 +++++++++++++++ src/template/order/basket.html.twig | 14 ++++++++++++-- src/template/standart/homepage.html.twig | 9 +-------- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/controller/order/Order.php b/src/controller/order/Order.php index 898ea4f..c0c8f72 100644 --- a/src/controller/order/Order.php +++ b/src/controller/order/Order.php @@ -6,6 +6,7 @@ use core\CoreInterface; use repository\order\OrderInterface as OrderRepositoryInterface; use repository\product\ProductInterface as ProductRepositoryInterface; use repository\product\Product as ProductRepository; +use entity\payment\AbstractPayment; /** * @@ -47,7 +48,8 @@ final class Order extends AbstractDefaultController implements OrderInterface $this->postRoutine(); } $this->render('order/basket.html.twig', [ - 'basket' => $this->core->getBasket() + 'basket' => $this->core->getBasket(), + 'payment_methods'=>AbstractPayment::getPaymentMethods(), ]); } @@ -57,8 +59,5 @@ final class Order extends AbstractDefaultController implements OrderInterface $this->addProduct(); } } - - public function selectPaymentMethod(): void - {} } diff --git a/src/controller/order/OrderInterface.php b/src/controller/order/OrderInterface.php index c9ad257..a08bf97 100644 --- a/src/controller/order/OrderInterface.php +++ b/src/controller/order/OrderInterface.php @@ -8,6 +8,4 @@ namespace controller\order; interface OrderInterface { public function basket():void; - - public function selectPaymentMethod():void; } \ No newline at end of file diff --git a/src/entity/payment/AbstractPayment.php b/src/entity/payment/AbstractPayment.php index 47ed146..48718d7 100644 --- a/src/entity/payment/AbstractPayment.php +++ b/src/entity/payment/AbstractPayment.php @@ -1,6 +1,10 @@ new Method1(), + 'method2'=>new Method2() + ]); + } } diff --git a/src/template/order/basket.html.twig b/src/template/order/basket.html.twig index eecede5..4a04838 100644 --- a/src/template/order/basket.html.twig +++ b/src/template/order/basket.html.twig @@ -16,10 +16,20 @@ basket {{product.id}} {{product.name}} - {{product.price.netto.float}} + {{product.price.netto.float}} {{product.price.netto.symbol}} {{product.price.tax}} - {{product.price.gross.float}} + {{product.price.gross.float}} {{product.price.gross.symbol}} {% endfor %} +
+ + + +
{% endblock %} \ No newline at end of file diff --git a/src/template/standart/homepage.html.twig b/src/template/standart/homepage.html.twig index 9268337..dca58c6 100644 --- a/src/template/standart/homepage.html.twig +++ b/src/template/standart/homepage.html.twig @@ -2,12 +2,5 @@ {% block title %}Homepage{% endblock %} {% block content %}

Welcome to the online shop!

-You have the following options: - + {% endblock %}