Пример #1
0
class Cart(BrowserView):
    """view of the shopping cart
    """

    template = ViewPageTemplateFile('cart.pt')

    def __call__(self):
        self.request.set('disable_border', 1)
        self.cart = IShoppingCart(self.context)
        return self.template()
    
    @property
    @memoize
    def size(self):
        return self.cart.amount()
    
    @property
    @memoize
    def products(self):
        return self.cart.getProducts()
    
    @property
    @memoize
    def checkout(self):
        return getToolByName(self.context, 'portal_membership').checkPermission(CheckOut, self.context)
    
    @property
    @memoize
    def price(self):
        return CurrencyAware(self.cart.getPrice())
    
    @property 
    @memoize
    def taxincl(self):
        taxes = ITaxes(self.context)
        return {'tax': taxes.taxincl[0],
                'taxname': taxes.taxincl[1]}
        
Пример #2
0
class Cart(BrowserView):
    """view of the shopping cart
    """

    template = ViewPageTemplateFile('cart.pt')

    def __call__(self):
        self.request.set('disable_border', 1)
        self.cart = IShoppingCart(self.context)
        return self.template()

    @property
    @memoize
    def size(self):
        return self.cart.amount()

    @property
    @memoize
    def products(self):
        return self.cart.getProducts()

    @property
    @memoize
    def checkout(self):
        return getToolByName(self.context,
                             'portal_membership').checkPermission(
                                 CheckOut, self.context)

    @property
    @memoize
    def price(self):
        return CurrencyAware(self.cart.getPrice())

    @property
    @memoize
    def taxincl(self):
        taxes = ITaxes(self.context)
        return {'tax': taxes.taxincl[0], 'taxname': taxes.taxincl[1]}
Пример #3
0
class Renderer(base.Renderer):

    def update(self):
        self.cart = IShoppingCart(self.context)

    @property
    def portal_url(self):
        portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state')
        return portal_state.portal_url()
    
    @property
    def size(self):
        return self.cart.amount()
    
    @property
    def price(self):
        return CurrencyAware(self.cart.getPrice())
    
    @property
    def checkout(self):
        return getToolByName(self.context, 'portal_membership').checkPermission(CheckOut, self.context)

    render = ViewPageTemplateFile('cart.pt')