mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2024-11-01 00:53:10 +01:00
Added basket draft
This commit is contained in:
parent
99f863e639
commit
ca8aaa95be
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace controller\order;
|
namespace controller\order;
|
||||||
|
|
||||||
use controller\AbstractController;
|
use controller\AbstractDefaultController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
final class Order extends AbstractController implements OrderInterface
|
final class Order extends AbstractDefaultController implements OrderInterface
|
||||||
{
|
{
|
||||||
public function addProduct(): void
|
public function addProduct(): void
|
||||||
{}
|
{}
|
||||||
@ -17,7 +17,9 @@ final class Order extends AbstractController implements OrderInterface
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
public function basket(): void
|
public function basket(): void
|
||||||
{}
|
{
|
||||||
|
$this->render('order/basket.html.twig',['basket'=>$this->core->getBasket()]);
|
||||||
|
}
|
||||||
|
|
||||||
public function selectPaymentMethod(): void
|
public function selectPaymentMethod(): void
|
||||||
{}
|
{}
|
||||||
|
@ -51,6 +51,18 @@ final class Core implements CoreInterface
|
|||||||
$this->initTwig();
|
$this->initTwig();
|
||||||
$this->initDatabase();
|
$this->initDatabase();
|
||||||
$this->initUser();
|
$this->initUser();
|
||||||
|
$this->initBasket();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads basket by session
|
||||||
|
*/
|
||||||
|
private function initBasket(): void
|
||||||
|
{
|
||||||
|
if(!$_SESSION['basket']){
|
||||||
|
$_SESSION['basket'] = new Order();
|
||||||
|
}
|
||||||
|
$this->basket = $_SESSION['basket'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
25
src/template/order/basket.html.twig
Normal file
25
src/template/order/basket.html.twig
Normal 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 %}
|
Loading…
Reference in New Issue
Block a user