You can create CLONES (copies) of the FLAT module. This duplicates the functions of the module, but enables more than one Flat Rate module to operate.
Essentially you need to do this:
1. On your home computer, create TWO folders:
In each of these folders, create the following directory trees:
includes\modules\shipping\
includes\languages\english\modules\shipping\
So you now have a Zencart-compatible directory structure for each of the TWO new modules you are about to create.
- flatone\includes\modules\shipping\
- |- - - - - - - - - - -\languages\english\modules\shipping\
- flattwo\includes\modules\shipping\
- |- - - - - - - - - - -\languages\english\modules\shipping\
You should have a copy of your zencart software on your home computer, so make copies of the relevant "flat.php" files, (but if not, you can FTP the files) -: (FIRST to the respective folders in flatone, then again to the respective folders in flattwo)
includes\modules\shipping\flat.php
includes\languages\english\modules\shipping\flat.php
The point here is to get two SETS of identical files of the original FLAT module, into the right directory structure on your hard drive.
(NB: BOTH of these files are called "flat.php", but they are different! One is the MODULE file, and the other is the LANGUAGE file. You must make sure the correct file goes to the correct directory!)
When you have all the copied files in the right place, you can start the clone process:
Go to your folder called flatone.
Navigate in turn, to the two "flat.php" files and RE-NAME both of them "flatone.php"
(Do the same with the "flat.php" files in the directory tree in flattwo - this time, you call the "flat.php" files "flattwo.php".)
- flatone\includes\modules\shipping\flatone.php (module file)
- |- - - - - - - - - - -\languages\english\modules\shipping\flatone.php (language file)
- flattwo\includes\modules\shipping\flattwo.php (module file)
- |- - - - - - - - - - -\languages\english\modules\shipping\flattwo.php (language file)
Now you need to EDIT each file. And it's quite simple...
Open:
flatone\includes\modules\shipping\flatone.php (module file)
Currently, it will look like this (first few lines):
PHP Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 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: flat.php 1969 2005-09-13 06:57:21Z drbyte $
//
class flat {
var $code, $title, $description, $icon, $enabled;
// class constructor
function flat() {
global $order, $db;
$this->code = 'flat';
$this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
$this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;
Now, you will see as you read through the file, the words:
flat
and
FLAT
appear...
Make sure to keep lower and uppercase when they appear, change instances of:-
flat to flatone
and
FLAT to FLATONE
So you will have, for example (first couple of lines here):
PHP Code:
// $Id: flatone.php 1969 2005-09-13 06:57:21Z drbyte $
//
class flatone {
var $code, $title, $description, $icon, $enabled;
// class constructor
function flatone() {
global $order, $db;
$this->code = 'flatone';
$this->title = MODULE_SHIPPING_FLATONE_TEXT_TITLE;
... see how instances of flat and FLAT become flatone and FLATONE ?
When you have changed all instances, SAVE the file.
Now you need to edit the corresponding LANGUAGE FILE.
So, on your hard drive, open the following:
flatone\includes\languages\english\modules\shipping\flatone.php
This will have the following code:
PHP Code:
// $Id: flat.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('MODULE_SHIPPING_FLAT_TEXT_TITLE', 'Flat Rate');
define('MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION', 'Flat Rate');
define('MODULE_SHIPPING_FLAT_TEXT_WAY', 'Best Way');
?>
Now you do the same here with flat and FLAT
PHP Code:
// $Id: flatone.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('MODULE_SHIPPING_FLATONE_TEXT_TITLE', 'Flat Rate ONE');
define('MODULE_SHIPPING_FLATONE_TEXT_DESCRIPTION', 'Flat Rate ONE');
define('MODULE_SHIPPING_FLATONE_TEXT_WAY', 'Best Way FLAT RATE ONE');
?>
(Naturally, you will also change the defines to suit your needs - I have just given them a quick label to help identify them later).
SAVE the file.
------------------------------------------------------------------
NOW... you duplicate the process for flattwo
------------------------------------------------------------------
When you have completed your edits, you now FTP the files to your server. You can choose to use your custom over-ride folders to house the new files, or leave them in their default directories - as there is no core file called "flatone.php" it will not be overwritten in a future upgrade.
Please note that on your hard drive you have ROOT folders called:
flatone
and
flattwo
These folders are NOT FTP'd - Just the contents of their INCLUDES folders. (So you are conforming to the directory structure of ZC).
------------------------------------------------------------------
Now, go to your ADMIN CONSOLE and navigate to the shipping modules.
You will now see - in addition to the flat module, you have:
flatone
flattwo
If you have been sensible and given your language defines appropriate labels, you will see these modules properly labelled.
Install, configure and use the modules.
Bookmarks