How to add an entire new custom module
Hi,
How do we start to create a custom module from scratch. I try to copy the Items modules (Controller, view, etc), create permission, but I'm getting a blank page.
Can I have some to start please?
Thank you.
Hi,
How do we start to create a custom module from scratch. I try to copy the Items modules (Controller, view, etc), create permission, but I'm getting a blank page.
Can I have some to start please?
Thank you.
Comments
5 comments
Here is an example if you were making an appointments module. You would need a controller called Appointments and the following sql to generate the menu and permissions. Please send me an email (support@phppointofsale.com) if you need code.
Here is sql
INSERT INTO `phppos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `icon`, `module_id`) VALUES
('module_appointments', 'module_appointments_desc', 75, 'ti-calendar', 'appointments');
INSERT INTO `phppos_permissions` (`module_id`, `person_id`) (SELECT 'appointments', person_id FROM phppos_permissions WHERE module_id = 'sales');
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('add_update', 'appointments', 'appointments_add_update', 240);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'add_update'
order by module_id, person_id;
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('edit', 'appointments', 'appointments_edit', 240);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'edit'
order by module_id, person_id;
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('delete', 'appointments', 'appointments_delete', 250);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'delete'
order by module_id, person_id;
INSERT INTO `phppos_modules_actions` (`action_id`, `module_id`, `action_name_key`, `sort`) VALUES ('search', 'appointments', 'appointments_search', 255);
INSERT INTO phppos_permissions_actions (module_id, person_id, action_id)
SELECT DISTINCT phppos_permissions.module_id, phppos_permissions.person_id, action_id
from phppos_permissions
inner join phppos_modules_actions on phppos_permissions.module_id = phppos_modules_actions.module_id
WHERE phppos_permissions.module_id = 'appointments' and
action_id = 'search'
order by module_id, person_id;
Hi Chris,
They is no appointements table in this code ?
Thank you.
correct; it is just a way to layout a module; you can look at other modules on how to do a table
Speaking of modules/ addons / Is there a place to view how to make some of those or have a template file folder with a base code.
I am having our dev add some features but would like to give her a head start.
Submit a support ticket and I can share with your a blank module. (I just don't want to post publically)
Please sign in to leave a comment.