Custom view for product

1 view
Skip to first unread message

Gibbous

unread,
Jul 27, 2010, 7:59:04 AM7/27/10
to easyshop
Hi,
I'm using EasyShop and Plone 3. I wish to create a customised view for
the products, preferably in a theme.

I have been hunting around quite a bit but with little success.

I have a theme built using paster and I need to know
1) which template I need to overide
2) where to put it
3) what other files need to be modified to get my template picked up

Any help would be appreciated
thanks,
Ivor

ned14

unread,
Jul 27, 2010, 11:48:29 AM7/27/10
to easyshop
Try src/easyshop.catalog/easyshop/catalog/viewlets/product.pt

HTH,
Niall

Gibbous

unread,
Jul 29, 2010, 4:32:15 AM7/29/10
to easyshop
Thanks Niall,
Yes that looks like the right template and I have made the changes I
needed to it, but how do I move this template into my theme so I don't
have to edit the easyshop code itself?

Ivor.

Gibbous

unread,
Jul 29, 2010, 11:34:15 AM7/29/10
to easyshop
OK, I have copied src/easyshop.catalog/easyshop/catalog/viewlets/
product.pt into the browser folder of my theme. The configure.zcml in
the browser folder has the following entry:
<browser:viewlet
name="easyshop.product-viewlet"
for="*"
class="easyshop.catalog.viewlets.product.ProductViewlet"

manager="easyshop.catalog.viewlets.interfaces.IProductViewletManager"
layer=".interfaces.IThemeSpecific"
template="product.pt"
permission="zope2.View"
/>

I have checked it is being run ( put an error in the zcml and it was
flagged in the plone restart)
rerun buildout for my theme
Restarted Plone
re-installed my theme

and there is no change to the product's view.

It's definitely the correct template as I tried changing it in-situ
and the changes were picked it after a plone restart.

So where am I going wrong?

Ivor.

ned14

unread,
Jul 29, 2010, 1:31:15 PM7/29/10
to easyshop
I am afraid that I do not know enough about Plone 3 theming to tell
you, sorry. I have to admit I am waiting in earnest for Plone 4's XSLT
based theming, it seems so very much easier.

Niall

Gibbous

unread,
Jul 30, 2010, 5:40:33 AM7/30/10
to easyshop
OK for anyone else who wants to know:
The product view is a python class view so you need to override the
class and the template but only define the class in configure.zcml
so:
Copy product.pt from src/easyshop.catalog/easyshop/catalog/viewlets/
to the browser folder of your theme and change it there.
Add/edit a viewlets.py class to the browser folder of the theme with
the following:
from Products.Five.browser.pagetemplatefile import
ViewPageTemplateFile
from easyshop.catalog.viewlets import product
class ProductViewlet(product.ProductViewlet):
"""A custom version of the product view class
"""
render = ViewPageTemplateFile('product.pt')

Add/edit the configure.zcml in the browser folder of the theme to
include the following:
<browser:viewlet
name="easyshop.product-viewlet"
for="easyshop.core.interfaces.catalog.IProduct"

manager="easyshop.catalog.viewlets.interfaces.IProductViewletManager"
layer=".interfaces.IThemeSpecific"
class=".viewlets.ProductViewlet"
permission="zope2.View"
/>

Restart plone and if necessary reinstall the theme.

Now I just need to see how this should be done from ArgoUML... but
that's another story.

Thanks for the help.
Reply all
Reply to author
Forward
0 new messages