{% extends "base.html" %}
{% block t %}Shop{% endblock %}
{% block content %}
<div class="container">
<h2>
Shop
<a href="/cart" class="btn" style="float:right">Cart ({{ session.get('cart', {})|length }})</a>
</h2>
<form method="GET" style="display:flex; gap:8px; margin-bottom:16px">
<input name="search" placeholder="Search..." value="{{ search }}" style="width:auto; flex:1">
<select name="cat">
<option value="">All</option>
{% for category in cats %}
<option {% if category == cat %}selected{% endif %}>{{ category }}</option>
{% endfor %}
</select>
<button class="btn">Go</button>
{% if s or cat %}
<a href="/shop" class="btn d">Clear</a>
{% endif %}
</form>
<table>
<tr>
<th>Name</th>
<th>Producer</th>
<th>Category</th>
<th>Price</th>
<th>Stock</th>
<th></th>
</tr>
{% for product in products %}
<tr>
<td><a href="/product/{{ product.id }}">{{ product.name }}</a></td>
<td>{{ product.first_name }} {{ product.last_name }}</td>
<td>{{ product.cname }}</td>
<td>Ā£{{ "%.2f"|format(product.price) }}</td>
<td>{{ product.stock }}</td>
<td>
<form method="POST" action="/cart/add">
<input type="hidden" name="id" value="{{ product.id }}">
<input type="hidden" name="qty" value="1">
<button class="btn">Add</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="6">No products.</td></tr>
{% endfor %}
</table>
</div>
{% endblock %}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
Liquid syntax error: Unknown tag 'extends'