How do I enable "buyable" options for Folderish content types?
This How-to applies to:
Any version.
This How-to is intended for:
Integrators and site admins, Developers
Purpose
This howto covers making configuration changes so folderish content types (ie default "folder" or "large folder" or your custom folderish object) can be made buyable.
Prerequisities
You will need GetPaid installed, and an editor application to edit some configuration files.
Step by step
To enable it you need to add some lines of zcml to a your product. You can use the lines based on those in
PloneGetPaid/configure.zcml which sets it up for normal content as a model. For example, add:
<!-- Content to Payable Adapters --> <adapter for="Products.CMFCore.interfaces.IFolderish" provides="getpaid.core.interfaces.IBuyableContent" factory=".content.BuyableContentAdapter" /> <adapter for="Products.CMFCore.interfaces.IFolderish" provides="getpaid.core.interfaces.IShippableContent" factory=".content.ShippableContentAdapter" /> <adapter for="Products.CMFCore.interfaces.IFolderish" provides="getpaid.core.interfaces.IPremiumContent" factory=".content.PremiumContentAdapter" /> <adapter for="Products.CMFCore.interfaces.IFolderish" provides="getpaid.core.interfaces.IDonationContent" factory=".content.DonatableContentAdapter" />
Make an AT-based object buyable
Here is my configure.zcml:
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:five="http://namespaces.zope.org/five">
<adapter
for="Products.Archetypes.interfaces.IBaseFolder"
provides="getpaid.core.interfaces.IBuyableContent"
factory="Products.PloneGetPaid.content.BuyableContentAdapter"
/>
<five:implements
interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
class="Products.ATMSensors.content.SensorProduct.SensorProduct" />
</configure>