My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 15, 2007 by cjj.ifpeople
Labels: Phase-Support, Phase-Deploy
CustomizationsBestPracticesDoc  
Recommendations for how to make your changes to the product

Moved to http://plone.org/products/getpaid/documentation/how-to/best-practices-for-customizing-getpaid


Comment by lucielejard, Nov 13, 2007

Here is an other example

  • Let's say my product is named MyProduct?
  • I want to change the way the cart looks like because I want to add a line at the end of the cart to show if there is a discount or not.
  • In the end, I want to change/override the cart-listing.pt template, so I will create a new cart-listing.py template and put it in my skins folder
  • To do that, I will create an overrides.zcml file in /MyProduct?
  • in this file I will put the following code:
  • <configure 
      xmlns="http://namespaces.zope.org/zope"
      xmlns:browser="http://namespaces.zope.org/browser">
      
      <browser:viewlet
           name="10cart-listing"
           manager="Products.PloneGetPaid.interfaces.IGetPaidCartViewletManager"
           template="skins/cart-listing.pt"
           class="Products.MyProduct.browser.WRJShoppingCartListing"
           permission="zope2.View"
           />
    
    </configure>
  • Then I need to create the view class that will override the ShoppingCartListing? view class (I chose to put it in browser.py):
  • from Products.PloneGetPaid.browser.cart import ShoppingCartListing
    class WRJShoppingCartListing(ShoppingCartListing):
        """
        """
        template = ZopeTwoPageTemplateFile('skins/cart-listing.pt')
        
        def __init__( self, *args, **kw):
            super( WRJShoppingCartListing, self ).__init__( *args, **kw )
  • You just have to restart your instance and you will be able to do the changes you want to the template.

Sign in to add a comment
Hosted by Google Code