Beispiel #1
0
 def get_namespace(self, resource, context):
     abspath = resource.get_abspath()
     cart = ProductCart(context)
     # Base namespace
     namespace = STLForm.get_namespace(self, resource, context)
     # Choose payments
     payments = resource.get_resource('payments')
     total_price = cart.get_total_price(resource)
     view = Payments_ChoosePayment(total_price=total_price)
     namespace['choose_payment'] = view.GET(payments, context)
     # Alert MSG
     namespace['alert_msg'] = MSG(
         u"""To continue, you have to validate the terms of sales!""")
     # Progress bar
     namespace['progress'] = Shop_Progress(index=5).GET(resource, context)
     # Get delivery and bill address namespace
     for key in ['delivery_address', 'bill_address']:
         id = cart.addresses[key]
         if id is not None:
             namespace[key] = resource.get_user_address_namespace(id)
         else:
             namespace[key] = None
     # Get products informations
     namespace['cart'] = Cart_View(see_actions=False).GET(resource, context)
     # Get user delivery country
     addresses = resource.get_resource('addresses').handler
     delivery_address = cart.addresses['delivery_address']
     record = addresses.get_record(delivery_address)
     country = addresses.get_record_value(record, 'country')
     return namespace
Beispiel #2
0
 def get_namespace(self, resource, context):
     abspath = resource.get_abspath()
     cart = ProductCart(context)
     # Base namespace
     namespace = STLForm.get_namespace(self, resource, context)
     # Choose payments
     payments = resource.get_resource('payments')
     total_price = cart.get_total_price(resource)
     view = Payments_ChoosePayment(total_price=total_price)
     namespace['choose_payment'] = view.GET(payments, context)
     # Alert MSG
     namespace['alert_msg'] = MSG(
       u"""To continue, you have to validate the terms of sales!""")
     # Progress bar
     namespace['progress'] = Shop_Progress(index=5).GET(resource, context)
     # Get delivery and bill address namespace
     for key in ['delivery_address', 'bill_address']:
         id = cart.addresses[key]
         if id is not None:
             namespace[key] = resource.get_user_address_namespace(id)
         else:
             namespace[key] = None
     # Get products informations
     namespace['cart'] = Cart_View(see_actions=False).GET(resource, context)
     # Get user delivery country
     addresses = resource.get_resource('addresses').handler
     delivery_address = cart.addresses['delivery_address']
     record = addresses.get_record(delivery_address)
     country = addresses.get_record_value(record, 'country')
     return namespace