s_kelley wrote: > I would be most grateful is someone could point me in the right > direction. I would like to make my UML generated custom type > buyable. I found this explanation: > http://plone.org/products/getpaid/documentation/how-to/how-to-tie-actions-to-payments > > I am not a strong python/zope 3 user so I do not know where to put the > subscriber and other code to accomplish this. > > my type, located in Products/show has a "ride" class defined in > Products/show/ride.py and has a Products/show/configure.zcml and > Products/show/interfaces.py file auto generated for me. > > I came up with the following code modification for my type. Is it > correct? Where do I put it? In Products/show/configure.zcml file? > > <subscriber > for="Products.show.interface.Iride > zope.app.container.interfaces.IObjectAddedEvent" > factory="Products.show.makePayableOnCreation" > /> > > How about the second block of code? Where does it go? In Products/ > show/ride.py or ? > > from Products.PloneGetPaid import interfaces > from getpaid.core import interfaces as coreInterfaces > from Products.Five.utilities.marker import mark > > def makePayableOnCreation(obj, event): > mark(obj, interfaces.IBuyableMarker) > coreInterfaces.IBuyableContent(obj).setProperty('price', 3.14) > coreInterfaces.IBuyableContent(obj).setProperty('product_code', > obj.ID)
You can put it in an existing module, or create a new one, e.g. 'buyable.py' and update the factory in the subscriber declaration: ... factory="Products.show.buyable.makePayableOnCreation" ... Ricardo Alves --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
