|
|
|
@ -62,12 +62,19 @@ def temp_count_update(request, article): |
|
|
|
try: |
|
|
|
try: |
|
|
|
product = ProductVariation.objects.get(article__iexact=article) |
|
|
|
product = ProductVariation.objects.get(article__iexact=article) |
|
|
|
count = request.GET.get('count', None) |
|
|
|
count = request.GET.get('count', None) |
|
|
|
|
|
|
|
price = request.GET.get('price', None) |
|
|
|
if count != None: |
|
|
|
if count != None: |
|
|
|
count = count.replace(',', '.') |
|
|
|
count = count.replace(',', '.') |
|
|
|
if int(count) < 0: |
|
|
|
if int(count) < 0: |
|
|
|
count = 0 |
|
|
|
count = 0 |
|
|
|
product.in_stock = int(count) |
|
|
|
product.in_stock = int(count) |
|
|
|
product.save() |
|
|
|
product.save() |
|
|
|
|
|
|
|
if price != None: |
|
|
|
|
|
|
|
price = price.replace(',', '.') |
|
|
|
|
|
|
|
if int(price) < 0: |
|
|
|
|
|
|
|
price = 0 |
|
|
|
|
|
|
|
product.price = int(price) |
|
|
|
|
|
|
|
product.save() |
|
|
|
else: |
|
|
|
else: |
|
|
|
retval['error_code'] = 1 |
|
|
|
retval['error_code'] = 1 |
|
|
|
except ProductVariation.DoesNotExist: |
|
|
|
except ProductVariation.DoesNotExist: |
|
|
|
|