Added basket draft

This commit is contained in:
Kevin Frantz 2018-07-15 12:15:06 +02:00
parent 99f863e639
commit ca8aaa95be
3 changed files with 42 additions and 3 deletions

View File

@ -1,14 +1,14 @@
<?php
namespace controller\order;
use controller\AbstractController;
use controller\AbstractDefaultController;
/**
*
* @author kevinfrantz
*
*/
final class Order extends AbstractController implements OrderInterface
final class Order extends AbstractDefaultController implements OrderInterface
{
public function addProduct(): void
{}
@ -17,7 +17,9 @@ final class Order extends AbstractController implements OrderInterface
{}
public function basket(): void
{}
{
$this->render('order/basket.html.twig',['basket'=>$this->core->getBasket()]);
}
public function selectPaymentMethod(): void
{}

View File

@ -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
*/

View File

@ -0,0 +1,25 @@
{% extends 'frames/default.html.twig' %}
{% block title %}
basket
{% endblock %}
{% block content %}
<h1>Basket</h1>
<table class="table">
<tr>
<th>id</th>
<th>name</th>
<th>price(net)</th>
<th>tax (%)</th>
<th>price (gross)</th>
</tr>
{% for product in basket.products %}
<tr>
<td>product.id</td>
<td>product.name</td>
<td>product.price.netto.float</td>
<td>product.price.tax</td>
<td>product.price.gross.float</td>
</tr>
{% endfor %}
</table>
{% endblock %}