Avoid error in case provided reseller code is invalid

This commit is contained in:
Björn Fromme
2018-06-28 15:45:50 +02:00
parent b908d9c0de
commit 3255587f1f
2 changed files with 16 additions and 10 deletions
@@ -63,9 +63,13 @@ class ResellerController extends ActionController
/**
* @param Reseller $reseller
*/
public function listAction(Reseller $reseller)
public function listAction(Reseller $reseller = null)
{
$products = $reseller->getProducts();
$products = [];
if ($reseller !== null) {
$products = $reseller->getProducts();
}
$this->view->assign('reseller', $reseller);
$this->view->assign('products', $products);
@@ -8,14 +8,16 @@
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Gesamtexport XML</h2>
<f:link.action arguments="{reseller: reseller}" pageType="1972" target="_blank">Export XML</f:link.action>
<h2>Einzelexport Excel</h2>
<ul>
<f:for each="{products}" as="product">
<li><f:link.action arguments="{product: product, reseller: reseller}" pageType="1984">Export XLS: {product.name}</f:link.action></li>
</f:for>
</ul>
<f:if condition="{reseller}">
<h2>Gesamtexport XML</h2>
<f:link.action arguments="{reseller: reseller}" pageType="1972" target="_blank">Export XML</f:link.action>
<h2>Einzelexport Excel</h2>
<ul>
<f:for each="{products}" as="product">
<li><f:link.action arguments="{product: product, reseller: reseller}" pageType="1984">Export XLS: {product.name}</f:link.action></li>
</f:for>
</ul>
</f:if>
</div>
</div>
</div>