feature/handle-promotions #59
@@ -22,6 +22,11 @@ final class PromosController extends BaseController
|
|||||||
->when(!is_null($promo), fn($q) => $q->whereRaw("json_extract(promotions, '$.slug') LIKE ?", $promo))
|
->when(!is_null($promo), fn($q) => $q->whereRaw("json_extract(promotions, '$.slug') LIKE ?", $promo))
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos'.$promo]);
|
|
||||||
|
$promos = Product::select($this->database->getConnection()->raw("distinct json_extract(promotions, '$.slug') as slug, json_extract(promotions, '$.tag') as tag"))
|
||||||
|
->whereRaw("json_extract(promotions, '$.tag') is not null")
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return $this->render('productList.html.twig', ['products' => $products, 'listType' => 'promos' . $promo, 'promos' => $promos->toArray()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
{{ renderCategoryTree(categoryTree, category) | raw }}
|
{{ renderCategoryTree(categoryTree, category) | raw }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if listType starts with 'promos' %}
|
||||||
|
{% for promo in promos %}
|
||||||
|
<a href="{{ path('app_promos', {'promo': promo.slug}) }}"><span class="badge bg-info">PROMO: {{ promo.tag }}</span></a>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if (listType starts with 'category_' and category == null) or not (listType starts with 'category_') or (listType starts with 'category_' and category is not null) %}
|
{% if (listType starts with 'category_' and category == null) or not (listType starts with 'category_') or (listType starts with 'category_' and category is not null) %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|||||||
Reference in New Issue
Block a user