File size: 9,593 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{% extends "base.html" %}
{% block title %}{{ product.name }}{% endblock %}
{% block page_id %}pdp{% endblock %}
{% block content %}
<div class="shell">

<nav class="breadcrumbs" aria-label="Breadcrumb">
  {% for label, url in breadcrumbs %}
    {% if url %}<a href="{{ url }}">{{ label }}</a><span class="crumb-sep">/</span>{% else %}<span aria-current="page">{{ label }}</span>{% endif %}
  {% endfor %}
</nav>

<div class="pdp-layout">
  <section class="pdp-gallery" aria-label="Product images">
    <div class="gallery-main">
      <img id="gallery-main-img" src="/static/img/products/{{ product.sku }}-0.svg" alt="{{ product.name }}" width="480" height="400">
    </div>
    <div class="gallery-thumbs" id="gallery-thumbs">
      {% for i in image_ids %}
        <button class="thumb {{ 'is-active' if loop.first }}" data-img="/static/img/products/{{ product.sku }}-{{ i }}.svg" aria-label="Image {{ loop.index }}">
          <img src="/static/img/products/{{ product.sku }}-{{ i }}.svg" alt="" width="72" height="60">
        </button>
      {% endfor %}
    </div>
  </section>

  <section class="pdp-info">
    <p class="pdp-brand"><a href="/brands">{{ product.brand }}</a></p>
    <h1 class="pdp-title">{{ product.name }}</h1>
    <p class="pdp-sku">Item # {{ product.sku }}</p>
    <div class="pdp-rating">
      <span class="stars" style="--rating: {{ live_rating }}"></span>
      <a href="#reviews">{{ live_rating }} ({{ live_count }} review{{ 's' if live_count != 1 }})</a>
      <span class="dot-sep">&middot;</span>
      <a href="#qa">Ask a question</a>
    </div>

    <p class="pdp-price">
      <span class="price-now">{{ money(product.price_minor) }}</span>
      {% if product.was_price_minor %}
        <span class="price-was">{{ money(product.was_price_minor) }}</span>
        <span class="price-save">Save {{ money(product.was_price_minor - product.price_minor) }}</span>
      {% endif %}
    </p>
    {% if product.badge %}<p class="badge badge-inline">{{ product.badge }}</p>{% endif %}

    {% if variants %}
    <div class="variant-picker" aria-label="Choose a size">
      <p class="variant-label">Size</p>
      <div class="variant-row">
        {% for v in variants %}
          {% if v.current %}
            <span class="variant-chip is-current" aria-current="true">{{ v.label }} &middot; {{ money(v.price_minor) }}</span>
          {% else %}
            <a class="variant-chip {{ 'is-oos' if v.stock == 'out-of-stock' }}" href="{{ v.url }}">{{ v.label }} &middot; {{ money(v.price_minor) }}</a>
          {% endif %}
        {% endfor %}
      </div>
    </div>
    {% endif %}

    <div class="fulfillment-card">
      <p class="fulfill-store">
        {% if store_chosen %}At <strong>{{ store.name }}</strong>{% else %}Showing <strong>{{ store.name }}</strong> &middot; <a href="/store-locator">change store</a>{% endif %}
      </p>
      <div class="fulfill-tabs">
        <div class="fulfill-tab avail-{{ availability.state }}">
          <p class="tab-name">Pickup</p>
          {% if availability.state == 'in-stock' %}<p>Free pickup today &middot; {{ availability.quantity }} in stock</p>
          {% elif availability.state == 'low-stock' %}<p>Only {{ availability.quantity }} left today</p>
          {% elif availability.state == 'online-only' %}<p>Not available for pickup</p>
          {% else %}<p>Out of stock at this store</p>{% endif %}
        </div>
        <div class="fulfill-tab">
          <p class="tab-name">Delivery</p>
          {% if product.stock == 'out-of-stock' %}<p>Out of stock online</p>{% else %}<p>Free over $50, else $9.99</p>{% endif %}
        </div>
      </div>
    </div>

    {% if product.stock == 'out-of-stock' %}
      <div class="oos-box" id="oos-box">
        <p><strong>Out of stock.</strong> This item is temporarily unavailable online and for pickup.</p>
        {% if notify_requested %}
          <p class="notify-done">We will flag this item as back in stock on this device.</p>
        {% else %}
          <button class="btn btn-outline" id="notify-btn" data-sku="{{ product.sku }}">Notify me when it is back</button>
          <p class="notify-done" id="notify-done" hidden>Restock alert saved for this device.</p>
        {% endif %}
        <p>Meanwhile, <a href="/departments/{{ product.department }}/{{ product.category }}">browse similar {{ breadcrumbs[2][0] }}</a>.</p>
      </div>
    {% else %}
      <form class="pdp-add-form" action="/cart/add" method="post">
        <input type="hidden" name="sku" value="{{ product.sku }}">
        <input type="hidden" name="next" value="{{ canonical_path }}">
        <label class="qty-label" for="qty-select">Qty</label>
        <select id="qty-select" name="quantity">
          {% for q in range(1, 5) %}<option value="{{ q }}">{{ q }}</option>{% endfor %}
        </select>
        <input type="hidden" name="fulfillment" value="{{ 'delivery' if product.stock == 'online-only' else 'pickup' }}" id="fulfillment-input">
        <button class="btn btn-red btn-lg" type="submit" id="add-to-cart">Add to cart</button>
      </form>
      {% if product.stock == 'online-only' %}<p class="fulfill-note">This item ships to home only.</p>{% endif %}
    {% endif %}

    <div class="pdp-utility">
      <form action="/saved/toggle" method="post" class="inline-form">
        <input type="hidden" name="sku" value="{{ product.sku }}">
        <input type="hidden" name="next" value="{{ canonical_path }}">
        <button class="btn btn-ghost" type="submit">{{ 'Saved &#9829;'|safe if is_saved else 'Save &#9825;'|safe }}</button>
      </form>
      <button class="btn btn-ghost" id="share-btn" data-path="{{ canonical_path }}">Share</button>
      <span class="share-copied" id="share-copied" hidden>Link copied</span>
    </div>

    <div class="pdp-desc">
      <h2>About this item</h2>
      <p>{{ product.description }}</p>
      <ul>
        {% for b in product.bullets %}<li>{{ b }}</li>{% endfor %}
      </ul>
    </div>

    {% if product.specs %}
    <div class="pdp-specs">
      <h2>Specifications</h2>
      <table class="spec-table">
        {% for key, value in product.specs.items() %}
          <tr><th scope="row">{{ key }}</th><td>{{ value }}</td></tr>
        {% endfor %}
      </table>
    </div>
    {% endif %}
  </section>
</div>

<section class="shell-inner section" aria-label="Related items">
  <h2 class="section-title">You might also need</h2>
  <div class="reco-status" id="reco-status">
    <span class="spinner" aria-hidden="true"></span> Loading recommendations&hellip;
  </div>
  <div class="reco-error" id="reco-error" hidden>
    <p>Recommendations are unavailable right now.</p>
    <button class="btn btn-outline" id="reco-retry">Retry</button>
  </div>
  <div class="product-grid reco-grid" id="reco-grid" data-sku="{{ product.sku }}"
       data-simulate="{{ request.query_params.get('simulate', '') }}" hidden></div>
</section>

<section class="section shell-inner" id="reviews">
  <h2 class="section-title">Customer Reviews ({{ live_count }})</h2>
  {% if reviews %}
    <ul class="review-list">
      {% for r in reviews %}
        <li class="review">
          <div class="review-head">
            <span class="stars" style="--rating: {{ r.rating }}"></span>
            <strong>{{ r.title }}</strong>
          </div>
          <p class="review-body">{{ r.body }}</p>
          <p class="review-meta">By {{ r.author }}</p>
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <p>No reviews yet. Be the first to review this item.</p>
  {% endif %}

  <details class="write-review" id="write-review">
    <summary class="btn btn-outline">Write a review</summary>
    <form class="stacked-form" action="/reviews/{{ product.sku }}" method="post">
      {% if not account %}
        <label>Your name <input name="author" maxlength="40" placeholder="Ace Shopper"></label>
      {% endif %}
      <label>Rating
        <select name="rating" required>
          <option value="">Choose&hellip;</option>
          {% for n in range(5, 0, -1) %}<option value="{{ n }}">{{ n }} star{{ 's' if n != 1 }}</option>{% endfor %}
        </select>
      </label>
      <label>Title <input name="title" required minlength="3" maxlength="80"></label>
      <label>Review <textarea name="body" required minlength="10" rows="4"></textarea></label>
      <button class="btn btn-red" type="submit">Submit review</button>
    </form>
  </details>
</section>

<section class="section shell-inner" id="qa">
  <h2 class="section-title">Questions &amp; Answers ({{ questions|length }})</h2>
  {% if questions %}
    <ul class="qa-list">
      {% for q in questions %}
        <li class="qa-item">
          <p class="qa-q"><strong>Q:</strong> {{ q.body }} <span class="review-meta">&mdash; {{ q.author }}</span></p>
          {% if q.answer %}<p class="qa-a"><strong>A:</strong> {{ q.answer }}</p>{% else %}<p class="qa-a qa-pending">Waiting for an answer from the store team.</p>{% endif %}
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <p>No questions yet.</p>
  {% endif %}
  <details class="ask-question">
    <summary class="btn btn-outline">Ask a question</summary>
    <form class="stacked-form" action="/questions/{{ product.sku }}" method="post">
      {% if not account %}<label>Your name <input name="author" maxlength="40" placeholder="Ace Shopper"></label>{% endif %}
      <label>Question <textarea name="body" required minlength="10" rows="3"></textarea></label>
      <button class="btn btn-red" type="submit">Submit question</button>
    </form>
  </details>
</section>

</div>
{% endblock %}