I have overridden this template too a while ago. The code should still
be good though. Here is how I did:
in my product, in overrides.zcml, I have put:
<browser:viewlet
name="order-summary"
manager="Products.PloneGetPaid.interfaces.IAdminOrderManager"
template="skins/wrjcontent/order-summary.pt"
class="Products.wrjcontent.browser.admin_order.WRJOrderSummaryComponent"
permission="zope2.View"
/>
Then in my product, in admin_order.py, I have put:
from Products.PloneGetPaid.browser.admin_order import OrderSummaryComponent
class WRJOrderSummaryComponent(OrderSummaryComponent):
""" workflow actions and details on order summary
"""
template = ZopeTwoPageTemplateFile('../skins/wrjcontent/order-summary.pt')
affiliate = None
def getShippingCost(self):
total_ship = "%0.2f" % self.order.getShippingCost()
return total_ship
def getPaymentMethod(self):
affiliate_manager = component.getUtility(IAffiliateManager)
order_id = self.order.order_id
affiliate = affiliate_manager.get(order_id)
self.affiliate = affiliate
if self.affiliate:
payment_method = self.affiliate.getPaymentMethod()
if payment_method == 'Credit Card':
return "Billed by credit card"
else:
return "Billed to sisterhood"
return ""
[...]
And then I have put my own order-summary.pt template in the skins of my product.
If you only override the template, using z3c.jbot is a good idea. But
if like me you need to override the view class too to add some
functions in it, you can follow what I did.
Lucie
--
S i x F e e t U p , I n c . | http://www.sixfeetup.com
Phone: +1 (317) 861-5948 x605
REGISTER NOW for the Plone Deployment Workshop | Nov. 20-21, 2008
http://www.sixfeetup.com/news/plone-deployment-workshop
On Thu, Nov 20, 2008 at 6:08 AM, Darryl Dixon <[EMAIL PROTECTED]> wrote:
> Well, after spending several hours combing through the code trying to figure
> out the best way (any way!) to successfully override this viewlet, and then
> sending this email, I just had a brainwave and used z3.jbot to clobber the
> template (order-summary.pt). Literally 2 minutes later, done...
>
> So, +1 to z3c.jbot, but it would still be good for someone more intimate
> with the code to steer me in the right direction for future reference.
>
> regards,
> D
>
> On Thu, Nov 20, 2008 at 11:04 PM, Darryl Dixon <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi All,
>>
>> I am mired in the tangle of @@getpaid-order. I would like to override one
>> of the viewlets that end up getting invoked when this page is viewed:
>> order-summary. Can someone point me in the right direction? I've tried
>> overrides.zcml and viewlets.xml, neither seems to have helped.
>>
>> Things seem complicated by the fact that several pieces of the puzzle are
>> duplicated between admin.zcml and configure.zcml.
>>
>> Any help or pointers greatly appreciated.
>>
>> regards,
>> Darryl Dixon
>> Winterhouse Consulting Ltd
>> http://www.winterhouseconsulting.com
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"getpaid-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/getpaid-dev?hl=en
-~----------~----~----~----~------~----~------~--~---