How to add a criteria?

2 views
Skip to first unread message

Gibbous

unread,
Aug 19, 2010, 11:57:23 AM8/19/10
to easyshop
Hi,
I'm looking to add a new criteria to test the ZipCode/Postcode against
a pre-configured set of prefixes. I would like to do this as an
override in a theme developed using paster on Plone 3.3.5 if possible.

Does anyone have experience of doing this and if so how do I go about
it?

Ivor.

ned14

unread,
Aug 19, 2010, 12:23:49 PM8/19/10
to easyshop
I know that one can apply a regular expression based validator to data
fields such as the postcode e.g. the email field has one. However,
that's fairly static versus what you are proposing which is a
parameterised criteria.

The Criteria class implementation is very straightforward to modify,
but I think that your problem is that a criteria is intended to choose
a set of metadata for the order based on a set of rules, so the
Criteria class takes as input the order details and outputs things
like postage costs. I can't see how it could interface with the UI in
order to say that some postcode is incorrect you see. It could however
convert a postcode into an address.

Given your thing is a theme, perhaps you ought to override the data
field declaration with a regular expression validator for your
particular country? That does give UI feedback, but of course
restricts sales to just one country.

It's an interesting problem, and I'm not at all familiar enough with
Easyshop to say for sure.

BTW I intend to start a port of Easyshop to Plone 4 in the next few
days. I'll have it on a separate branch though.

HTH,
Niall
Reply all
Reply to author
Forward
0 new messages