# -*- coding: utf-8 -*-
from django import forms
+from django.utils.translation import ugettext_lazy as _
from cartridge.shop import checkout
from cartridge.shop.utils import set_shipping
from operator import itemgetter
COUNTRY_CHOICES = tuple(sorted(COUNTRY_CHOICES, key=itemgetter(1)))
-
+
from payments.multipayments.forms.base import CallbackUUIDOrderForm
# See https://github.com/SmileyChris/django-countries/blob/master/django_countries/data.py#L46
shipping_type = "shipping rate"
shipping_total = 15
-
+
if order_form is not None:
shipping_detail_country = order_form.cleaned_data['shipping_detail_country']
if shipping_detail_country == 'FR':
else:
shipping_type = _("Colissimo recommande shipping")
shipping_total = 10
-
+
elif shipping_detail_country in EURO_ZONE:
if (request.cart.total_price() <= 50) & (request.cart.total_quantity()< 6):
shipping_type = _("SIMPLE REGISTERED PRIORITY PARCEL shipping")
shipping_total = 25
-
+
if not request.session.get("free_shipping"):
settings.use_editable()
print shipping_type, shipping_total
(1,"INTERNATIONAL COLISSIMO (INSURED)"),
(2,"COLISSIMO (France only)"),
(3,"COLISSIMO RECOMMANDE (France only)"),
- )
+ )
self.fields['billing_detail_country'].widget = billing_country
self.fields['shipping_detail_country'].widget = shipping_country
-
-
+
+
## if step == checkout.CHECKOUT_STEP_PAYMENT:
## print "Payment step"
## if self.is_valid():
## data = self.cleaned_data
## if data["shipping_detail_country"] == 'France':
- ## print ' ----- FRANCE ----'
+ ## print ' ----- FRANCE ----'
## choices = SHIPPING_CHOICES[2:3]
## self.fields["shipping_method"].choices = choices
## else:
## print self.fields["shipping_detail_country"]
## else:
## print "Pas VALIDE"
-
+
## class Meta(CallbackUUIDOrderForm.Meta):
- ##
+ ##
## fields = CallbackUUIDOrderForm.Meta.fields + ["shipping_method"]
## print fields