Skip to content

Commit d141086

Browse files
Fix HTTP 500 error during add-on product checkout (#1257)
Users encountered HTTP 500 Internal Server Error when purchasing products with add-ons during checkout. The error was caused by calling .products() method on dictionaries instead of .items(). Changed .products() to .items() in three files: - app/eventyay/presale/checkoutflowstep/add_ons_step.py (line 213) - app/eventyay/base/services/cart.py (line 918) - app/eventyay/api/serializers/event.py (line 270) This resolves HTTP 500 errors during checkout and allows users to complete purchases with add-on products. Co-authored-by: Mario Behling <[email protected]>
1 parent b20b051 commit d141086

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/eventyay/api/serializers/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def create(self, validated_data):
267267

268268
# Product Meta properties
269269
if product_meta_properties is not None:
270-
for key, value in product_meta_properties.products():
270+
for key, value in product_meta_properties.items():
271271
event.product_meta_properties.create(name=key, default=value, event=event)
272272

273273
# Seats

app/eventyay/base/services/cart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def set_addons(self, addons):
915915
for iao in product.addons.all():
916916
selected = selected_addons[cp.id, iao.addon_category_id]
917917
n_per_i = Counter()
918-
for (i, v), c in selected.products():
918+
for (i, v), c in selected.items():
919919
n_per_i[i] += c
920920
if sum(selected.values()) > iao.max_count:
921921
# TODO: Proper i18n

app/eventyay/presale/checkoutflowstep/add_ons_step.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def _clean_category(self, form, category):
210210

211211
total_selected_quantity = sum(a[0] for a in selected.values())
212212
exceeds_single_allowed = (
213-
any(sum(v[0] for k, v in selected.products() if k[0] == i) > 1 for i in category['products'])
213+
any(sum(v[0] for k, v in selected.items() if k[0] == i) > 1 for i in category['products'])
214214
and not category['multi_allowed']
215215
)
216216

0 commit comments

Comments
 (0)