You can "clone" moneyorder module. It's quite simple...
In so doing you can create a module that behaves in the same way as moneyorder, but is called something different.
Let's say you want to call it "cashpayment"...
Here's the opening lines of moneyorder.php in /includes/modules/payment/moneyorder.php
PHP Code:
<?php
/**
* @package money order payment module
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: moneyorder.php 4960 2006-11-20 01:46:46Z drbyte $
*/
class moneyorder {
var $code, $title, $description, $enabled;
// class constructor
function moneyorder() {
global $order;
$this->code = 'moneyorder';
$this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE;
if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_MONEYORDER_PAYTO == 'the Store Owner/Website Name' || MODULE_PAYMENT_MONEYORDER_PAYTO == '')) $this->title .= '<span class="alert"> (not configured - needs pay-to)</span>';
$this->description = MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_MONEYORDER_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;
}
All you need to do is find every instance of:
moneyorder
and
MONEYORDER
and change them to
cashpayments
and
CASHPAYMENTS
(VERY IMPORTANT to keep the existing lowercase and UPPERCASE)
So it will look like this
PHP Code:
<?php
/**
* @package cashpayments payment module
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: cashpayments.php 4960 2006-11-20 01:46:46Z drbyte $
*/
class cashpayments {
var $code, $title, $description, $enabled;
// class constructor
function cashpayments() {
global $order;
$this->code = 'cashpayments';
$this->title = MODULE_PAYMENT_CASHPAYMENTS_TEXT_TITLE;
if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_CASHPAYMENTS_PAYTO == 'the Store Owner/Website Name' || MODULE_PAYMENT_CASHPAYMENTS_PAYTO == '')) $this->title .= '<span class="alert"> (not configured - needs pay-to)</span>';
$this->description = MODULE_PAYMENT_CASHPAYMENTS_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_CASHPAYMENTS_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_CASHPAYMENTS_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_CASHPAYMENTS_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_CASHPAYMENTS_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->email_footer = MODULE_PAYMENT_CASHPAYMENTS_TEXT_EMAIL_FOOTER;
}
Then you save it as cashpayments.php in the same folder as moneyorder.php
---------------------------------
Next, you are going to have to create a clone of the associated LANGUAGE file
includes/languages/english/modules/payment/moneyorder.php
and while it's ALSO called "moneyorder.php", it's very different from the file in the modules directory.
But you do the same thing:
PHP Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: cashpayments.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('MODULE_PAYMENT_CASHPAYMENTS_TEXT_TITLE', 'Check/Money Order');
define('MODULE_PAYMENT_CASHPAYMENTS_TEXT_DESCRIPTION', 'Please make your check or money order payable to:<br />' . MODULE_PAYMENT_CASHPAYMENTS_PAYTO . '<br /><br />Mail your payment to:<br />' . nl2br(STORE_NAME_ADDRESS) . '<br /><br />' . 'Your order will not ship until we receive payment.');
define('MODULE_PAYMENT_CASHPAYMENTS_TEXT_EMAIL_FOOTER', "Please make your check or money order payable to:" . "\n\n" . MODULE_PAYMENT_CASHPAYMENTS_PAYTO . "\n\nMail your payment to:\n" . STORE_NAME_ADDRESS . "\n\n" . 'Your order will not ship until we receive payment.');
?>
Again, save as cashpayments.php in the same folder as the moneyorder.php languages file.
Naturally, in this example above I have NOT changed the define text. You change it according to your needs.
---------------------------------------------------
Finally, you may consider adding some extra explanations to some of the defines in:-
includes/languages/english/checkout_payment.php
...particularly this one:-
PHP Code:
define('TEXT_SELECT_PAYMENT_METHOD', 'Please select a payment method for this order.');
For this file (if you choose to edit it) you should save the edited version to
includes/languages/english/your_template/checkout_payment.php
----------------------------------------
FTP all files to their respective folders on your server, then, in your Admin Panel, under MODULES>>>PAYMENT...
You will now see a module called cashpayments. Install it and away you go.
NOTE: I take no responsibility for this if you mess things up. If you follow the instructions, then it will work. Make sure to send the correct file to the correct folder!
Use a good plain text editor to edit the files.
Good luck!
Bookmarks