Potential Bug: 7.9 Quote Line Item custom fields do not display when quote is loded

Add a custom column or two to Quote Line Items:

custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php

select a value for the custom field and save.

 

The custom fields show with their saved values, a query on the back end confirms that the values are saved. Right after the save the line looks like this:

 

Leave the Quote and go back to it, or simply reload the page, and the custom values do not display

There are no errors in the console.

Update any one of the fields in the line, save, and ALL the custom values are displayed again.

 

Reload the page. None of the custom values are visible. 

 

Dragging lines to sort differently will display all values again, reload the page or move away and come back, and the custom values are not displayed.

 

It seems that the custom values are not included in the initial load of the quote line items, but are loaded when the row itself is refreshed.

Note the difference in the number of model attributes in the view when the quote is first loaded (no custom fields and about 1/4 of the stock fields compared to the model after the QLIs are moved around)

 

And after the QLIs are moved around (sorry, had to split into 3 screenshots because there are so many more)

FrancescaS

  • Hi Francesca,

    I faced the same issue. I debugged the code and got the solution.

    Go to the following file:

    custom/modules/Quotes/clients/base/views/record/record.php

    Add your custom fields in "product_bundle_items" array.

    I hope this will help to resolve the issue.

    Thanks

  • Hmm, what version are you running?

    On 7.9.2.0, I did the same process of debugging, finding that the attributes value wasn't included until a call went out later which grabbed every attribute.

    I'm trying to add a relate field into the list, and when I use the workaround in product_bundle_items, all previously showing items disappeared. So rather than a field not populating, the entire row won't populate!

    No errors in the console either... Completely stuck. Any ideas?

  • I am now on 7.9.3 and Saqib Muhammad's fix works. It is not just a workaround, it is the proper way to add items to Quoted Line Items according to the updated documentation.

    Can you add some details about the files you added the relate field to?

    FrancescaS

  • Hi Francesca,

    Thanks, I'll do my best to succinctly explain.

    I have a vardef file in custom/Extension/modules/Products/Ext/Vardefs/file.php:

    $dictionary['Product']['fields']['vat_rate'] = array(
        'name' => 'vat_rate',
        'vname' => 'LBL_LIST_VAT_RATE',
        'type' => 'id',
        'required' => true,
        'do_report' => false,
        'reportable' => false,
    );
    $dictionary['Product']['fields']['vat_rate_name'] = array(
        'name' => 'vat_rate_name',
        'rname' => 'name',
        'id_name' => 'vat_rate',
        'join_name' => 'taxrates',
        'type' => 'relate',
        'link' => 'taxrates',
        'table' => 'taxrates',
        'isnull' => 'true',
        'module' => 'TaxRates',
        'dbType' => 'varchar',
        'len' => '255',
        'vname' => 'LBL_LIST_VAT_RATE',
        'source' => 'non-db',
        'comment' => 'Vat Rate Name',
        'massupdate' => false,
    );

    I can see this in the Products record view without issue:

    Product Record View

    So I'd already tried to create this in Quotes by doing what was originally done by the OP:

    custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php:

    array(
        'name' => 'vat_rate_name',
        'type' => 'quote-vat-relate',
        'initial_filter' => 'active_taxrates',
        'filter_populate' => array(
            'module' => array('TaxRates'),
        ),
        'related_fields' => array(
            'vat_rate_name',
            'vat_rate'
        ),
    ),

    I ran into the exact same issue with this.model not including the field in question until the lines were moved and the resulting data was fetched and subsequently populated.

    I then arrived at the exact same conclusion that worked for you both, and attempted to add the field in question:

    custom/modules/Quotes/clients/base/views/record/record.php:

    'name' => 'product_bundle_items',
    'fields' =>
    array (
    //Rest of the array removed from this sample for clarity
        16 => 'discount_select',
        17 => 'vat_rate_name',
        18 => 'total_amount',
    ),

    After a repair, I go back to the quote, and all of the lines appear to be gone:

    It's so strange. I'd normally expect to see some JS errors in the console saying I'd done something wrong, or a failed request somewhere, but nothing seems obviously wrong.

    Hope you can make sense of whatever I seem to have done incorrectly here!

    Richard

  • It sounds like there is a problem rendering. You may see an error in your PHP files.

    It looks like you added the field as type relate in the vardefs

    $dictionary['Product']['fields']['vat_rate_name'] = array(
        'name' => 'vat_rate_name',
        'rname' => 'name',
        'id_name' => 'vat_rate',
        'join_name' => 'taxrates',
       
    'type' => 'relate',
        'link' => 'taxrates',
        'table' => 'taxrates',
        'isnull' => 'true',
        'module' => 'TaxRates',
        'dbType' => 'varchar',
        'len' => '255',
        'vname' => 'LBL_LIST_VAT_RATE',
        'source' => 'non-db',
        'comment' => 'Vat Rate Name',
        'massupdate' => false,
    );

    but are changing the type in the quote data group list to 

    array(
        'name' => 'vat_rate_name',
        'type' => 'quote-vat-relate',
        'initial_filter' => 'active_taxrates',
        'filter_populate' => array(
            'module' => array('TaxRates'),
        ),
        'related_fields' => array(
            'vat_rate_name',
            'vat_rate'
        ),
    ),

    Try changing type to "relate" in 

    custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php

    array(
        'name' => 'vat_rate_name',
        'type' => 'relate',
        'initial_filter' => 'active_taxrates',
        'filter_populate' => array(
            'module' => array('TaxRates'),
        ),
        'related_fields' => array(
            'vat_rate_name',
            'vat_rate'
        ),
    ),

    That's the only thing I can see that might give you some trouble if you don't have a custom type quote-vat-relate.

    Or if you do, maybe there is a problem with your custom field type?

    Which type did you use in Products record view? Might be worth checking that since it works there.

    Hope this helps,

    FrancescaS

  • Hi Francesca,

    Good spot there. I think I changed the field type in an effort to work around the problem (with the ProductTemplate relate as my subject).

    Unfortunately, I've received the same effects when trying it as a standard relate. My Products record view is the same as the vardef, nothing overidden there:

    custom/modules/Products/clients/base/views/record/record.php

    22 => 
    array (
    'name' => 'vat_rate_name',
    'comment' => 'Vat Rate Name',
    'label' => 'LBL_LIST_VAT_RATE',
    ),

    Thanks anyway for having a good go at it! It might be a bug, I'll raise it and see what happens.