Show proper error message in case of add-ons that are required, sold-out and hidden (#4545)

This commit is contained in:
Mira
2024-10-21 16:46:32 +02:00
committed by GitHub
parent 2697ed0c5d
commit 22c36b89da
2 changed files with 6 additions and 1 deletions

View File

@@ -645,6 +645,7 @@ class AddOnsStep(CartMixin, AsyncAction, TemplateFlowStep):
ctx['forms'] = self.forms
ctx['cart'] = self.get_cart()
ctx['cross_selling_data'] = self.cross_selling_data
ctx['incomplete'] = not self.is_completed(self.request)
return ctx
def get_success_message(self, value):
@@ -660,7 +661,7 @@ class AddOnsStep(CartMixin, AsyncAction, TemplateFlowStep):
self.request = request
if 'async_id' in request.GET and settings.HAS_CELERY:
return self.get_result(request)
if len(self.forms) == 0 and len(self.cross_selling_data) == 0:
if len(self.forms) == 0 and len(self.cross_selling_data) == 0 and self.is_completed(request):
return redirect(self.get_next_url(request))
return TemplateFlowStep.get(self, request)

View File

@@ -11,6 +11,10 @@
<p>
{% trans "For some of the products in your cart, you can choose additional options before you continue." %}
</p>
{% elif incomplete %}
<div class="alert alert-danger">
{% trans "A product in your cart is only sold in combination with add-on products that are no longer available. Please contact the event organizer." %}
</div>
{% endif %}
<form class="form-horizontal" method="post" data-asynctask
data-asynctask-headline="{% trans "We're now trying to book these add-ons for you!" %}">