Add Admin configuration menu item (again)
I'm trying to update a plugin(not mine) to 1.55 and make it install automatically
I've read this thread:
https://www.zen-cart.com/showthread....e-v1-5-0-admin
And this wiki page:
https://www.zen-cart.com/content.php...e-v1-5-0-admin
And I am still unable to get anything to appear.....
If I run it through a debugger it doesn't even to seem to see any of my files... !
I have the following structure
./my_config_menu.php
Code for the menu which is accessed via the template
./includes/extra_datafiles/my_config_menu_filenames.php
Code:
<?php
//
define('FILENAME_MY_CONFIG_MENU', 'my_config_menu');
?>
./includes/languages/english/extra_definitions/my_config_menu.php
Code:
<?php
//
define('BOX_TOOLS_MY_CONFIG_MENU', 'Social Media Icons');
?>
./includes/languages/english/my_config_menu.php
Code:
<?php
// No definitions required
?>
./includes/functions/extra_functions/my_config_menu_functions.php
Code:
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
// If DB entries do not exist
zen_register_page etc
Can someone explain how a new plugin is picked by Zen and where I have fallen flat on my face ? I know it must be stupidly simple - if I could see it read the start of just one file I can step through and work things out.
If I can fix it I'll add it to the plugins section.
Yours, in hope and desperation :-)
B. Rgds
John
Re: Add Admin configuration menu item (again)
Are all files relative to the store root or your admin? Way it looks, it is as if relative to the store root.
Re: Add Admin configuration menu item (again)
Re: Add Admin configuration menu item (again)
Quote:
Originally Posted by
mc12345678
Are all files relative to the store root or your admin? Way it looks, it is as if relative to the store root.
My bad - relative to admin.
Re: Add Admin configuration menu item (again)
Quote:
Originally Posted by
lat9
As per my original post, I read that and am still none the wiser hence asking for some pointers :-)
Re: Add Admin configuration menu item (again)
Are you trying to add an element to the Configuration menu or are you adding an entire new admin tool?
Re: Add Admin configuration menu item (again)
Quote:
Originally Posted by
lat9
Are you trying to add an element to the Configuration menu or are you adding an entire new admin tool?
I am trying to add a menu item to the configuration menu that has some options that modify something in a template.
It is the Social Media Icons sharing plugin that has not been updated for v1.5x
Re: Add Admin configuration menu item (again)
To create a new configuration-menu "group" as part of your plugin's install, you'll need (at a minimum) two files:
/YOUR_ADMIN/includes/languages/english/extra_definitions/social_media_icons_name.php:
Code:
<?php
define ('BOX_SOCIAL_MEDIA_ICONS', 'Social Media Icons');
/YOUR_ADMIN/includes/functions/extra_functions/init_social_media_icons.php
Code:
<?php
$configurationGroupTitle = 'Social Media Icons';
$configuration = $db->Execute ("SELECT configuration_group_id FROM " . TABLE_CONFIGURATION_GROUP . " WHERE configuration_group_title = '$configurationGroupTitle' LIMIT 1");
if ($configuration->EOF) {
$db->Execute("INSERT INTO " . TABLE_CONFIGURATION_GROUP . "
(configuration_group_title, configuration_group_description, sort_order, visible)
VALUES ('$configurationGroupTitle', '$configurationGroupTitle', '1', '1');");
$cgi = $db->Insert_ID();
$db->Execute ("UPDATE " . TABLE_CONFIGURATION_GROUP . " SET sort_order = $cgi WHERE configuration_group_id = $cgi");
} else {
$cgi = $configuration->fields['configuration_group_id'];
}
// -----
// Set the various configuration items, the plugin wasn't previously installed.
//
if (!defined ('SOCIAL_MEDIA_ICONS_ENABLED')) {
$db->Execute ("INSERT INTO " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, date_added, sort_order, use_function, set_function ) VALUES ( 'Enable Social Media Icons?', 'SOCIAL_MEDIA_ICONS_ENABLED', 'false', 'Enable the social-media icons processing for your store? Default: <b>false</b>', $cgi, now(), 10, NULL, 'zen_cfg_select_option(array(\'true\', \'false\'),')");
//-Additional configuration items get added here
}
// -----
// Register the plugin's configuration page for display on the menus.
//
if (!zen_page_key_exists ('configSocialMediaIcons')) {
zen_register_admin_page ('configSocialMediaIcons', 'BOX_SOCIAL_MEDIA_ICONS', 'FILENAME_CONFIGURATION', "gID=$cgi", 'configuration', 'Y', $cgi);
}
Re: Add Admin configuration menu item (again)
Bingo ! Well, more or less :-)
Thank - you. I finally got my head around it I think - I have a menu item with config items on the page.
I'll write it up tomorrow. One question.
social_media_icons.filenames.php
What does it do ?
Currently I have something like this but I think it is wrong ?
Code:
<?php
define('FILENAME_SOCIAL_MEDIA_ICONS', 'social_media_icons');
?>
B. Rgds
John
Re: Add Admin configuration menu item (again)
@reetp, since you are adding only to configuration elements, that filename is not needed.
It's used if you are providing a new, separate, tool/item for the admin processing and defines the file name (no .php extension) that is associated with your new tool and is used in the tool's admin-page registration.