[Zope-dev] Dynamic formlibs

Marcelo de Moraes Serpa celoserpa at gmail.com
Thu Mar 6 06:32:14 EST 2008


Hello,

I have posted this message to the gepaid mailing list but nobody answered
yet, so I thought I would give a try on this mailing list, as this issue is
also related to Zope 3.

Basically I have a fork of PloneGetPaid and did I am doing some major
modification in it to adapt it to my business domain and requirements.

In my modified version of PGP, the ShippingMethod and PaymentProcessor are
not configured Store-wide, instead, they are configured per PayableItem.
When a user creates a new payableitem (which in this particular framework is
actually a custom content type and not regular content types marked by
interfaces) the user can choose what Shipping Method and Payment Processor
to use for this particular item. They are named adapters and I store their
names in the object.

What I would like to do (and have been trying to do without success) is to
have the checkout forms be generated according to "metadata" defined on both
the IShippingMethod and IPaymentMethod adapters.


When the user chooses to buy a PayableItem, it goes straight to the checkout
process (the checkout view is called in the payable item's view instead of
the portal root). In the checkout-review-pay form's __init__ method, both
named adapters are instantiated (using component.getAdapter
(context,IShipphingMethod,name=context.getShipping_method()).

There's a particular ShippingMethod that doesn't require any fields (only
has some logic that is ran when the order is paid) . For this, I would like
to show a warning in the form (arbitrary HTML) instead of fields, something
like:

"This product will be installed by our team, we will contact you with
details"

The User contact info and address are queried from the user model.

Also for the PaymentProcessor, different payment processor require different
fields or interface elements.

My idea is to transfer the code that define, create and register the
Transient bags, the code that define the fieldsets and widgets all to these
adapters (IShippingMethod and IPaymentProcessor).

However, I'm not sure yet on what to use to implement it. I thought on using
viewlets, since it would add another layer of abstraction and allow me to
insert html in them.

Please, I really need some help here, what do you experienced getpaid
developers think I should do in order to achieve this?

I think that this idea could make into a good featureset for future getpaid
releases!

Thanks,

Marcelo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20080306/74fbed78/attachment.htm


More information about the Zope-Dev mailing list