Jump to content
X2Community Forums

Customize quote/invoice line fields


Recommended Posts

Hi,

 

I would like to customize the quote line field as follows 

  1. Change the "Comments" to another field name/label  
  2. Add Date of Sale column for quote/invoice line item

I understand this is not possible to customise from the frontend. If so how is it possible to achieve this from the backend code or database?

Also how to ensure the customisation remains intact after every X2 Engine update?

What code/DB can be edited to do this?

Link to post
Share on other sites

Done some research

http://x2community.com/topic/953-new-column-in-quote-template/

 

http://x2community.com/topic/869-add-description-product-in-quote/

 

http://x2community.com/topic/1606-quotes-changing-products-fields/

 

It will be good to know which code to edit to make this change. 

This is the most unfortunate issue with the default invoice/quote feature, no customisation information.

Otherwise invoice is a very useful feature in X2CRM.

 

If this is not possible I will need to create my own (or use a 3rd party) custom invoice system with tables outside the CRM database and codebase.

 

Note I'm using the X2CRM Open Source downloaded version.

Link to post
Share on other sites

Hi qwerty,

 

The main files responsible for the display of the quotes table are protected/modules/quotes/views/quotes/_lineItems.php and protected/modules/quotes/assets/js/LineItems.js. Changing the "Comments" label should be fairly straightfoward, but adding another field will be more complicated and will likely involve database changes, probably to the x2_quotes_products table.
 

 

Also how to ensure the customisation remains intact after every X2 Engine update?

 

 

See http://wiki.x2engine.com/wiki/Customization_Framework. PHP customizations can be maintained in the /custom directory, but JS customizations can't. The framework does not yet support DB customizations, so you'll have to manage those on your own. This means that if you make a database which conflicts with a database change in an X2Engine update, then you'll have to modify either the database changes that you've made or the update package itself before updating.

 

Derek

Link to post
Share on other sites
  • 2 weeks later...

Thanks Derek, I have easily changed the Comment label in the php file _lineItems.php and placed in the customization dir.

But how can I change the name of the field called description? I guess it is an entity that will be need to changed in the DB table too?

Is it advisable to do this? I would like to change the field name to Request ID and make it indexable. is this possible?

 

I understand that adding a new filed to the invoice item model is complicated.

But how would I go about adding Date of Sale? Each item/service in my invoice model will have a Date of Sales.

 

I can change the scheme for the table x2_quotes_products to add the column with Date of Sale and date type datetime.

Then with PHP customization, in file _lineItems.php do I simply change the $titleTranslations such as this with key "saledate"

$titleTranslations = array( // keys correspond to CSS classes of each input field
    'product-name'=>Yii::t('quotes', '{product} Name',array(
        '{product}'=>Modules::displayName(false, "Products")
    )),
    'saledate'=>Yii::t('quotes', 'Date of Sale'),
    'adjustment-name'=>Yii::t('quotes', 'Adjustment Name'),
    'price'=>Yii::t('quotes', 'Price'),
    'quantity'=>Yii::t('quotes', 'Quantity'),
    'adjustment'=>Yii::t('quotes', 'Adjustment'),
    'description'=>Yii::t('quotes', 'Request ID')
);
foreach ($model->productLines as $item) {
    $lineItemsVarInsertionScript .= "productLines.push (".
        CJSON::encode (array ( // keys correspond to CSS classes of each input field
        'product-name'=>array ($item->formatAttribute('name'),$item->hasErrors('name')),
        'saledate'=>array ($item->formatAttribute('saledate'),$item->hasErrors('saledate')),
        'price'=>array ($item->formatAttribute('price'),$item->hasErrors('price')),
        'quantity'=>array ($item->formatAttribute('quantity'),$item->hasErrors('quantity')),
        'adjustment'=>array ($item->formatAttribute('adjustment'),$item->hasErrors('adjustment')),
        'description'=>array ($item->formatAttribute('description'),$item->hasErrors('description')),
        'adjustment-type'=>array ($item->formatAttribute('adjustmentType'),false))).
    ");";
} 
    <thead>
        <tr>
            <th class='first-cell'></th>
            <th class="lineitem-saledate"><?php echo Yii::t('products', 'Date of Sale'); ?></th>
            <th class="lineitem-name"><?php echo Yii::t('products', 'Line Item'); ?></th>
            <th class="lineitem-price"><?php echo Yii::t('products', 'Unit Price'); ?></th>
            <th class="lineitem-quantity"><?php echo Yii::t('products', 'Quantity'); ?></th>
            <th class="lineitem-adjustments"><?php echo Yii::t('products', 'Adjustments'); ?></th>
            <th class="lineitem-description"><?php echo Yii::t('products', 'Request ID'); ?></th>
            <th class="lineitem-total"><?php echo Yii::t('products', 'Price'); ?></th>
        </tr> 

Much appreciate if you could please guide which JS file and where in the JS file I should modify to add date of sale?

I would like to add this field without any issues. I will be backing up the modifying so that I can overwrite the updated JS and DB schema for the table on next release from X2CRM. I believe PHP customization should be intacted since the change resides in the customization dir.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...