Author Topic: Create new admin parent menu and submenu  (Read 10473 times)

yonghan

  • Guest
Create new admin parent menu and submenu
« on: May 07, 2015, 06:05:06 AM »
Hi admins, I'm trying to create admin parent menu and submenu in abantecart v1.2.

Here are the codes that I use on install.php

Code: [Select]
$menu = new AMenu ( "admin" );
$menu->insertMenuItem ( array (
        "item_id" => "test",
        "parent_id"=> "",
        "item_text" => "Test Menu",
        "item_url" => "",
        "item_type"=> "core",
        "item_icon_rl_id" => $resource_id,
        "sort_order"=>"8")
);

$this->registry->get('cache')->delete('admin_menu');

$content =$menu->insertMenuItem ( array (
        "item_id" => "test_submenu",
        "parent_id"=> "test",
        "item_text" => "Submenu",
        "item_url" => "",
        "item_type"=> "core",
        "item_icon_rl_id" => $resource_id_sales,
        "sort_order"=>"")
);


$file = fopen('hasil.txt', 'w');
fwrite($file, $content);
fclose($file);

I got
Code: [Select]
Error: Cannot to add menu item because parent "test" is not exists
Is it possible for me to create new parent menu and submenu? Thanks

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
  • Karma: +274/-2
    • View Profile

yonghan

  • Guest
Re: Create new admin parent menu and submenu
« Reply #2 on: May 07, 2015, 09:21:33 AM »
Thanks Basara, I'm using the second method and it works.

 

Powered by SMFPacks Social Login Mod