How to quickly add google maps to any module in Vtiger

How to quickly add google maps to any module in Vtiger

One of my clients approached me with a request to add a Google map to the transaction map, as is done in the Leads or Contacts modules in Vtiger CRM. I decided to take on the task and help the client implement this feature.

First, I modified the layouts/v7/modules/Potentials/DetailViewHeaderTitle.tpl file. To do this, I added code that displays a button that opens a popup window with a Google map. The code itself adds a line with the marker icon and a link to the script that opens the map. Here's what it looks like:

<div class="info-row">

    <i class="fa-map-marker"></i>&nbsp;

    <a class="showMap" href="javascript:void(0);" onclick='Vtiger_Index_Js.showMap(this);' data-module='{$RECORD->getModule()->getName()}' data-record='{$RECORD->getId()}'>{vtranslate('LBL_SHOW_MAP', $MODULE_NAME)}</a>



Next, I added field mapping and support for the new module to the maps. To do this, I made changes to the modules/Google/helpers/Map.php file. I added a new block of code to the getLocationFields function.


case 'Potentials':

    $locationFields = array(

        'street' => 'cf_1148',

        'city' => 'cf_1142',

        'state' => 'cf_1203',

        'zip' => 'cf_984',

        "country" => 'cf_777'.




Here you should replace cf_ with the name of your module fields.

The customer was happy with the result and now he has the ability to add Google maps to the deal cards in Vtiger CRM. Glad I could help my client and implement this feature in a short amount of time.

Popular Posts

My most popular posts

Maximum productivity on remote job

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, and Vue.js. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form