Zen Cart plugin
From Wiki @ Karl Jones dot com
Revision as of 10:39, 13 October 2015 by Karl Jones (Talk | contribs)
A Zen Cart plugin is a plugin for WordPress.
zen_register_admin_page
zen_register_admin_page ($page_key, $language_key, $main_page, $page_params, $menu_key, $display_on_menu, $sort_order);
Where:
- page_key is a unique text id
- language _key is the name of the define for the page name that would previous have been used in the box files (for compatibility with existing language packs)
- main_page is the define starting FILENAME_ used in the box file and code to direct to the admin page
- page_params are whatever parameters are needed for the page (generally relevant only to configuration and modules pages
- menu_key is a foreign key for the admin_menus table
- display_on_menu is a char with value "Y" or "N" depending on whether it's a page visible on the admin menu, or a subpage called by another page
- sort_order is a numeric value indicating how high up the menu the entry would appear, a high value sinks it down
Autoload
Create a file that goes in:
admin/includes/auto_loaders
Sample content (minus obligatory comments which should already have been added for good coding standards:
PHP Code:
<code>
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$autoLoadConfig[199][] = array(
'autoType' => 'init_script',
'loadFile' => 'init_ceon_uri_mapping_config.php'
);
</code>
Then create a file in
<code>admin/includes/init_includes</code>
Sample content:
PHP Code:
<code>
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (function_exists('zen_register_admin_page')) {
if (!zen_page_key_exists('ceon_uri_mapping_config')) {
// Add the link to the Ceon URI Mapping Config Utility
zen_register_admin_page('ceon_uri_mapping_config', 'BOX_CEON_URI_MAPPING',
'FILENAME_CEON_URI_MAPPING_CONFIG', '', 'modules', 'Y', 40);
}
}
// Now that the menu item has been created/registered, can stop the wasteful process of having
// this script run again by removing it from the auto-loader array
@unlink(DIR_FS_ADMIN . DIR_WS_INCLUDES . 'auto_loaders/config.ceon_uri_mapping_config.php');
</code>