kopia lustrzana https://github.com/longclawshop/longclaw
Product index with price
rodzic
cd64f01ba7
commit
7f9648546d
|
@ -80,7 +80,7 @@ Finally, lets override the price getter to apply the discount:
|
||||||
@ProductVariantBase.price.getter
|
@ProductVariantBase.price.getter
|
||||||
def price(self):
|
def price(self):
|
||||||
if self.discount:
|
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 discount_price.quantize(Decimal('.01'), decimal.ROUND_HALF_UP)
|
||||||
return self.base_price
|
return self.base_price
|
||||||
```
|
```
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
{% templatetag openblock %} for post in page.get_children {% templatetag closeblock %}
|
{% templatetag openblock %} for post in page.get_children {% templatetag closeblock %}
|
||||||
{% templatetag openblock %} with post=post.specific {% templatetag closeblock %}
|
{% templatetag openblock %} with post=post.specific {% templatetag closeblock %}
|
||||||
<div class="card">
|
<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">
|
<div class="card-body">
|
||||||
<a href="{% templatetag openblock %} pageurl post {% templatetag closeblock %}">
|
<a href="{% templatetag openblock %} pageurl post {% templatetag closeblock %}">
|
||||||
<h4>{% templatetag openvariable %} post.title {% templatetag closevariable %}</h4>
|
<h4>{% templatetag openvariable %} post.title {% templatetag closevariable %}</h4>
|
||||||
</a>
|
</a>
|
||||||
<p>{% templatetag openvariable %} post.description|richtext {% templatetag closevariable %}</p>
|
<p>{% templatetag openvariable %} post.description|richtext {% templatetag closevariable %}</p>
|
||||||
|
<p>From €{% templatetag openvariable %} post.price_range.0 {% templatetag closevariable %}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% templatetag openblock %} endwith {% templatetag closeblock %}
|
{% templatetag openblock %} endwith {% templatetag closeblock %}
|
||||||
|
|
Ładowanie…
Reference in New Issue