示例#1
0
 def order_from_request(self, request, create=False):
     order = super(CalendarShop, self).order_from_request(request, create)
     if order:
         # set custom order currency
         order.currency = get_currency_code(request)
         order.save()
     return order
示例#2
0
    def default_currency(self, request=None):
        """
        Return the default currency for instantiating new orders

        Override this with your own implementation if you have a
        multi-currency shop with auto-detection of currencies.
        """
        return get_currency_code(request)
示例#3
0
def shipping_payment(request):
    currency = get_currency_code(request)
    data = {}
    for i in range(1, 11) + [1000]:
        data.setdefault(i, [])
        for shipreg in ShippingRegion.objects.filter(shipping__name=u'Česká pošta'):
            if shipreg.quantity_min <= i <= shipreg.quantity_max:
                price = shipreg.shipping.get_shipping_price(quantity=i, currency=currency, region=shipreg.region)
                data[i].append((shipreg.region.name, price))
    return render(request, 'calendareshop/shipping_payment.html', {
        'shipping_prices': data,
        'currency': currency
    })
示例#4
0
def shipping_payment(request):
    currency = get_currency_code(request)
    data = {}
    for i in range(1, 11) + [1000]:
        data.setdefault(i, [])
        for shipreg in ShippingRegion.objects.filter(shipping__name=u'Česká pošta'):
            if shipreg.quantity_min <= i <= shipreg.quantity_max:
                price = shipreg.shipping.get_shipping_price(quantity=i, currency=currency, region=shipreg.region)
                data[i].append((shipreg.region.name, price))
    return render(request, 'calendareshop/shipping_payment.html', {
        'shipping_prices': data,
        'currency': currency
    })
示例#5
0
def get_price(context, product):
    request = context['request']
    currency = get_currency_code(request)
    return frmt_price(product.get_price(currency).unit_price,
                      currency,
                      decimals=0)
示例#6
0
def get_price(context, product):
    request = context['request']
    currency = get_currency_code(request)
    return frmt_price(product.get_price(currency).unit_price, currency, decimals=0)