1 ##parameters=b_start=0, key='created', reverse=False
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.Plinn
.PloneMisc
import Batch
4 from Products
.photoprint
.utils
import Message
as _
5 from ZTUtils
import make_query
7 wtool
= getToolByName(context
, 'portal_workflow')
8 ctool
= getToolByName(context
, 'portal_catalog')
9 mtool
= getToolByName(context
, 'portal_membership')
10 utool
= getToolByName(context
, 'portal_url')
11 portal
= utool
.getPortalObject()
13 member
= mtool
.getAuthenticatedMember()
16 columns
= ( {'key': 'created',
21 'title': _('Reference'),
38 target
= context
.absolute_url()
40 for column
in columns
:
42 column
['images'] = None
44 options
['columns'] = columns
47 orders
= ctool(portal_type
='Order', listCreators
=member
.getId(), sort_on
='created', sort_order
='reverse')
49 def beforeGetItem(item
) :
50 item
= item
.getObject()
52 info
['url'] = item
.absolute_url()
53 info
['created'] = item
.created()
54 info
['reference'] = item
.getId()
55 info
['quantity'] = item
.quantity
56 info
['price'] = item
.amountWithFees
57 info
['state'] = wtool
.getInfoFor(item
, 'review_state', wf_id
='order_workflow')
60 orders
= Batch(orders
, context
.default_batch_size
, b_start
, orphan
=0, quantumleap
=1, before_getitem
=beforeGetItem
)
61 options
['orders'] = orders
65 , 'title' : portal
.title
66 , 'url' : portal_url
},
69 ,'title' : _('My orders')
70 , 'url' : '%s/my_orders' % portal_url
}
73 options
['breadcrumbs'] = breadcrumbs
75 return context
.my_orders_template(**options
)