AbanteCart Community

AbanteCart Development => Development Help Needed => Topic started by: yonghan on May 07, 2015, 06:05:06 AM

Title: Create new admin parent menu and submenu
Post by: yonghan 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
Title: Re: Create new admin parent menu and submenu
Post by: Basara on May 07, 2015, 09:10:15 AM
Hello.
Try this topic http://forum.abantecart.com/index.php/topic,1102.msg4270.html#msg4270
Title: Re: Create new admin parent menu and submenu
Post by: yonghan on May 07, 2015, 09:21:33 AM
Thanks Basara, I'm using the second method and it works.