CRM Stage tutorial:

Appending Options to the SugarCRM Administration Area

By Josh Sweeney on 16 Feb 2011
Edited: 18 Feb 2011

Upgrade Safe: Yes
Target Audience: Developer
CRM: SugarCRM

In this tutorial we will outline the steps required to add links in the Administration section of SugarCRM. This tutorial was created for reference and does not explain how to build the configuration options behind the links on the SugarCRM administration page.


Section 1 - Create Folders

In order to add the configuration options you will need to add a few folder to your folder structure. If the files that we create in Section 2 are not in the correct place then the customization will not work. It is also good to note that capitalization is important.

1.1 - Go to the SugarCRM custom directory.

1.2 - If a folder named Extension does not exist then create it. ( custom/Extension )

1.3 - Inside of Extension create modules. ( custom/Extension/modules )

1.4 - Inside of modules create Administration. ( custom/Extension/modules/Administration )

1.5 - Inside of Administration create Ext. ( custom/Extension/modules/Administration/Ext )

1.6 - Inside of Ext create Administration. ( custom/Extension/modules/Administration/Ext/Administration )

1.7 - Inside of Ext create Language. ( custom/Extension/modules/Administration/Ext/Language )

Section 2 - SugarCRM Admin Array

2.1 - Create a PHP file in custom/Extension/modules/Administration/Ext/Administration and name it accordingly.

A popular naming convention for this file is <modulename>admin.php.

Example: If you are building an admin area for a telemarketing module then call it telemarketingadmin.php 

2.2 - Add the code that will create your SugarCRM Administration section.

<?php

    $admin_option_defs=array();

    $admin_option_defs['Administration']['telemarketing']= array(

    $image_path . ' telemarketing ','LBL_TELEMARKETING_CONFIG1_TITLE','LBL_TELEMARKETING_CONFIG1_DESC','./index.php?module= telemarketing &action=config');

    $admin_group_header[]= array('LBL_TELEMARKETING_CONFIG_HEADER','',false,$admin_option_defs, '');

    $config_categories[] = ' telemarketing ';

?>

The text in all capital letters are variables that will be populated by the language file that we are going to create.

The LBL_TELEMARKETING_CONFIG_HEADER definition in the $admin_group_header array will display the text defining the section of the admin area.

LBL_TELEMARKETING_CONFIG1_TITLE will be the label used on our link to the actual configuration page.

LBL_ TELEMARKETING _CONFIG1_DESC is the description next to the link.

Section 3 - The Language File

3.1 - Create a PHP file in custom/Extension/modules/Administration/Ext/Language and name it en_us.lang.php or change the language prefix to the appropriate language.

3.2 - Add the following code

 

<?php

 

$mod_strings = array (

'LBL_TELEMARKETING_CONFIG_HEADER' => "Telemarketing Configuration",

'LBL_ TELEMARKETING _CONFIG1_TITLE' => "Telemarketing Configuration Page 1",

'LBL_ TELEMARKETING _CONFIG1_DESC' => "Manage Settings for Telemarketing",

);

?>

The language file assigns the label that will be shown to variables that were configured in the new SugarCRM admin area created in Section 2.

Section 4 - Repair and Rebuild

4.1 - In order for SugarCRM to pick up the changes you will need to browse to Admin -> Repair and choose Quick Repair and Rebuild.

Section 5 - Verify the SugarCRM Changes

5.1 - Browse to the Admin section in SugarCRM and scroll to the bottom.

If all went well then you will see a new SugarCRM admin section.