Jump to content

Logo missing on invoices PS 1.7.8.6


frustrate

Recommended Posts

This seems to be an old bug. Tried almost everything and cannot get logo to show up on invoices. Found the header.tpl and manually adding some text does work but no luck with logo img.  Anybody have any idea where the URL or URI is generated for $logo_path in header.tpl. I think it is an issue with directories but not sure.

This issue also shows up on delivery notes.

Link to comment
Share on other sites

Found that but if you look at the code above that getLogo() you will notice code for $logo. If my understanding is correct if $invoiceLog or $logo is empty it will return  nothing. Considering that my logo is showing, assuming $logo is the variable used for that then there is an issue in the code for $ invoiceLogo

 protected function getLogo()
    {
        $id_shop = (int) $this->shop->id;

        $invoiceLogo = Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop);
        if ($invoiceLogo && file_exists(_PS_IMG_DIR_ . $invoiceLogo)) {
            return $invoiceLogo;
        }

        $logo = Configuration::get('PS_LOGO', null, null, $id_shop);
        if ($logo && file_exists(_PS_IMG_DIR_ . $logo)) {
            return $logo;
        }

        return null;
    }

 

So I would thing the issue might be in PS_LOGO_INVOICE and again where is this defined?

Link to comment
Share on other sites

Just tried something and replaced PS_LOGO_INVOICE with PS_LOGO and that did not work, so one can assume there is no problem there. Back to assignCommonHeaderData() again. A bit stuck not sure how to progress, any ideas

Link to comment
Share on other sites

yes I do, i specifically did that first. In the interim I have discovered that $logo_path is not empty. I just printed the variable in the pdf and the url was printed. So it looks like there is a problem with the way the pdf is generated. I have tried adding alt in html code to see if it will print the url if the image is not there and that does not work either.

Link to comment
Share on other sites

5 minutes ago, Tom Girou said:

Of course, it's just for the example.

The only thing that remains is that there is an issue with the styling, not sure but I already tried without any height and width styling and it makes not difference

 

Link to comment
Share on other sites

13 hours ago, Ress said:

Have you tried to make any other changes through the template? Are the changes made?

hi Ress in order to try and find where the problem is I added code to see if it makes any difference, which it does obviously, then delete the added code to return it to default again. So what I have discovered is that the variable $logo_path is not empty and changing the src tag to just a td tag and printing the content of $logo_path in the pdf actually does work. So I know the image was fetched but for some reason it does not display on the pdf.

So in header.tpl I did this

<table style="width: 100%">
<tr>
    <td style="width: 50%">
    
        {if $logo_path}
            <img src="$logo_path" alt="$logo_path" style="width:{$width_logo}px; height:{$height_logo}px;" />
              <td style="font-size: 14pt; color: #9E9F9E">{$logo_path|escape:'html':'UTF-8'}</td>          

        {/if}
                    
    </td>
    <td style="width: 50%; text-align: right;">
        <table style="width: 100%">
            <tr>
                <td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%;">{if isset($header)}{$header|escape:'html':'UTF-8'|upper}{/if}</td>
            </tr>
            <tr>
                <td style="font-size: 14pt; color: #9E9F9E">{$date|escape:'html':'UTF-8'}</td>
            </tr>
            <tr>
                <td style="font-size: 14pt; color: #9E9F9E">{$title|escape:'html':'UTF-8'}</td>

Obviously I deleted the line afterwards.

I tried the same with $width_logo and $height_logo and that did not work so I do not know if the styling is an issue. I looked at the delivery note pdf and the logo is missing on that too.

Strange that I have lodged a similar issue but with $order_link in the payment module where the variable is empty in the email sent and that was definitely confirmed as a bug with no solution thus far which means I cannot send my customers a payment link which makes the entire platform pretty useless; that is if you cannot get your customers to pay you.

This issue of no logo however makes the issued invoice illegal according to Australian law and thus again makes the platform useless. If I cannot find a solution soon I will have to migrate to a working platform.

 

Link to comment
Share on other sites

  • 10 months later...

Old thread but I just found my solution to this problem and since it's not mentioned before I thought I should add it. 

During the generation of the PDF the server try to fetch the image from it's own address, like www.shop.com. If the server is behind a firewall that firewall needs to support that the server on the inside makes a call to the address on the outside. It's sometime called hairpinning, some time NAT reflection and surely a bunch of more names. This isn't working in all setups. 

To solve the problem I entered 

<ip of localhost> www.shop.com 

(you need of course to switch www.shop.com to your address) in the hosts file. Now the server ask its local host-adress for the file and that works.

  • Like 1
Link to comment
Share on other sites

Thank you for your contribution,

I also found that sometimes smarty couldn't fetch the https path for the logo 

 

I replace the line with:

			<img src="{$logo_path|replace:"https":"http"}" style="width:{$width_logo}px; height:{$height_logo}px;" />

 

  • Like 1
Link to comment
Share on other sites

  • 6 months later...
On 4/20/2023 at 11:51 AM, disarci said:

Thank you for your contribution,

I also found that sometimes smarty couldn't fetch the https path for the logo 

 

I replace the line with:

			<img src="{$logo_path|replace:"https":"http"}" style="width:{$width_logo}px; height:{$height_logo}px;" />

 

Great this is working.... <img src="{$logo_path|replace:"https":"http"}" style="width:{$width_logo}px; height:{$height_logo}px;" />

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...