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
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)
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 })
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)