mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
show discount notice on all categories with an available discount, not only those with cross_selling_condition=discount
This commit is contained in:
@@ -68,6 +68,8 @@ class CrossSellingService:
|
|||||||
'')
|
'')
|
||||||
for (category, items_qs, discount_info) in self._applicable_categories(0)
|
for (category, items_qs, discount_info) in self._applicable_categories(0)
|
||||||
)
|
)
|
||||||
|
for category, items, form_prefix in result:
|
||||||
|
category.has_discount = any(item.original_price for item in items)
|
||||||
return [(category, items, form_prefix) for (category, items, form_prefix) in result if len(items) > 0]
|
return [(category, items, form_prefix) for (category, items, form_prefix) in result if len(items) > 0]
|
||||||
|
|
||||||
def _applicable_categories(self, subevent_id):
|
def _applicable_categories(self, subevent_id):
|
||||||
@@ -182,7 +184,7 @@ class CrossSellingService:
|
|||||||
max_count = inf
|
max_count = inf
|
||||||
|
|
||||||
# calculate discounted price
|
# calculate discounted price
|
||||||
if discount_rule:
|
if discount_rule and discount_rule.benefit_discount_matching_percent > 0:
|
||||||
if not item.has_variations:
|
if not item.has_variations:
|
||||||
item.original_price = item.original_price or item.display_price
|
item.original_price = item.original_price or item.display_price
|
||||||
previous_price = item.display_price
|
previous_price = item.display_price
|
||||||
@@ -192,6 +194,8 @@ class CrossSellingService:
|
|||||||
)
|
)
|
||||||
item.display_price = new_price
|
item.display_price = new_price
|
||||||
else:
|
else:
|
||||||
|
# discounts always match "whole" items, not specific variations -> we apply the discount to all
|
||||||
|
# available variations of the item
|
||||||
for var in item.available_variations:
|
for var in item.available_variations:
|
||||||
var.original_price = var.original_price or var.display_price
|
var.original_price = var.original_price or var.display_price
|
||||||
previous_price = var.display_price
|
previous_price = var.display_price
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% include "pretixpresale/event/fragment_product_list.html" with items_by_category=cross_selling_data ev=event is_cross_selling=True %}
|
{% include "pretixpresale/event/fragment_product_list.html" with items_by_category=cross_selling_data ev=event %}
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
{% if category %}
|
{% if category %}
|
||||||
<section aria-labelledby="{{ form_prefix }}category-{{ category.id }}"{% if category.description %} aria-describedby="{{ form_prefix }}category-info-{{ category.id }}"{% endif %}>
|
<section aria-labelledby="{{ form_prefix }}category-{{ category.id }}"{% if category.description %} aria-describedby="{{ form_prefix }}category-info-{{ category.id }}"{% endif %}>
|
||||||
<h3 id="{{ form_prefix }}category-{{ category.id }}">{{ category.name }}
|
<h3 id="{{ form_prefix }}category-{{ category.id }}">{{ category.name }}
|
||||||
{% if is_cross_selling and category.cross_selling_condition == 'discounts' %}
|
{% if category.has_discount %}
|
||||||
<small class="text-success"><i class="fa fa-star"></i> {% trans "Your order qualifies for a discount" %}</small>
|
<small class="text-success"><i class="fa fa-star"></i> {% trans "Your order qualifies for a discount" %}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user