Custom fields in quotes not showing

Hello to everyone,
i’m trying to add custom fields in the quote pdf but i got errors and errors.
I have already placeded some modify in the template without problem but i can’t understand how to fix this issue.

I followed the wiki for custom filed.
I have made the record in the app (image1)
I have put the string in the code (image2)
I got erros … (image3)

Anyone could help me ?

images link:



(i’m trying to upload the images to this for but it doesen’t work)

Please use

<?php print_r($custom_fields) ?>

to check if the custm field is present and how the index is named.

Ok got the error.
If the custom field is empty in the client form, the app show the error.
with the print_r($custom_fields), in fact, the empty fields do not appear in the array.

How to avoid the error if the field is empty ?
I have try with an if statement like this one but i have had no success… if the custom field is empty, the pdf generation give me the error.
this is my try:

 if ($custom_fields['client']['INDIRIZZO SPEDIZIONE1']) {
                echo '<div>' . htmlsc($custom_fields['client']['INDIRIZZO SPEDIZIONE1']) . '</div>';
        }

any suggestion ?

Try

if (isset($custom_fields[‘client’][‘INDIRIZZO SPEDIZIONE1’])) {
    ...

i have done in this way and seems working fine. What do you think ?

if (!empty($custom_fields['client']['INDIRIZZO SPEDIZIONE1'])) {
            echo '<div>' . htmlsc($custom_fields['client']['INDIRIZZO SPEDIZIONE1']) . '</div>';
    }

If it’s working it can’t be that wrong.