$custom_fields is not available in invoice templates and email template


#23

these two fixes did not work for me.
My custom field still outputs this error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$client_custom_site_contact

EDIT: it’s not working in pdf or public invoices/quotes
I got it to work in emails by changing my custom field label to {{{ip_cf_2}}}


#24

I recently upgrade the system to 1.5.4. and the $custom_fields is still not available in invoicePlane_Web.php public template.


#25

I’m seeing the same thing, custom_fields is undefined in the public template.


#26

Anyone coming across this; I made a pull request to make custom fields available in the web/public templates: https://github.com/InvoicePlane/InvoicePlane/pull/549/files


#27

hello,
nothing is working for me, I can’t add a custom field to InvoicePlane_Web.php
not with changes to application\helpers\template_helper.php and application\modules\custom_fields\models\Mdl_custom_fields.php
nor with application/modules/guest/controllers/View.php

did it work for you all ?


#28

hello,

sorry, I know why, maybe you need to reapply same changes in View.php to include also custom tags for quotes not only invoices.
I modified it and it works now.


#29

Really…This needs to be tested on all environments before releasing…Very poorly managed.


#30

Does latest version 1.5.5 have custom fields working?


#31

Custom fields are working perfectly fine for me.


#32

Hello, Did you find a fix for this?
Thanks


#33

Issue seems to be with customs fields with “Single Choice” in E-Mail templates as I came across. It just displays the “custom_values_id” in “ip_custom_values” table.
Value in “ip_invoice_custom” table referring to the filed is also the same value. Is it correct?
Text and other single types work.
@YeyDev any help from your side is also welcome


#34

I’ve got this problem as well. Just migrated from 1.4 to 1.5.9 and trying to solve this. Have read the docs on migrating & changes to custom fields. I have custom fields working in my PDF templates and in email, but am getting errors / no result in the web view templates.

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.

What am I doing differently to you @Kovah ?


#35

Custom fields are working as expected for both web and PDF templates.

Email templates are using a different approach that makes usage of some custom fields impossible at the moment. But email templates will be completely rewritten anyway.


#36

OK, if they’re working correctly, how can I call them in web templates?

<?php print_r($custom_fields) ?>

throws:

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: custom_fields


#37

See my post here: Custom Fields Not Available in Quote Web Template