Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Nov 2008
    Posts
    46
    Plugin Contributions
    0

    Default 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

  2. #2
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default 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.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Add Admin configuration menu item (again)


  4. #4
    Join Date
    Nov 2008
    Posts
    46
    Plugin Contributions
    0

    Default Re: Add Admin configuration menu item (again)

    Quote Originally Posted by mc12345678 View Post
    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.

  5. #5
    Join Date
    Nov 2008
    Posts
    46
    Plugin Contributions
    0

    Default Re: Add Admin configuration menu item (again)

    Quote Originally Posted by lat9 View Post

    As per my original post, I read that and am still none the wiser hence asking for some pointers :-)

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default 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?

  7. #7
    Join Date
    Nov 2008
    Posts
    46
    Plugin Contributions
    0

    Default Re: Add Admin configuration menu item (again)

    Quote Originally Posted by lat9 View Post
    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

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default 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);
    }

  9. #9
    Join Date
    Nov 2008
    Posts
    46
    Plugin Contributions
    0

    Default 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

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default 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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Trying to add backup_mysql menu item to admin
    By diytools in forum Basic Configuration
    Replies: 18
    Last Post: 25 Mar 2016, 04:45 AM
  2. How do i add an item to the admin menu
    By tcarden in forum General Questions
    Replies: 1
    Last Post: 17 Apr 2013, 11:12 PM
  3. Replies: 9
    Last Post: 9 Mar 2009, 08:31 PM
  4. Add Item to Admin Menu
    By jacque427 in forum Customization from the Admin
    Replies: 1
    Last Post: 21 Sep 2006, 01:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR