Example #1
0
    def get_namespace(self, resource, context):
        show_if_empty = resource.get_property('show_if_empty')
        cart = ProductCart(context)
        if (self.is_admin(resource, context) is False and
            cart.get_nb_products() == 0 and
            show_if_empty is False):
            self.set_view_is_empty(True)

        default_order_title = MSG(u'Commander')
        return merge_dicts(
            cart.get_namespace(resource),
            order_title=resource.get_property('order_title') or default_order_title,
            title=resource.get_title())
Example #2
0
 def get_namespace(self, resource, context):
     cart = ProductCart(context)
     nb_products = cart.get_nb_products()
     shop = get_shop(context.resource)
     # Get total price
     total = cart.get_total_price(shop, with_delivery=False)
     if shop.show_ht_price(context):
         total = total['without_tax']
     else:
         total = total['with_tax']
     # Return namespace
     return {'nb_products': nb_products,
             'total': total,
             'txts_class': 'hidden' if nb_products < 2 else '',
             'txt_class': 'hidden' if nb_products > 1 else ''}
Example #3
0
 def get_namespace(self, resource, context):
     cart = ProductCart(context)
     nb_products = cart.get_nb_products()
     shop = get_shop(context.resource)
     # Get total price
     total = cart.get_total_price(shop, with_delivery=False)
     if shop.show_ht_price(context):
         total = total['without_tax']
     else:
         total = total['with_tax']
     # Return namespace
     return {
         'nb_products': nb_products,
         'total': total,
         'txts_class': 'hidden' if nb_products < 2 else '',
         'txt_class': 'hidden' if nb_products > 1 else ''
     }