1930d317cbd823c9798d036d5071b8411cb2aa9b
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.photoprint
.price
import Price
4 from Products
.photoprint
.cart
import PrintCart
5 uidh
= getToolByName(context
, 'portal_uidhandler')
6 wtool
= getToolByName(context
, 'portal_workflow')
14 session
= context
.REQUEST
.SESSION
16 cart
= sg('cart', PrintCart())
17 wfstate
= wtool
.getInfoFor(context
, 'review_state', 'order_workflow')
18 options
['wfstate'] = wfstate
19 options
['wfhistory'] = wtool
.getInfoFor(context
, 'review_history', 'order_workflow')
20 toBePaid
= wfstate
== 'recorded'
23 options
['checkout'] = context
.ppSetExpressCheckout()
26 cart
.pendingOrderPath
== context
.getPhysicalPath() :
27 options
['orderIsCart'] = True
28 if wfstate
!= 'recorded' :
30 session
['cart'] = cart
32 options
['orderIsCart'] = False
34 for item
in context
.items
:
35 d
= {'title' : item
['title']
36 ,'description' : item
['description']
37 ,'unit_price' : item
['unit_price']
38 ,'quantity' : item
['quantity']
39 ,'total' : item
['unit_price'] * item
['quantity']
42 b
= uidh
.queryBrain(item
['cmf_uid'])
44 size
= b
.getThumbnailSize
45 thumbInfo
= {'thumbUrl' : '%s/getThumbnail' % b
.getURL()
46 ,'thumbHeight' : size
['height'] / 2
47 ,'thumbWidth' : size
['width'] / 2
48 ,'alt' : ('%s - %s' % (b
.Title
, b
.Description
)).strip(' -')
51 quantity
+= d
['quantity']
52 prices
.append(d
['total'])
55 options
['infos'] = infos
56 options
['quantity'] = quantity
57 options
['pricesSum'] = context
.price
58 options
['discount'] = getattr(context
, 'discount', 0)
59 options
['shippingFees'] = shippingFees
= context
.shippingFees
60 options
['total'] = context
.amountWithFees
62 return context
.order_view_template(**options
)