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>
<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>
</div>
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'.
);
break;
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.