diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html index 8b782e709c..febcba9eb5 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -3,6 +3,8 @@ {% load eventurl %} {% load money %} {% load thumb %} +{% load icon %} +{% load getitem %} {% load eventsignal %} {% load rich_text %} {% for tup in items_by_category %}{% with category=tup.0 items=tup.1 form_prefix=tup.2 %} @@ -43,7 +45,9 @@ {% endif %}
- {{ item.name }} + + {{ item.name }} + {% if item.description %}
{{ item.description|localize|rich_text }} @@ -119,7 +123,19 @@ data-price="{% if event.settings.display_net_prices %}{{ var.display_price.net|unlocalize }}{% else %}{{ var.display_price.gross|unlocalize }}{% endif %}" {% endif %}>
- {{ var }} + + {{ var }} + {% if cart.itemvarsums|getitem:var %} + + {% icon "shopping-cart" %} + {% blocktrans trimmed count amount=cart.itemvarsums|getitem:var %} + {{ amount }}× in your cart + {% plural %} + {{ amount }}× in your cart + {% endblocktrans %} + + {% endif %} + {% if var.description %}
{{ var.description|localize|rich_text }} @@ -264,7 +280,19 @@ {% endif %}
- {{ item.name }} + + {{ item.name }} + {% if cart.itemvarsums|getitem:item %} + + {% icon "shopping-cart" %} + {% blocktrans trimmed count amount=cart.itemvarsums|getitem:item %} + {{ amount }}× in your cart + {% plural %} + {{ amount }}× in your cart + {% endblocktrans %} + + {% endif %} + {% if item.description %}
{{ item.description|localize|rich_text }} diff --git a/src/pretix/presale/views/__init__.py b/src/pretix/presale/views/__init__.py index f450e41438..77a7d2dfb3 100644 --- a/src/pretix/presale/views/__init__.py +++ b/src/pretix/presale/views/__init__.py @@ -33,7 +33,7 @@ # License for the specific language governing permissions and limitations under the License. import copy import warnings -from collections import defaultdict +from collections import Counter, defaultdict from datetime import datetime, timedelta from decimal import Decimal from functools import wraps @@ -242,6 +242,10 @@ class CartMixin: minutes_left = None seconds_left = None + itemvarsums = Counter() + for p in cartpos: + itemvarsums[p.variation or p.item] += 1 + return { 'positions': positions, 'invoice_address': self.invoice_address, @@ -258,6 +262,7 @@ class CartMixin: 'max_expiry_extend': max_expiry_extend, 'is_ordered': bool(order), 'itemcount': sum(c.count for c in positions if not c.addon_to), + 'itemvarsums': itemvarsums, 'current_selected_payments': [ p for p in self.current_selected_payments(positions, fees, self.invoice_address) if p.get('multi_use_supported') diff --git a/src/pretix/static/pretixpresale/scss/main.scss b/src/pretix/static/pretixpresale/scss/main.scss index 97c54c975e..66ce9924da 100644 --- a/src/pretix/static/pretixpresale/scss/main.scss +++ b/src/pretix/static/pretixpresale/scss/main.scss @@ -574,6 +574,7 @@ h2 .label { .textbubble-success, .textbubble-success-warning, .textbubble-info, .textbubble-warning, .textbubble-danger { + display: inline-block; padding: 0 .4em; border-radius: $border-radius-base; font-weight: bold;