Business, suitecrm, Technology, Tutorial, Ubuntu

HOW TO CHANGE THE ROW HEADERS IN SUITECRM LINE ITEMS IN QUOTES MODULE

PRE-CHAT

As always, SuiteCRM is one of my favourite business tools in the free and open software world. I like to describe it as ‘Sales Force on steroids’ because you can do whatever you want with it, basically, since the code is open and community supported. However, once in a while you will hit a road block.

This literally took me two weeks, full time, serious pain. Granted I didn’t know a drop of PHP, but wowzers – hard. The good news is this is going to save you that much time or more.

First of all, for some reason this really useful page evaded me for the first week. Had I found this everything would have made a lot more sense sooner. So bookmark this important page about SuiteCRM customizations. This page will be very useful if you plan to really dig deep and customize things for yourself and others.

This tutorial is assuming you have root access to your server and you are doing things ‘on the fly’ like me and not with a proper developers environment – a real weekend warrior hack space. If you are a real developer with skills, bonus! You can probably just upload your work and not worry about root user stuff maybe. In either case this will save you time.

Note this: SuiteCRM has periodic upgrades, of course, and if you do things the way they like your customizations will make it through the upgrade. Otherwise, you stand to lose your work when they upgrade. I would recommend documenting stuff as you go like I’m doing here in case you have to rebuild stuff. Ideally everything I’m doing here should be built right into the GUI, but for some reason it’s not for this part. Hopefully someone can take my work here and build this line item functionality right into the GUI.

WHAT I LEARNED ABOUT THE HEADERS

The customization of the row headers is essentially a ‘language-translation’ approach. This makes sense because if you were German you would want the word ‘List’ and ‘Price’ to be in German. However, unlike most of the other parts of SuiteCRM (‘scrm’ from now on) you can’t seem to edit these from within Admin / Studio – the logical place you would expect to be able to do this. I believe it is very rare that this kind of customization would be required however, more control over this part is, in my opinion, critical because of the various tax rates and other needs. In my case I needed to add recycling deposits and environmental fees to the row, but others I know needed multiple taxes.

In this case, we want to modify the strings / language that are found in this en_us language file.

Also it is worth mentioning that you should not change the pre-pending part of the php file as suiteCRM will go through and scan for that. So if you are using en_us (the default) make sure that stays at the front of your modified PHP file.

For this example, I want to change line 161 which has this:

‘LBL_UNIT_PRICE’ => ‘Sale Price’,

I don’t like the word ‘Sale Price’ and I want it to say ‘POOPY PRICE’ (to be sure it jumps off the page when it’s working)

Before we go forward, the documentation above fails to mention two important things:

  1. You must be root / sudo user in order to modify anything beyond the /modules path and
  2. There is no pre-existing ‘Language’ directory at all – you must create it first

This is the format and location of where your newly-created file will go and look like. Study it deeply:

custom/Extension/modules/<TheModule>/Ext/Language/<LanguageTag>.<Name>.php

Now let’s run the actual example step by step.

HOW TO DO IT.

As mentioned above, this string ‘Sale Price’ is found stock in this en_us language file in the AOS_Quotes module. So the first step is to be sure you are modifying the correct module. Adjust the paths according to your needs.

  1. Log into your SuiteCRM instance
  2. Change to root user (in my case with sudo su) and of course be careful since you can kill everything now, ha
  3. Navigate to the Ext folder: cd /var/www/html/suitecrm/custom/Extension/modules/AOS_Quotes/Ext/
  4. Make the ‘Language’ directory that SCRM needs: mkdir Language
  5. Navigate into it: cd Language
  6. Create a new blank php language customization file into which you will paste your code: sudo nano en_us.myTestFile.php
  7. Paste in this example code:
<?php
$mod_strings['LBL_UNIT_PRICE'] = 'SLOPPY PRICE';
  1. Control x to save your changes in the terminal (if you are using Ubuntu, if not not sure…)

At this point, in your test quote in SCRM you will see no changes it seems. I refreshed, I did a control + F5, I edited the quote, I did everything. My changes did not show. Then, I did the quick repair and build, refreshed changes and there was my new POOPY PRICE header. So these are those last steps after you make a customization:

  1. Go to ‘Admin’ in SCRM
  2. Under ‘System’ go to ‘Repair’
  3. Select ‘Quick Repair and Rebuild’
  4. Go back to your quote and refresh the page – your changes should now be visible in the header.

Very likely the process is the same for modifying all strings in SCRM so be sure to dig into that resource link above if you plan to go further.

I hope this helps and saves you the pain I had to go through! 🙂

Tagged , , ,

Leave a Reply

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