AgPerry's picture
Add files using upload-large-folder tool
d259c1a verified
Raw History Blame Contribute Delete
2.39 kB
{% extends "base.html" %}
{% block title %}Compare products{% endblock %}
{% block page_id %}compare{% endblock %}
{% block content %}
<div class="shell">
<h1 class="page-title">Compare Products</h1>
{% if not products %}
<div class="empty-results">
<p>Nothing to compare yet. Tick <strong>Compare</strong> on two or more items in any product list, then come back.</p>
<a class="btn btn-red" href="/departments/plumbing/plumbing-tools">Browse Plumbing Tools</a>
</div>
{% else %}
<div class="compare-scroll">
<table class="compare-table">
<thead>
<tr>
<th scope="col" class="compare-attr">Product</th>
{% for p in products %}
<th scope="col">
<a href="{{ canonical_pdp_path(p) }}"><img src="/static/img/products/{{ p.sku }}-0.svg" alt="" width="120" height="100"><br>{{ p.name }}</a>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
<tr><th scope="row">Brand</th>{% for p in products %}<td>{{ p.brand }}</td>{% endfor %}</tr>
<tr><th scope="row">Price</th>{% for p in products %}<td><strong>{{ money(p.price_minor) }}</strong>{% if p.was_price_minor %} <s>{{ money(p.was_price_minor) }}</s>{% endif %}</td>{% endfor %}</tr>
<tr><th scope="row">Rating</th>{% for p in products %}<td>{{ p.rating }} ({{ p.review_count }})</td>{% endfor %}</tr>
<tr><th scope="row">Availability</th>{% for p in products %}<td>{{ p.stock.replace('-', ' ') }}</td>{% endfor %}</tr>
{% for key in spec_keys %}
<tr><th scope="row">{{ key }}</th>{% for p in products %}<td>{{ p.specs.get(key, '&mdash;')|safe }}</td>{% endfor %}</tr>
{% endfor %}
<tr><th scope="row"></th>
{% for p in products %}
<td>
{% if p.stock != 'out-of-stock' %}
<form action="/cart/add" method="post">
<input type="hidden" name="sku" value="{{ p.sku }}">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="fulfillment" value="{{ 'delivery' if p.stock == 'online-only' else 'pickup' }}">
<input type="hidden" name="next" value="/compare?skus={{ products|map(attribute='sku')|join(',') }}">
<button class="btn btn-red" type="submit">Add to Cart</button>
</form>
{% else %}<span class="btn btn-disabled">Out of Stock</span>{% endif %}
</td>
{% endfor %}
</tr>
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock %}