class GroupDiscountFormBase(DiscountFormBase): header_template = 'group_header.pt' for_attribute = FOR_GROUP for_label = _('discount_form_label_group', default=u'Group') for_required = _('discount_form_group_required', default=u'Group is required') for_callback = 'javascript:discount_form.autocomplete_group' for_mode = 'edit'
class UserDiscountFormBase(DiscountFormBase): header_template = 'user_header.pt' for_attribute = FOR_USER for_label = _('discount_form_label_user', default=u'User') for_required = _('discount_form_user_required', default=u'User is required') for_callback = 'javascript:discount_form.autocomplete_user' for_mode = 'edit'
class CartDiscountView(DiscountView): title = _('cart_discount_title', default=u'Discount for Cart') default_form = 'cart_discount_form' related_forms = [ ('cart_discount_form', _('cart_discount_form', default=u'General Rules for Cart')), ('user_cart_discount_form', _('user_cart_discount_form', default=u'User Rules for Cart')), ('group_cart_discount_form', _('group_cart_discount_form', default=u'Group Rules for Cart')), ]
def next(self, request): message = translate( _("changes_saved", default=u"Changes Saved"), context=self.request ) continuation = [AjaxMessage(message, "info", None)] ajax_continue(self.request, continuation) return False
def next(self, request): message = _('changes_saved', default=u'Changes Saved') continuation = [ AjaxMessage(message, 'info', None) ] ajax_continue(self.request, continuation) return False
def title(self): title = self.context.Title() # Not sure whether Title() may already return unicode in some # circumstance. If not, remove condition. if not isinstance(title, unicode): title = title.decode('utf-8') return _('cart_item_discount_title', default=u'Discount for "${title}"', mapping={'title': title})
def portal_type_vocabulary(self): site = getSite() portal_types = getToolByName(site, 'portal_types', None) request = aq_get(portal_types, 'REQUEST', None) vocab = [(ALL_PORTAL_TYPES, _('all', default=u'All'))] for portal_type in portal_types.listContentTypes(): vocab.append((portal_type, translate(portal_types[portal_type].Title(), context=request))) return vocab
def rendered_filter(self): selection = factory( 'label:select', name='discount_form_filter', value=self.default_form, props={ 'vocabulary': self.related_forms, 'label': _('discount_rules', default=u'Discount Rules'), } ) return selection(request=self.request)
def rendered_filter(self): selection = factory('label:select', name='discount_form_filter', value=self.default_form, props={ 'vocabulary': self.related_forms, 'label': _('discount_rules', default=u'Discount Rules'), }) return selection(request=self.request)
def portal_type_vocabulary(self): site = getSite() portal_types = getToolByName(site, "portal_types", None) request = aq_get(portal_types, "REQUEST", None) vocab = [(ALL_PORTAL_TYPES, _("all", default=u"All"))] for portal_type in portal_types.listContentTypes(): vocab.append( ( portal_type, translate(portal_types[portal_type].Title(), context=request), ) ) return vocab
class ItemDiscountView(DiscountView): default_form = 'cart_item_discount_form' related_forms = [ ('cart_item_discount_form', _('cart_item_discount_form', default=u'General Rules for Cart Items')), ('user_cart_item_discount_form', _('user_cart_item_discount_form', default=u'User Rules for Cart Items')), ('group_cart_item_discount_form', _('group_cart_item_discount_form', default=u'Group Rules for Cart Items')), ] @property def title(self): title = self.context.Title() # Not sure whether Title() may already return unicode in some # circumstance. If not, remove condition. if not isinstance(title, unicode): title = title.decode('utf-8') return _('cart_item_discount_title', default=u'Discount for "${title}"', mapping={'title': title})
def next(self, request): message = translate(_('changes_saved', default=u'Changes Saved'), context=self.request) continuation = [AjaxMessage(message, 'info', None)] ajax_continue(self.request, continuation) return False
def kind_vocabulary(self): return [ (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))), (KIND_OFF, _('off', _('off', default=u'Off'))), (KIND_ABSOLUTE, _('absolute', _('absolute', default=u'Absolute'))), ]
def kind_vocabulary(self): return [ (KIND_PERCENT, _('percent', _('percent', default=u'Percent'))), (KIND_OFF, _('off', _('off', default=u'Off'))), ]
def kind_vocabulary(self): return [ (KIND_PERCENT, _("percent", default=u"Percent")), (KIND_OFF, _("off", default=u"Off")), ]
def threshold_calculation_vocabulary(self): return [ (THRESHOLD_PRICE, _("price", default=u"Price")), (THRESHOLD_ITEM_COUNT, _("item_count", default=u"Item Count")), ]
def threshold_calculation_vocabulary(self): return [(THRESHOLD_PRICE, _("price", default=u"Price"))]
def threshold_calculation_vocabulary(self): return [(THRESHOLD_PRICE, _('price', default=u'Price'))]
def threshold_calculation_vocabulary(self): return [ (THRESHOLD_PRICE, _('price', default=u'Price')), (THRESHOLD_ITEM_COUNT, _('item_count', default=u'Item Count')), ]
def kind_vocabulary(self): return [ (KIND_PERCENT, _("percent", default=u"Percent")), (KIND_OFF, _("off", default=u"Off")), (KIND_ABSOLUTE, _("absolute", default=u"Absolute")), ]