File size: 2,393 Bytes
d259c1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{% 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 %}