@@ -0,0 +1,37 @@
|
||||
<%- include('partials/layout-start') %>
|
||||
|
||||
<article class="product-detail">
|
||||
<div class="product-detail__media">
|
||||
<% if (product.image_url) { %>
|
||||
<img src="<%= product.image_url %>" alt="<%= product.name %>" class="product-detail__image">
|
||||
<% } else { %>
|
||||
<div class="card__placeholder product-detail__image">Нет фото</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="product-detail__info">
|
||||
<% if (product.category_name) { %>
|
||||
<a href="/?category=<%= product.category_slug %>" class="card__category"><%= product.category_name %></a>
|
||||
<% } %>
|
||||
<h1><%= product.name %></h1>
|
||||
<p class="product-detail__price"><%= formatPrice(product.price_cents) %></p>
|
||||
<p class="product-detail__desc"><%= product.description %></p>
|
||||
<p class="product-detail__stock">В наличии: <strong><%= product.stock %></strong> шт.</p>
|
||||
|
||||
<% if (product.stock > 0) { %>
|
||||
<form action="/cart/add" method="post" class="product-detail__form">
|
||||
<input type="hidden" name="product_id" value="<%= product.id %>">
|
||||
<label class="label">
|
||||
Количество
|
||||
<input type="number" name="quantity" value="1" min="1" max="<%= product.stock %>" class="input input--qty">
|
||||
</label>
|
||||
<input type="hidden" name="redirect" value="/cart">
|
||||
<button type="submit" class="btn btn--primary btn--lg">Добавить в корзину</button>
|
||||
</form>
|
||||
<% } else { %>
|
||||
<p class="alert alert--warn">Нет в наличии</p>
|
||||
<% } %>
|
||||
<a href="/" class="link-back">← Назад в каталог</a>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<%- include('partials/layout-end') %>
|
||||
Reference in New Issue
Block a user