Ejemplo n.º 1
0
class PostalShippingModifier(ShippingModifier):
    identifier = 'postal-shipping'
    shipping_provider = DefaultShippingProvider()

    def get_choice(self):
        return (self.identifier, _("Postal shipping"))

    def add_extra_cart_row(self, cart, request):
        if not self.is_active(cart) and len(
                cart_modifiers_pool.get_shipping_modifiers()) > 1:
            return
        # postal tarifs by Siarhei
        if cart.total_weight < 1:
            amount = Money('4')
        elif cart.total_weight >= 1 and cart.total_weight < 3:
            amount = Money('7.5')
        elif cart.total_weight >= 3 and cart.total_weight < 15:
            amount = Money('10')
        elif cart.total_weight >= 15 and cart.total_weight < 30:
            amount = Money('20')
        elif cart.total_weight > 30:
            amount = Money('500')
        else:
            amount = Money('999')
        # add a shipping flat fee
        instance = {'label': _("Shipping costs"), 'amount': amount}
        cart.extra_rows[self.identifier] = ExtraCartRow(instance)
        cart.total += amount
Ejemplo n.º 2
0
class PostalPremiumShippingModifier(ShippingModifier):
    "class implement premium shipping modifier (from post to door)"
    identifier = 'postal-shipping-premium'
    shipping_provider = DefaultShippingProvider()

    def get_choice(self):
        return (self.identifier, _("Доставка почтой до дверей."))

    def add_extra_cart_row(self, cart, request):
        if not self.is_active(cart) and len(
                cart_modifiers_pool.get_shipping_modifiers()) > 1:
            return
        # postal tarifs by Siarhei
        if cart.total_weight < 1:
            amount = Money('6')
        elif cart.total_weight >= 1 and cart.total_weight < 3:
            amount = Money('9')
        elif cart.total_weight >= 3 and cart.total_weight < 15:
            amount = Money('12')
        elif cart.total_weight >= 15 and cart.total_weight < 30:
            amount = Money('23')
        elif cart.total_weight > 30:
            amount = Money('500')
        else:
            amount = Money('999')
        # add a shipping flat fee
        instance = {'label': _("Shipping costs to home"), 'amount': amount}
        cart.extra_rows[self.identifier] = ExtraCartRow(instance)
        cart.total += amount
Ejemplo n.º 3
0
class SelfCollectionModifier(ShippingModifier):
    """
    This modifiers has not influence on the cart final. It can be used,
    to enable the customer to pick up the products in the shop.
    """
    identifier = 'self-collection'
    shipping_provider = DefaultShippingProvider()

    def get_choice(self):
        return (self.identifier, _("Self collection"))
Ejemplo n.º 4
0
class PostalShippingModifier(ShippingModifier):
    identifier = 'postal-shipping'
    shipping_provider = DefaultShippingProvider()

    def get_choice(self):
        return (self.identifier, _("Postal shipping"))

    def add_extra_cart_row(self, cart, request):
        if not self.is_active(cart) and len(
                cart_modifiers_pool.get_shipping_modifiers()) > 1:
            return
        # add a shipping flat fee
        amount = Money('5')
        instance = {'label': _("Shipping costs"), 'amount': amount}
        cart.extra_rows[self.identifier] = ExtraCartRow(instance)
        cart.total += amount
Ejemplo n.º 5
0
class CourierModifier(ShippingModifier):
    identifier = 'courier-delivery'
    shipping_provider = DefaultShippingProvider()

    def get_choice(self):
        return (self.identifier, _("Courier delivery. Onliy within Minsk"))

    def add_extra_cart_row(self, cart, request):
        if not self.is_active(cart) and len(
                cart_modifiers_pool.get_shipping_modifiers()) > 1:
            return
        # add a shipping flat fee
        amount = Money('3')
        instance = {'label': _("Courier shipping costs"), 'amount': amount}
        cart.extra_rows[self.identifier] = ExtraCartRow(instance)
        cart.total += amount