Reputation: 2129
I want to add an admin menu item to my osCmax website just like articles and authors.
I have added the following code to the core.php file of the english folder.
// BOF: MOD - Booking Serice
define('BOX_MENU_BOOKING_SERVICE', 'Booking Service');
define('BOX_BOOKING_SERVICE_PERSONS', 'Persons');
define('BOX_BOOKING', 'Booking');
// EOF: MOD - Booking Service
I have created a persons.php
file in the admin boxes folder and add the following code.
$contents = '';
$contents = (
tep_admin_jqmenu(FILENAME_PERSONS, BOX_BOOKING_SERVICE_PERSONS, 'TOP') .
tep_admin_jqmenu(FILENAME_BOOKING, BOX_BOOKING, 'TOP'));
print_r($contents);
I have added the following code to the filenames.php
in the admin folder.
define('FILENAME_PERSONS', 'persons.php');
define('FILENAME_BOOKING', 'booking.php');
But only the BOOKING SERVICE
is displaying in the admin menu and the Persons
and Booking
is not displaying.
Upvotes: 0
Views: 1465
Reputation: 9955
You'll have to register the filenames in the admin_files table before you can see them in the menu.
Calling the links with the tep_admin_jqmenu
method used in the includes/boxes/persons.php file checks to make sure the admin user has the appropriate permissions.
First you'll need to register the section, or default page to use. Here we're adding it as the Persons file, saying it's a parent section in the menu and what default permission groups can see it:
insert into admin_files
(admin_files_name, admin_display_name, admin_files_is_boxes,
admin_files_to_boxes, admin_groups_id, admin_sort_order)
values
('persons.php', 'BOX_MENU_BOOKING_SERVICE', 1, 0, '1,2', 1);
Then you can run the following query which adds the drop down menus for the Persons and Booking options, both being child elements of the Booking Service menu option.
insert into admin_files
(admin_files_name, admin_display_name, admin_files_is_boxes,
admin_files_to_boxes, admin_groups_id, admin_sort_order)
values
('persons.php', 'BOX_BOOKING_SERVICE_PERSONS', 0,
(select af.admin_files_id from admin_files af
where af.admin_files_name = 'persons.php' limit 1), '1,2', 1),
('booking.php', 'BOX_BOOKING', 0,
(select af.admin_files_id from admin_files af
where af.admin_files_name = 'persons.php' limit 1), '1,2', 2);
The sub-query in this pulls out the admin_files_id
of the parent, which will be different depending on how many other modifications have occurred on this table or how it has been built.
Upvotes: 1