Creating a custom modules in Vtiger CRM 6.5 involves several steps, including setting up the module directory, creating necessary files, defining module components, and installing the module. Below are detailed steps to guide you through the process:
Step 1: Set Up the Module Directory
- Navigate to the Modules Directory:
Go to themodules
directory in your Vtiger CRM installation path. - Create a New Directory:
Create a new directory for your custom module. For example, if your module is named “CustomModule”, create a directory namedCustomModule
.
Step 2: Create the Manifest File (manifest.xml)
- Create a manifest.xml File:
In your module directory (modules/CustomModule
), create a file namedmanifest.xml
. This file defines the module metadata.
<module>
<name>CustomModule</name>
<label>Custom Module</label>
<parent>Settings</parent>
<type>entity</type>
<version>1.0</version>
<isentitytype>true</isentitytype>
<initfunction>CustomModule_init</initfunction>
<entityfieldname>custommodule_name</entityfieldname>
<entityidfield>custommoduleid</entityidfield>
<tables>
<table>
<name>vtiger_custommodule</name>
<sql>CREATE TABLE vtiger_custommodule (
custommoduleid INT NOT NULL AUTO_INCREMENT,
custommodule_name VARCHAR(255),
PRIMARY KEY (custommoduleid)
);</sql>
</table>
</tables>
<blocks>
<block>
<label>LBL_CUSTOMMODULE_INFORMATION</label>
<fields>
<field>
<columnname>custommodule_name</columnname>
<uitype>2</uitype>
<typeofdata>V~M</typeofdata>
<label>LBL_CUSTOMMODULE_NAME</label>
</field>
</fields>
</block>
</blocks>
</module>
Step 3: Define Module Components
- Module Class:
Create a PHP file namedCustomModule.php
in your module directory. This file defines the module class.
<?php
class CustomModule extends CRMEntity {
public $table_name = 'vtiger_custommodule';
public $table_index = 'custommoduleid';
public $customFieldTable = Array('vtiger_custommodulecf', 'custommoduleid');
public $tab_name = Array('vtiger_crmentity', 'vtiger_custommodule', 'vtiger_custommodulecf');
public $tab_name_index = Array(
'vtiger_crmentity' => 'crmid',
'vtiger_custommodule' => 'custommoduleid',
'vtiger_custommodulecf' => 'custommoduleid'
);
public $list_fields = Array (
'Custom Module Name' => Array('custommodule', 'custommodule_name'),
);
public $list_fields_name = Array (
'Custom Module Name' => 'custommodule_name',
);
public $list_link_field = 'custommodule_name';
public $search_fields = Array(
'Custom Module Name' => Array('custommodule', 'custommodule_name'),
);
public $search_fields_name = Array (
'Custom Module Name' => 'custommodule_name',
);
public $popup_fields = Array ('custommodule_name');
public $def_basicsearch_col = 'custommodule_name';
public $def_detailview_recname = 'custommodule_name';
public $mandatory_fields = Array('custommodule_name');
public $default_order_by = 'custommodule_name';
public $default_sort_order='ASC';
}
- Language File:
Create a language file inlanguages/en_us/CustomModule.php
to define the language strings for your module.
<?php
$languageStrings = array(
'CustomModule' => 'Custom Module',
'SINGLE_CustomModule' => 'Custom Module',
'LBL_CUSTOMMODULE_INFORMATION' => 'Custom Module Information',
'LBL_CUSTOMMODULE_NAME' => 'Custom Module Name',
);
Step 4: Install the Module
- Zip the Module Directory:
Compress theCustomModule
directory into a.zip
file. - Upload the Module:
- Go to the Vtiger CRM Settings page.
- Click on “Module Management” -> “Module Manager”.
- Click on “Import Module from Zip” and upload your zipped file.
- Follow the instructions to complete the installation.
Step 5: Create Custom Pages
To create custom pages for your module, you need to define them in your module directory.
- Create a Page File:
Create a PHP file for your custom page, e.g.,CustomPage.php
in themodules/CustomModule
directory.
<?php
require_once('include/utils/utils.php');
global $adb;
// Your custom page logic here
- Define the Entry Point:
Add an entry in themodule/CustomModule/manifest.xml
file to define the custom page entry point.
<actions>
<action>
<module>CustomModule</module>
<actionname>CustomPage</actionname>
<path>modules/CustomModule/CustomPage.php</path>
</action>
</actions>
- Access the Custom Page:
After installing the module, you can access your custom page using the following URL format:
http://your_vtiger_url/index.php?module=CustomModule&action=CustomPage
By following these steps, you can create a custom module and pages in Vtiger CRM 6.5. This process involves setting up the module directory, creating necessary files like manifest.xml and module class files, defining the module components, and installing the module through the Vtiger CRM interface.
Conclusion
Creating any particular custom modules in Vtiger CRM 6.5 consists of numerous steps, including properly setting up the directory of the module, creating only crucial files, describing components of the module, and lastly, installing the cusom module. Above are complete steps to navigate you through the whole process. To create any specific module in CRM 6.5, it became very crucial to have the best Vtiger hosting solutions.