remotes/origin/mitri4
spacenergy 10 years ago
parent 20859ba58c
commit 0ed3481f1b
  1. 6
      batiskaf/templates/jinja2/includes/category_product_thumb.jinja
  2. 5
      batiskaf/templates/jinja2/index.jinja
  3. 123
      batiskaf/templates/jinja2/product.jinja
  4. 2
      main/views.py
  5. 6
      store/models.py

@ -40,6 +40,12 @@
href="/store/cart/add/?pk={{ product.variations.filter(in_stock__gt=0).order_by('price').first().pk }}&count=1&next={{ request.get_full_path()|urlencode }}"><span><span
class="glyphicon glyphicon-shopping-cart"
aria-hidden="true"></span> Добавить в корзину</span></a>
{% elif product.delivery_date() %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Ожидается {{ product.delivery_date() }}</span></a>
{% else %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span

@ -65,6 +65,11 @@
<a class="btn btn-warning btn-block"
href="/store/cart/add/?pk={{ product.variations.filter(in_stock__gt=0).order_by('price').first().pk }}&count=1&next={{ request.get_full_path()|urlencode }}"><span><span
class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Добавить в корзину</span></a>
{% elif product.delivery_date() %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Ожидается {{ product.delivery_date() }}</span></a>
{% else %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span

@ -42,7 +42,10 @@
<!-- </a> -->
</div>
<br>
<p><small><em>Доставка по Казахстану: от 2 до 12 дней, в зависимости от выбранного способа доставки.</em></small></p>
<p>
<small><em>Доставка по Казахстану: от 2 до 12 дней, в зависимости от выбранного способа
доставки.</em></small>
</p>
</div>
</div>
@ -94,10 +97,19 @@
</div>
</div>
<div class="product-not-in-stock">
Товара нет в наличии <br/><br/><br/>
<a class=" btn btn-danger btn-block order-order-link" href="#order-form" data-itemid="{{ product.pk }}"
style="max-width: 200px"><span><span
class="glyphicon glyphicon-import" aria-hidden="true"></span> Заказать</span></a>
{% if product.delivery_date() %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Ожидается {{ product.delivery_date() }}</span></a>
{% else %}
Товара нет в наличии <br/><br/><br/>
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"
style="max-width: 200px"><span><span
class="glyphicon glyphicon-import" aria-hidden="true"></span> Заказать</span></a>
{% endif %}
</div>
<br>
<div class="text-success" style="font-size: 13px"><em>Цены и наличие товара актуальны
@ -117,67 +129,74 @@
{{ product.description|linebreaks|safe }}
</div>
{% if product.video %}
<br>
<h5 class="text-left">Видео обзор</h5>
<div class="video-obzor">
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{product.video}}" frameborder="0" allowfullscreen></iframe>
</div><br>
{%endif%}
<br>
<h5 class="text-left">Видео обзор</h5>
<div class="video-obzor">
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{ product.video }}" frameborder="0"
allowfullscreen></iframe>
</div><br>
{% endif %}
{% if ranee %}
<hr class="dashed"/>
<h4>Ранее просмотренные товары</h4>
<hr class="dashed"/>
<h4>Ранее просмотренные товары</h4>
<div class="index-goods">
<div class="row">
{% for product in ranee %}
<div class="col-md-3 col-xs-3 col-sm-3 col-lg-3">
<div class="thumbnail">
{% set im = product.main_image()|thumbnail("420x420") %}
<a href="{{ product.get_absolute_url() }}"><img src="/static/{{ im.url }}"
class="img-responsive"
alt="Купить {{ product.title }}"
title="Купить {{ product.title }}"></a>
<div class="caption">
<div class="title">
<a href="{{ product.get_absolute_url() }}">
{{ product.title }}
</a>
</div>
<div class="price">
{{ product.min_price(request.user) }} ₸
</div>
{% if product.in_stock() %}
<div class="state-yes">
<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> Товар
есть в наличии
<div class="index-goods">
<div class="row">
{% for product in ranee %}
<div class="col-md-3 col-xs-3 col-sm-3 col-lg-3">
<div class="thumbnail">
{% set im = product.main_image()|thumbnail("420x420") %}
<a href="{{ product.get_absolute_url() }}"><img src="/static/{{ im.url }}"
class="img-responsive"
alt="Купить {{ product.title }}"
title="Купить {{ product.title }}"></a>
<div class="caption">
<div class="title">
<a href="{{ product.get_absolute_url() }}">
{{ product.title }}
</a>
</div>
{% else %}
<div class="state-no">
<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> Товара
нет в наличии
<div class="price">
{{ product.min_price(request.user) }} ₸
</div>
{% endif %}
<div class="in-cart">
{% if product.in_stock() %}
<a class="btn btn-warning btn-block"
href="/store/cart/add/?pk={{ product.variations.filter(in_stock__gt=0).order_by('price').first().pk }}&count=1&next={{ request.get_full_path()|urlencode }}"><span><span
class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Добавить в корзину</span></a>
<div class="state-yes">
<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> Товар
есть в наличии
</div>
{% else %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Заказать</span></a>
<div class="state-no">
<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span> Товара
нет в наличии
</div>
{% endif %}
<div class="in-cart">
{% if product.in_stock() %}
<a class="btn btn-warning btn-block"
href="/store/cart/add/?pk={{ product.variations.filter(in_stock__gt=0).order_by('price').first().pk }}&count=1&next={{ request.get_full_path()|urlencode }}"><span><span
class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> Добавить в корзину</span></a>
{% elif product.delivery_date() %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Ожидается {{ product.delivery_date() }}</span></a>
{% else %}
<a class=" btn btn-danger btn-block order-order-link" href="#order-form"
data-itemid="{{ product.pk }}"><span><span
class="glyphicon glyphicon-import"
aria-hidden="true"></span> Заказать</span></a>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
</div>

@ -109,7 +109,7 @@ def temp_count_update(request, article):
product.delivery_date = delivery_date
product.save()
if delivery_date is None:
product.delivery_date = ''
product.delivery_date = None
product.save()
else:
retval['error_code'] = 1

@ -203,6 +203,12 @@ class Product(models.Model):
def in_stock(self):
return self.variations.filter(in_stock__gt=0).count()
def delivery_date(self):
try:
return self.variations.filter(delivery_date__isnull=False)[0].delivery_date
except:
return None
def min_price_variation(self):
min_v = None
for v in self.variations.all():

Loading…
Cancel
Save