Functional example of Customize Line Items at Quotes module

We have see many unfinished post about Line Items many people only said like this:

just modify these lines:

modules/AOS_Products_Quotes

modules/AOS_Products_Quotes/Line_Items.php
modules/AOS_Products_Quotes/Line_Items.js

But the problem is with that information is not enough because it is something much more complex and a lot of people still cant solve this problem so if
Some developer that at the moment could add new functional fields can help to the community by contributing some example by adding a field in Line_Items from the start we will appreciate it. :wink:

Thanks for the attention.

I’m not understanding what you are trying to do? If you want to add a custom line item just add and select a different product. If you want to add a custom field, just set it up in studio and then add it to your quote layout and add it to quote PDF. Can you explain exactly what you are trying to do?

Hi thanks for the answer Paul i currently see many tutorials from you in youtube
they have served me well :slight_smile:

I will append the steps that I have made to try to add the field correctly

I hope u can help with that

I could not add the file from the option (Add File) so i upload

Line_Items.rar

It seems that nobody can help me with this issue :S

If somebody can help me via private this is my skype: montanaleon1@hotmail.com

i could pay for personal accessory.

Did you just add that field through Studio, or did you make those PHP changes manually?

Both changes

i already solve the problems of the header but the big problem is that i cant connect that field with the Database = aos_products_quotes

and is already added

I almost have 100% functioning, I’ll post it as soon as I have it ,although it’s sad that in the forum there are people with so many years of experience developing in the system and even then they can not give me a good answer :pinch:

Please do post your solution, we need more of that here!

I personally don’t have years of experience developing projects for SuiteCRM, I only started developing one simple project. Then I learned the rest just helping out in the forums. But I often am left without enough expertise to help in coding problems.

I know it can be frustrating to ask and not get answers… we need to ask simple, partial questions, since developers normally don’t have enough time to really “dive” into other people’s problems and figure out what could be wrong.

With time, I hope we develop better community resources (Documentation, past forum threads, blog posts, etc), and get more competent developers on board, so it becomes easier to get help coding.

Thanks for your patience and thanks in advance for posting coding tips in the future.

Ok so first Step add the columns via studio

Check if is already in vardefs i know is cache but it dont delete dosent matter if u repair and compile again

Add the custom field in to line_items.js

1 Like

This is the header i put manual but you can try to use global labels

modify sql query in to line_items.php you dont need to repair and rebuild for see the changes on php files

The Header:

Calling the variable via JSON you have to modify correctly the query for get the information of custom fields

Check if the fields is in the Database-Table

1 Like

Final Results:

I hope this could help you

1 Like

Muchas gracias @Evancio, con seguridad esto sera muy útil para toda la comunidad.

Thanks a lot, this looks quite useful!

Did you manage to make these changes upgrade-safe? Are they all in the “custom” folder or did you need to edit the files in their original places?

I edited line_items.php from original folder and line_items.js from custom folder because i see this condition on line_items.php

if ($view == ‘EditView’) {
$html .= ‘’;
if (file_exists(‘custom/modules/AOS_Products_Quotes/line_items.js’)) {
$html .= ‘’;

If line_items.js is not already on custom folder then is necesary to copy the file from original folder.

And does it still work if your changes are only in

custom/modules/AOS_Products_Quotes/Line_Items.php

but not in

modules/AOS_Products_Quotes/Line_Items.php ?

I hope that file can be customized in an upgrade-safe manner, too…

the changes are in:

modules/AOS_Products_Quotes/Line_Items.php

dont pass the file to custom folder because u cant make changes there i already tried.

Normally when you can’t get a customization to be picked up, it needs to be customized “one file before”, meaning, you need a custom version of the file that invokes that file.

So in this case you probably need custom versions of these vardefs:


/var/www/html/modules/AOS_Quotes/vardefs.php:346:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Quotes/vardefs.php:555:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Contracts/vardefs.php:420:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Contracts/vardefs.php:627:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Invoices/vardefs.php:256:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Invoices/vardefs.php:463:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

Although maybe this mechanism could be improved - if we can find where these vardef “includes” are being evaluated, we could add a check for custom files there…

By the way, since vardefs are actual PHP that gets executed, you could try editing each of those like this:


modules/AOS_Quotes/vardefs.php:346:                        'include' => get_custom_file_if_exists('modules/AOS_Products_Quotes/Line_Items.php')

I never tried this sort of thing, I don’t know if it will work