diff --git a/alkatorapi/views.py b/alkatorapi/views.py index ad6fa8c..7088bc1 100644 --- a/alkatorapi/views.py +++ b/alkatorapi/views.py @@ -388,7 +388,7 @@ def cart_buy(request): for cp in cart_products: if cp.quantity > cp.product.quantity: - return HttpResponse('{"status": "failed", "reason": "Nemáme dostatek ' + cp.product.name + ' na skladě!"}', status=400) + return HttpResponse('{"status": "failed", "reason": "Nemáme dostatek ' + cp.product.name + ' na skladě!"}', status=400, content_type='application/json') invoice = Invoice( user=user, @@ -411,6 +411,9 @@ def cart_buy(request): total_price += cp.quantity * cp.product.price ip.save() + if total_price <= 0: + return HttpResponse('{"status": "failed", "reason": "Prosím přidejte svoje položky do košíku!"}', status=400, content_type='application/json') + payment_data = { 'merchant': COMGATE_MERCHANT, 'test': 'true' if COMGATE_TEST else 'false', diff --git a/frontend/src/scripts/index.js b/frontend/src/scripts/index.js index c536f20..2e27ec7 100644 --- a/frontend/src/scripts/index.js +++ b/frontend/src/scripts/index.js @@ -344,7 +344,7 @@ class Main extends Component { } {this.state.page == "#eshop" && -