Group identical add-ons in cart (#2500)

Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
Raphael Michel
2022-03-01 15:49:16 +01:00
committed by GitHub
parent a9b0651345
commit b74f5508b7
7 changed files with 29 additions and 12 deletions

View File

@@ -177,7 +177,7 @@ class TemplateBasedMailRenderer(BaseHTMLMailRenderer):
op.variation,
op.subevent,
op.attendee_name,
(op.pk if op.addon_to_id else None),
op.addon_to_id,
(op.pk if op.has_addons else None)
)
)]

View File

@@ -1330,6 +1330,10 @@ class AbstractPosition(models.Model):
else:
return {}
@property
def item_and_variation(self):
return self.item, self.variation
@meta_info_data.setter
def meta_info_data(self, d):
self.meta_info = json.dumps(d)

View File

@@ -90,13 +90,16 @@
{% for groupkey, positions in cart %}
<tr>
<td>
{% if not groupkey.4 %} {# is addon #}
{% if not groupkey.4 %} {# is not addon #}
{{ positions|length }}x
{% endif %}
</td>
<td>
{% if groupkey.4 %} {# is addon #}
+
{% if positions|length > 1 %}
{{ positions|length }}x
{% endif %}
{% endif %}
{{ groupkey.0.name }}{% if groupkey.1 %} {{ groupkey.1.value }}{% endif %}
{% if groupkey.2 %} {# subevent #}