
false if not
boolean configfile_writeable( void )
returns true if the configuration file for that payment module is writeable,
false if not
boolean configfile_readable( void )
returns true if the configuration file for that payment module is readable,
false if not
void write_configuration( Array )
Stores all configuration values for this payment module in the configuration file.
boolean process_payment(String $order_number, Float $order_total, Array &$d)
This is the main function for all payment modules that use direct connections to a payment gateway
(like authorize.net or eWay XML). This is the place, where the payment details are validated and
captured on success.
Returns true on sucess, false on failure.
float get_payment_rate(Float $subtotal)
This is the function to calculate the fee / discount for this special payment module (so you can cal-
culate a fee, depending on the order total amount).
Note
IF you are about to change configuration variables: do this in both functions: show_configuration and
write_configuration!
5.1.4. Installing a Payment Module
Since there's no real installer for payment modules, you must copy the two files ps_mynewpayment.php
and ps_mynewpayment.cfg.php into the directory
/administrator/components/com_virtuemart/classes/payment/
first.
After you have done that, you can add a new payment method ("Store" => "Add Payment Method"). It's impor-
tant to fill in the correct name for Payment Class Name (in this case: ps_mynewpayment) - here's the reason
why you must give the class file the same name as the class inside the file: the Shop now tries to include a file
called "ps_mynewpayment.php" on Saving the payment method.
When you now re-open the newly created payment method, you have access to the configuration form.
5.2. Shipping Modules
5.2.1. The Basics
Shipping modules are located in the directory
/administrator/components/com_virtuemart/classes/shipping/
and have three files: the class file, the information file and the configuration file.
Example: Module "myShipping"
VirtueMart Developer Manual
16
Komentáře k této Příručce