Let’s suppose your Zen Cart module is named MyZenModule
Adding a module in admin area of ZenCart will help you to manage specific features of a front end ZenCart module or just to display / process specific data related with admin area only:
As any ZenCart mdule, in this case you have to create a “bunch” of file into ZenCart filesystem
1. Add file: /admin/MyZenModule.php
Find below a sample. Change it, see YOUR CODE and YOUR DATA. You can create complex module using classes but mate, if you know it there is no point to teach you anymore.
<?php
/**
* @package admin
* @copyright Copyright 2003-2007 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: customers.php 7185 2007-10-05 15:35:38Z drbyte $
*/
/*
* MyZenModule
* version x.x, Your Company, V1.0, YourWebsite.com
*
*/
require('includes/application_top.php');
$error = false;
$processed = false;
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
<?php if ($action == 'edit' || $action == 'update') { ?>
<script language="javascript"><!--
function check_form() {
var error = 0;
var error_message = "<?php echo JS_ERROR; ?>";
if (error == 1) {
alert(error_message);
return false;
} else {
return true;
}
}
//--></script>
<?php } ?>
<script type="text/javascript">
<!--
function init()
{
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
}
// -->
</script>
</head>
<body onLoad="init()">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<?php
//HERE YOUR CODE
?>
<table border="0" width="99%" cellspacing="2" cellpadding="2">
<tr>
<td colspan="7">
<h1><?php echo HEADING_TITLE_MYZENMODULE; ?></h1>
</td>
</tr>
<tr>
<td>
HERE YOUR DATA
</td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
2. Add file: /admin/inclues/langauges/english/extra_definitions/MyZenModule.php
It contains all language constants used in your module. Add in all your language folders if you are using other languages except English.
Here it is a basic example:
<?php
/**
* @package admin
* @copyright Copyright 2003-2007 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: customers.php 7185 2007-10-05 15:35:38Z drbyte $
*/
/*
/*
* MyZenModule
* version x.x, Your Company, V1.0, YourWebsite.com
*
*/
//define constants
define('HEADING_TITLE_MYZENMODULE', 'MyZen Module');
define('BOX_ORDERS_MYZENMODULE', 'MyZen Module');
?>
3. Add file: /admin/includes/extra_datafiles/MyZenModule.php
It contains tables and files used by your module. Here it is an example:
<?php
/**
* @package admin
* @copyright Copyright 2003-2007 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: customers.php 7185 2007-10-05 15:35:38Z drbyte $
*/
/*
/*
* MyZenModule
* version x.x, Your Company, V1.0, YourWebsite.com
*
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
//define table and files
define('FILENAME_MYZENMODULE', 'myzenmodule.php');
define('TABLE_MYZENMODULE', 'myzenmodule');
?>
4. Add file: /admin/includes/boxes/extra_boxes/MyZenModule_tools_dhtml.php
Based on its name your management module will be present in a specific menu. In this specific case it will be under “Tools” main option menu.
tools can be replace with any top level option from admin area for example: customers, reports e.t.c.
It contains the following code:
<?php
/**
* @package admin
* @copyright Copyright 2003-2007 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: customers.php 7185 2007-10-05 15:35:38Z drbyte $
*/
/*
/*
* MyZenModule
* version x.x, Your Company, V1.0, YourWebsite.com
*
*/
define('HEADING_TITLE_MYZENMODULE', 'MyZenModule Hading');
define('BOX_MYZENMODULE', 'MyZenModule Menu');
?>
All you have to do is to create files as per above details, replace header data with your details and replace all over “myzenmodule” with the name of your very own module.
It was full tested in commercial environment
Please use Comment area for any issue you may have or ask for consultancy. We will be happy to assist you.
Thank you for using our system.
You can download all files here:
Just remember:




(20 votes, average: 4.75 out of 5, rated)