Create options while creating Custom Extension for Frontaccounting |
X

Congrats, You are Subscribed to Receive Updates.

Create options while creating Custom Extension for Frontaccounting


Create options while creating custom extension for frontaccounting. Yes it one of a most important thing while you develop a custom module. Because definitely you need to play with several options.if its stored in database its easy to reuse it. So just follow this tutorial. You will get ideas to play with it.

Let’s begin from the Hooking class. Here is an example code for the Hooks class.

<?php
// ----------------------------------------------------------------
// Author: Kvvaradha
// Title:   Demo hooks code
// Demo code
// ----------------------------------------------------------------
define ('SS_DEMO', 160<<8);
include_once($path_to_root . "/modules/demo.php");

class hooks_demo extends hooks {
	var $module_name = 'demo';
}

For our demo purpose, i added a custom tab on the header section with the help of following code.

    function install_tabs($app) {
        $app->add_application(new demo_app);
    }

And now, here is our custom function for the options,

function install_options($app) {
        global $path_to_root;

        switch($app->id) {
            case 'demo':
                $app->add_lapp_function(1, _('Demo Page'),
                $path_to_root.'/modules/demo.php', 'SA_DEMO', MENU_MAINTENANCE);
        }

}

This is how, you can create your custom options. Here the demo.php is a class which will have the options to extend its page.

Here is the complete code for demo page  module.

<?php
// ----------------------------------------------------------------
// Author: Kvvaradha
// Title:   Demo hooks code
// Demo code
// ----------------------------------------------------------------
define ('SS_DEMO', 160<<8);
include_once($path_to_root . "/modules/demo.php");

class hooks_demo extends hooks {
	var $module_name = 'demo';

      function install_tabs($app) {
        $app->add_application(new demo_app);
    }
     function install_options($app) {
        global $path_to_root;

        switch($app->id) {
            case 'demo':
                $app->add_lapp_function(1, _('Demo Page'),
                $path_to_root.'/modules/demo.php', 'SA_DEMO', MENU_MAINTENANCE);
        }

}
}

Just try it on your own.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

4 comments

  1. commenter

    I really like and appreciate your blog article.Really looking forward to read more. Really Great.

  2. commenter

    Although the function is called add_options(), it actually provides menu links. The real options would be the ability to set variables (config options) in the settings page / area of the extension.

Reply to OrkingGal Cancel reply

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar