Ejemplo n.º 1
0
 def generate_shipping(self):
     shippings = []
     shipping_profile = self.product.shipping_profile
     shipping_rules = shipping_profile.shipping_rules.all()
     native_price = None
     for shipping_rule in shipping_rules:
         for country in shipping_rule.countries.all():
             if country.code == self.country.code:
                 native_price = currency_convert(
                     float(shipping_rule.rule_price.amount), self.currency,
                     shipping_rule.rule_price.currency)
     # When it ships to the rest of the world, output at most 100 of the top
     # internet using countries.
     if shipping_profile.ships_worldwide():
         native_price = currency_convert(
             float(shipping_profile.others_price.amount), self.currency,
             shipping_profile.others_price.currency)
     if native_price:
         return native_price
     else:
         self.exclude = True
Ejemplo n.º 2
0
 def generate_price(self):
     price_obj = self.product.get_price_instance().amount
     native_price = currency_convert(float(price_obj.amount), self.currency,
                                     price_obj.currency)
     return self._gen("price", native_price)