• When I have no image/logo set for my document, the function Order_Document::has_header_logo() ($this->has_header_logo()) in the invoice template gives a wrong result back.

    When I was debugging a saw that the value of Order_Document::settings['header_logo'] was Array ( [default] => ).

    So when the function Order_Document::has_header_logo() is called it will check is the variable is not empty, but there is an array with an empty value stored in the variable.

    At the moment, I use a workaround by checking the settings direly in my invoice template ($this->setting[‘header_logo’]).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @jensbns,

    I guess you are using a custom PDF template, right? If so, could you please take a look at the latest version of our default Simple template, and check the invoice code (source)? I think you could be using old code, so comparing your code with the latest default one, could help you to troubleshooting what is happening.

    Thread Starter JensBNS

    (@jensbns)

    I’m indeed using a custom PDF template.
    I reviewed the code from your previous post, but I still see the same issue in the latest version.
    There isn’t directly a problem with the PDF template.

    The issue is that the function to check if there is a header logo ($this->has_header_logo()), will return True even when I haven’t set a logo in the general settings.

    And the reason that this function returns True is that the setting for header_logo apparently is an array with no usable values.
    Array (
    [default] =>
    )

    For now, I replaced the function $this->has_header_logo(), in the PDF template, by a check of the settings array like so:
    if( !empty($this->settings['header_logo']) && !empty($this->settings['header_logo']['default']))

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for providing more details, @jensbns:

    Just out of curiosity, do you have the same behavior with our default Simple template?

    Thread Starter JensBNS

    (@jensbns)

    I just tested this, and this is also a problem with the default Simple template, as I suspected.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.