5ed50bfcbe0d512fbf5ab10312d77fb9ae351545
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 paymentRequest
= context
.getPaymentRequest()
24 options
['paymentRequest'] = paymentRequest
27 cart
.pendingOrderPath
== context
.getPhysicalPath() :
28 options
['orderIsCart'] = True
29 if wfstate
!= 'recorded' :
31 session
['cart'] = cart
33 options
['orderIsCart'] = False
35 for item
in context
.items
:
36 d
= {'title' : item
['title']
37 ,'description' : item
['description']
38 ,'unit_price' : item
['unit_price']
39 ,'quantity' : item
['quantity']
40 ,'total' : item
['unit_price'] * item
['quantity']
43 b
= uidh
.queryBrain(item
['cmf_uid'])
45 size
= b
.getThumbnailSize
46 thumbInfo
= {'thumbUrl' : '%s/getThumbnail' % b
.getURL()
47 ,'thumbHeight' : size
['height'] / 2
48 ,'thumbWidth' : size
['width'] / 2
49 ,'alt' : ('%s - %s' % (b
.Title
, b
.Description
)).strip(' -')
52 quantity
+= d
['quantity']
53 prices
.append(d
['total'])
56 options
['infos'] = infos
57 options
['quantity'] = quantity
58 options
['pricesSum'] = context
.price
59 options
['shippingFees'] = shippingFees
= context
.shippingFees
60 options
['total'] = context
.amountWithFees
62 return context
.order_view_template(**options
)