Custom Fields Not Available in Quote Web Template


Version 1.5.9

Trying to build a custom template for quotes however when I include the $custom_fields variable I get an error that it is not defined. Is this a known bug or am I doing something wrong?


I seem to have this problem as well. Just migrated from 1.4 and trying to solve this. Have read the docs on migrating & changes to custom fields.

For a custom variable called “ABN” in “user”, I’ve tried:

<?php if ($custom_fields['user']['ABN']) {
  echo 'ABN: ' . ($custom_fields['user']['ABN']) . '<br><br>'; } ?>

Which throws up a PHP error: “Undefined variable: custom_fields”

I’ve also tried:

<?php if (!empty($custom_fields['user']['ABN'])): ?>
  <?php echo 'ABN: ' . ($custom_fields['user']['ABN']) . '<br><br>'; ?>
<?php endif; ?>

Which doesn’t throw an error, but doesn’t print the custom variable.

Any ideas?


I cannot reproduce this problem.

echo '<pre>';
echo '</pre>';

prints out

array (size=3)
  'invoice' => 
    array (size=3)
      'Sent on' => string '2018-04-26' (length=10)
      'Test Custom Field 2' => null
      'Test Single Choice' => string '' (length=0)
  'client' => 
    array (size=0)
  'user' => 
    array (size=0)

which is correct for my testing setup.

Please verify that the contents of your file application/modules/guest/controllers/View.php matches this file.

$custom_fields is not available in invoice templates and email template

Thanks for the reply. That code again just prints the same error for me.

And yes, checked my live production version of View.php and the one from Git and they are identical.

Mystery! What else could be causing this?


that is weird indeed. If both files are identical, the custom_fields variable should be available in the templates. Have no idea why the var could be missing.