Product index with price

pull/211/head
JamesRamm 2019-01-06 19:12:45 +01:00
rodzic cd64f01ba7
commit 7f9648546d
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -80,7 +80,7 @@ Finally, lets override the price getter to apply the discount:
@ProductVariantBase.price.getter
def price(self):
if self.discount:
discount_price = self.base_price * Decimal(self.discount_percent / 100.0 )
discount_price = self.base_price * Decimal((100 - self.discount_percent) / 100.0 )
return discount_price.quantize(Decimal('.01'), decimal.ROUND_HALF_UP)
return self.base_price
```

Wyświetl plik

@ -10,12 +10,13 @@
{% templatetag openblock %} for post in page.get_children {% templatetag closeblock %}
{% templatetag openblock %} with post=post.specific {% templatetag closeblock %}
<div class="card">
{% templatetag openblock %} image post.images.first.image max-500x320 {% templatetag closeblock %}
{% templatetag openblock %} image post.images.first.image max-400x320 {% templatetag closeblock %}
<div class="card-body">
<a href="{% templatetag openblock %} pageurl post {% templatetag closeblock %}">
<h4>{% templatetag openvariable %} post.title {% templatetag closevariable %}</h4>
</a>
<p>{% templatetag openvariable %} post.description|richtext {% templatetag closevariable %}</p>
<p>From &euro;{% templatetag openvariable %} post.price_range.0 {% templatetag closevariable %}</p>
</div>
</div>
{% templatetag openblock %} endwith {% templatetag closeblock %}