def unmake_shopping_site(container, event): if container == event.object: parent = aq_parent(aq_inner(container)) noLongerProvides(parent, IShoppingSiteRoot) parent.reindexObject(idxs=['object_provides']) message = _(u"This container is no longer a shopping site.") IStatusMessage(container.REQUEST).addStatusMessage(message, type='warn')
def validate(self, value): super(ValidateOrderIDUniqueness, self).validate(value) if value is not None: brains = IShoppingSite(self.context).get_brains(depth=1, id=str(value)) if brains: raise Invalid(_(u'order-id-already-in-use', default=u'The order ID is already in use.'))
def description(self): """Returns description of view""" if self.order_container(): return _( u"next_order_id_description", u"The next order ID: ${order_id}", mapping={"order_id": self.order_container().next_order_id}, )
def fields(self): context = aq_inner(self.context) product = IProduct(context) res = [] price = dict( label=_(u'Price'), description='Input Price.', field='<input type="text" name="price" id="price" value="%s" size="6" />' % product.price, ) res.append(price) unlimited_stock_field = '<input type="checkbox" name="unlimited_stock" id="unlimited_stock" value="on" />' if product.unlimited_stock == True: unlimited_stock_field = '<input type="checkbox" name="unlimited_stock" id="unlimited_stock" value="on" checked="checked" />' unlimited_stock = dict( label=_(u'Unlimited Stock'), description=_(u'Check this if you have unlimited amount of stock.'), field=unlimited_stock_field, ) res.append(unlimited_stock) stock = dict( label=_(u'Stock'), description='Input Stock.', field='<input type="text" name="stock" id="stock" value="%s" size="5" />' % product.stock, ) res.append(stock) max_addable_quantity = dict( label=_(u'Maximum Addable Quantity'), description=_('You need to specify this if you checked Unlimited Stock.'), field='<input type="text" name="max_addable_quantity" id="max_addable_quantity" value="%s" size="5" />' % product.max_addable_quantity, ) res.append(max_addable_quantity) return res
class ICartFolderContentType(Interface): """Interface for CartFolder Content Type. """ contains('collective.cart.core.interfaces.ICartContentType', ) cart_id_numbering_method = schema.Choice( title=_(u"Cart ID Numbering Method"), description=_(u"Select Incremental or Random for Cart ID Numbering."), required=True, vocabulary='Numbering Method', default="Incremental", ) next_incremental_cart_id = schema.Int( title=_(u"Next Incremenatal Cart ID"), description=_( u"If Incrementanl Cart ID is seleceted, give interger number here." ), required=False, default=1, ) random_digits_cart_id = schema.Int( title=_(u"Random Digits Cart ID"), description=_( u"If Random Cart ID is selected, give integer digits here."), required=False, default=5, ) quantity_method = schema.Choice( title=_(u"Quantity Method"), description= _(u"Select one method, Select or Input to determine how to put products into cart." ), required=True, vocabulary="Quantity Methods", default="Select", )
def fields(self): context = aq_inner(self.context) product = IProduct(context) res = [] price = dict( label=_(u'Price'), description='Input Price.', field= '<input type="text" name="price" id="price" value="%s" size="6" />' % product.price, ) res.append(price) unlimited_stock_field = '<input type="checkbox" name="unlimited_stock" id="unlimited_stock" value="on" />' if product.unlimited_stock == True: unlimited_stock_field = '<input type="checkbox" name="unlimited_stock" id="unlimited_stock" value="on" checked="checked" />' unlimited_stock = dict( label=_(u'Unlimited Stock'), description=_( u'Check this if you have unlimited amount of stock.'), field=unlimited_stock_field, ) res.append(unlimited_stock) stock = dict( label=_(u'Stock'), description='Input Stock.', field= '<input type="text" name="stock" id="stock" value="%s" size="5" />' % product.stock, ) res.append(stock) max_addable_quantity = dict( label=_(u'Maximum Addable Quantity'), description=_( 'You need to specify this if you checked Unlimited Stock.'), field= '<input type="text" name="max_addable_quantity" id="max_addable_quantity" value="%s" size="5" />' % product.max_addable_quantity, ) res.append(max_addable_quantity) return res
def title(self): """Title shown in @@manage-portlets""" return _(u"Cart")
def __call__(self): self.request.set('disable_border', True) if not self.has_cart_folder: message = _(u"Please add CartFolder first.") IStatusMessage(self.request).addStatusMessage(message, type='warn') return self.template()
def title(self): """Title shown in @@manage-portlets. """ return _(u"Cart")
def title(self): message = _(u"order_view_title", default=u"Order ID: ${order_id}", mapping={"order_id": self.context.id}) return message
def label(self): return _(u"Total Cost")
def label(self): return _(u"Products Subtotal")
from collective.cart.core.interfaces import ICartFolderContentType from collective.cart.core.interfaces import ICartProductContentType from persistent.dict import PersistentDict from zope.interface import implements CartFolderSchema = ATFolderSchema.copy() + Schema(( StringField( name='cart_id_numbering_method', required=True, searchable=False, languageIndependent=True, storage=AnnotationStorage(), widget=SelectionWidget( label=_(u'Cart ID Numbering Method'), description=_(u'Select Incremental or Random for Cart ID Numbering.'), ), vocabulary=('Incremental', 'Random'), enforceVocabulary=True, default='Incremental', ), IntegerField( name='next_incremental_cart_id', required=False, searchable=False, languageIndependent=True, storage=AnnotationStorage(), widget=IntegerWidget( label=_(u'Next Incremental Cart ID'),
from collective.cart.core import PROJECTNAME from collective.cart.core.interfaces import ICartContentType from collective.cart.core.interfaces import ICartFolderContentType from collective.cart.core.interfaces import ICartProductContentType from persistent.dict import PersistentDict from zope.interface import implements CartFolderSchema = ATFolderSchema.copy() + Schema(( StringField( name='cart_id_numbering_method', required=True, searchable=False, languageIndependent=True, storage=AnnotationStorage(), widget=SelectionWidget( label=_(u'Cart ID Numbering Method'), description=_( u'Select Incremental or Random for Cart ID Numbering.'), ), vocabulary=('Incremental', 'Random'), enforceVocabulary=True, default='Incremental', ), IntegerField( name='next_incremental_cart_id', required=False, searchable=False, languageIndependent=True, storage=AnnotationStorage(), widget=IntegerWidget( label=_(u'Next Incremental Cart ID'),