Let's say you want to allow your customers to buy your merchandise with chickens. If you were using any other shopping cart, you'd be out of luck. You'd lose the huge share of the Internet market which uses foul currency.
But you're using Hazel, and Hazel loves chickens! And now I'll drop the feathered metaphor and get down to business.
The Template
The guts of a payment method are within its template. Payment method templates are located in the "payment" subdirectory of your hazel-cat/templates directory. During checkout, when a shopper submits a
PAYMENT_METHODfield, its value is used to determine which template Hazel next serves in the confirmation stage of checkout. For example, if you chose "printout" in the checkout screen's drop-down box for the payment method, Hazel would next serve up the "payment/printout.html" template. That template would contain all the information needed to pay with a printed or faxed order.Decide on a "code name" for your payment method. This will be used as both the name of the
PAYMENT_METHODfield value, and the prefix of the template's filename. For the purposes of this example, let's resurrect the chicken metaphor and call our payment method chickens.Now -- make your payment template! Rather than starting from scratch, choose an existing template, copy it as chickens.html, and modify it to work with your new payment method. In addition to modifying the appearance, this will usually involve adding, renaming, or removing HTML form fields.
One field you will probably want to change is the
ACTION. It will have a value beginning withFINISH, such asFINISH_CODorFINISH_PRINTOUT. Change it toFINISH_FOO, whereFOOis the name of your payment method. For our example, we'll name itFINISH_CHICKENS. It should look something like this...<INPUT TYPE=HIDDEN NAME="ACTION" VALUE="FINISH_CHICKENS">You'll also want to change the name of the submit button used to finally submit the order...
<INPUT TYPE=SUBMIT NAME="SUBMIT_ACTION_FINISH_CHICKENS" VALUE="Order!">Field.rules
What's the importance of these names? Well, the action gives Hazel her orders. It tells her what she'll be doing. Any action value which begins with
FINISHtells her to finish up the order. Furthermore, Hazel's field.rules file will require certain input fields depending on the action. By changing the name of the action, you prevent her from, for example, requiring credit card information.And that's the next (optional) step -- editing your field.rules file to include any new input requirements for your payment method. Simply add any required fields under a new
[FINISH_CHICKENS]header in your field.rules file.Loop the Loops
Finally, there must be a way for the shopper to choose your new payment method. If you've left the loops in Hazel's checkout template intact, that's simple as editing the hazel-cat/loops/payment_methods.txt file. Just add another line like so.
chickens;Pay with Chickens!Done!
That's it--you're done! That wasn't very hard, was it? The only thing left to do is to get the word out that you are one of the few, proud e-businesses which accepts chickens online.
*sqUAWk!*