Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    1,970
    Plugin Contributions
    29

    Default Re: Adding a menu item to the v1.5.0 admin

    In the interests of anal neatness I usually add this to get a real number for the sort order before calling the function.

    It could/should be included in the zen_register_admin_page as a default if no sort order is defined.

    $sql = "SELECT MAX(sort_order) AS sort_order_max FROM " . TABLE_ADMIN_PAGES . " WHERE menu_key = 'tools'";
    $result = $db->Execute($sql);
    $sort_order = $result->fields['sort_order_max']+1;
    Steve
    github.com/torvista: Apsona (php7), BackupMySQL Admin/Auto, CEON URI Mapping (php7), Product Listing Sorter, Redsys payment module, Spanish Language Pack and more...

  2. #12
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    8,614
    Plugin Contributions
    68

    Default Re: Adding a menu item to the v1.5.0 admin

    Quote Originally Posted by torvista View Post
    In the interests of anal neatness I usually add this to get a real number for the sort order before calling the function.

    It could/should be included in the zen_register_admin_page as a default if no sort order is defined.

    $sql = "SELECT MAX(sort_order) AS sort_order_max FROM " . TABLE_ADMIN_PAGES . " WHERE menu_key = 'tools'";
    $result = $db->Execute($sql);
    $sort_order = $result->fields['sort_order_max']+1;
    Agreed. In (most of) my plugins where an admin-page registration is required, I include a function similar to this (for the xxxx plugin):
    Code:
    function init_xxxx_next_sort ($menu_key) 
    {
        global $db;
        $next_sort = $db->Execute('SELECT MAX(sort_order) as max_sort FROM ' . TABLE_ADMIN_PAGES . " WHERE menu_key='$menu_key'");
        return $next_sort->fields['max_sort'] + 1;
    }
    and then use it like:
    Code:
    if (!zen_page_key_exists ('configDbIo')) {
        zen_register_admin_page('configDbIo', 'BOX_CONFIGURATION_DBIO', 'FILENAME_CONFIGURATION', "gID=$cgi", 'configuration', 'Y', init_xxxx_next_sort ('configuration'));
      
    }

  3. #13
    Join Date
    Jan 2004
    Posts
    65,247
    Blog Entries
    7
    Plugin Contributions
    224

    Default Re: Adding a menu item to the v1.5.0 admin

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. 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
  2. back to the admin homepage after adding item
    By fonzie in forum Basic Configuration
    Replies: 2
    Last Post: 20 Feb 2013, 01:22 PM
  3. Adding a link to the Admin Menu
    By MartynG in forum Basic Configuration
    Replies: 3
    Last Post: 10 Dec 2010, 11:11 AM
  4. Replies: 9
    Last Post: 9 Mar 2009, 08:31 PM

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