Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merged in pigletto/django-lfs-0.7-raw (pull request #17)

  • Loading branch information...
commit 686351cc21c1ca1e210a6eb8389e3be0b4b15831 2 parents c0da75b + cc0f2bc
@diefenbach diefenbach authored
View
1  lfs/cart/models.py
@@ -373,6 +373,7 @@ def get_properties(self):
"display_price": property.display_price,
"value": value,
"price": price,
+ "obj": property
})
return properties
View
18 lfs/catalog/views.py
@@ -21,7 +21,7 @@
import lfs.core.utils
from lfs.caching.utils import lfs_get_object_or_404
from lfs.cart.views import add_to_cart
-from lfs.catalog.models import Category
+from lfs.catalog.models import Category, Property
from lfs.catalog.models import File
from lfs.catalog.models import Product
from lfs.catalog.models import ProductPropertyValue
@@ -112,17 +112,15 @@ def calculate_price(request, id):
for key, option_id in request.POST.items():
if key.startswith("property"):
try:
- po = PropertyOption.objects.get(pk=option_id)
- except (ValueError, PropertyOption.DoesNotExist):
- pass
- else:
- if po.property.add_price:
- try:
+ property_id = int(key.split('-')[1])
+ property = Property.objects.get(pk=property_id)
+ if property.is_select_field:
+ po = PropertyOption.objects.get(property=property, pk=option_id)
+ if property.add_price:
po_price = float(po.price)
- except (TypeError, ValueError):
- pass
- else:
property_price += po_price
+ except (IndexError, ValueError, TypeError, PropertyOption.DoesNotExist, Property.DoesNotExist):
+ pass
if product.for_sale:
for_sale_standard_price = product.get_standard_price(request, with_properties=False)
View
3  lfs/order/models.py
@@ -186,7 +186,8 @@ def get_properties(self):
"unit": property_value.property.unit,
"display_price": property_value.property.display_price,
"value": value,
- "price": price
+ "price": price,
+ "obj": property_value.property
})
return properties
View
2  lfs/static/js/lfs.js
@@ -403,4 +403,4 @@ $(document).ajaxSend(function(event, xhr, settings) {
if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken", $.cookie("csrftoken"));
}
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.