From d44621628a462fc5b9ab35e927cfb579cefc5710 Mon Sep 17 00:00:00 2001 From: werners Date: Tue, 23 Sep 2008 14:02:55 +0000 Subject: [PATCH] Category git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2902 fd906abe-77d9-0310-91a1-e0d9ade77398 --- commerce/interfaces.py | 12 +++++++++++- commerce/product.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/commerce/interfaces.py b/commerce/interfaces.py index 89230ed..ebd2e6d 100644 --- a/commerce/interfaces.py +++ b/commerce/interfaces.py @@ -189,11 +189,21 @@ class ICategory(Interface): default=u'', missing_value=u'', required=False) + order = schema.Int( + title=_(u'Sortingorder'), + description=_(u'Sortingorder'), + default=0, + required=False) + visible = schema.Bool( + title=_(u'Visible'), + description=_(u'Visible in Menu'), + default=True, + required=False) products = Attribute(u'The products belonging to this category.') subcategories = Attribute(u'The sub-categories belonging to this category.') shops = Attribute(u'The shops providing this category.') - + accessories = Attribute(u'Accessories for this category.') # customers diff --git a/commerce/product.py b/commerce/product.py index e10ee14..063d3ff 100644 --- a/commerce/product.py +++ b/commerce/product.py @@ -25,7 +25,7 @@ $Id$ from zope.interface import implements, Interface from cybertools.commerce.common import RelationSet -from cybertools.commerce.interfaces import IProduct +from cybertools.commerce.interfaces import IProduct, ICategory class Product(object): @@ -39,3 +39,13 @@ class Product(object): self.title = title or u'unknown' self.shops = self.collection(self, 'products') +class Category(object): + + implements(ICategory) + + collection = RelationSet + + def __init__(self, title=None): + self.title = title or u'unknown' + self.shops = self.collection(self, 'categories') +