Jump to content

Invoice logo missing 1.7.4.4


Michel-T3

Recommended Posts

I Updated 2 shops to the latest version op Prestashop (1.7.4.4) and now our invoices don't have a logo. Tried re-uploading the logo file. That seem to be working. Old file is removed, new file is placed and renamed. The new name of the file is also updated in the database. Tried .jpg, .png and .gif... Still no logo on the invoices. All the uploaded files are converted to jpg, which i find strange.

In the server error log I find a error: 

PHP Notice: Undefined property: PrestaShop\\PrestaShop\\Core\\Shop\\LogoUploader::$errors in /home/xxxxx/domains/xx.xx/public_html/src/Core/Shop/LogoUploader.php on line 120\n, referer: https://xxx.xxx/index.php?controller=AdminThemes&token=xxxx

Tried changing the image tmp file, no luck... 

Has anyone else have the same problem? Anyone know a solution?

PHP-versie: 7.1.23

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...

Hi,
I came across the same problem as you guys. For some reason Prestashop didn't get a invoice url.
Being (lazy) me here is a quick fix:

Go to your FTP environment en go the file "pdf/header.tpl"
And replace this:

	{if $logo_path}
			<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
	{/if}

With:
 

<img src="your-logo-url" style="width:250px; height:100px;" />

I used the logo url from my shop, so if that is changed it automatically updated on the invoices to.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 3 weeks later...
On 11/19/2018 at 6:02 PM, Michel-T3 said:

I Updated 2 shops to the latest version op Prestashop (1.7.4.4) and now our invoices don't have a logo. Tried re-uploading the logo file. That seem to be working. Old file is removed, new file is placed and renamed. The new name of the file is also updated in the database. Tried .jpg, .png and .gif... Still no logo on the invoices. All the uploaded files are converted to jpg, which i find strange.

In the server error log I find a error: 

PHP Notice: Undefined property: PrestaShop\\PrestaShop\\Core\\Shop\\LogoUploader::$errors in /home/xxxxx/domains/xx.xx/public_html/src/Core/Shop/LogoUploader.php on line 120\n, referer: https://xxx.xxx/index.php?controller=AdminThemes&token=xxxx

Tried changing the image tmp file, no luck... 

Has anyone else have the same problem? Anyone know a solution?

PHP-versie: 7.1.23

 

It is definitely a bug. You should disable Debug mode not to see PHP Notices. There is no $this->errors in that file so you can also remove it from the code.

Link to comment
Share on other sites

Hi. It's easy.

Go to your FTP environment en go the file "pdf/header.tpl"
And replace this:

	{if $logo_path}
			<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
	{/if}

With:
 

<img src="your-logo-url" style="width:250px; height:100px;" />

I used the logo url from my shop, so if that is changed it automatically updated on the invoices to.

in "your-logo-url"  remplace  "/img/logo_invoice.jpg"  but remeber that logo_invoice should be a new logo with the same size.

I hope you can change it.

best regard

Link to comment
Share on other sites

17 minutes ago, aepg70 said:

Hi. It's easy.

Go to your FTP environment en go the file "pdf/header.tpl"
And replace this:


	{if $logo_path}
			<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
	{/if}

With:
 


<img src="your-logo-url" style="width:250px; height:100px;" />

I used the logo url from my shop, so if that is changed it automatically updated on the invoices to.

in "your-logo-url"  remplace  "/img/logo_invoice.jpg"  but remeber that logo_invoice should be a new logo with the same size.

I hope you can change it.

best regard

Thanks, but this is not a fix. It is a workaround...

 

Also, it is a workaround that is not working in my case. I still have no logo - and I also am missing product images.

 

Any thoughts?

  • Like 1
Link to comment
Share on other sites

The workaround works fine for the logo and will be overwritten if Prestashop updates the template file after they solved this bug. 

I activated the option "show images" on the invoice. And they also do not show up on the invoice from my shop. So I guess Prestashop has to work on an extra option. 

  

Link to comment
Share on other sites

  • 2 weeks later...
On 2/7/2019 at 11:44 AM, aepg70 said:

Hi. It's easy.

Go to your FTP environment en go the file "pdf/header.tpl"
And replace this:


	{if $logo_path}
			<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
	{/if}

With:
 


<img src="your-logo-url" style="width:250px; height:100px;" />

I used the logo url from my shop, so if that is changed it automatically updated on the invoices to.

in "your-logo-url"  remplace  "/img/logo_invoice.jpg"  but remeber that logo_invoice should be a new logo with the same size.

I hope you can change it.

best regard

Thank you very much for your contribution!

Link to comment
Share on other sites

  • 2 weeks later...
On 2/7/2019 at 12:44 PM, Michel-T3 said:

The workaround works fine for the logo and will be overwritten if Prestashop updates the template file after they solved this bug. 

I activated the option "show images" on the invoice. And they also do not show up on the invoice from my shop. So I guess Prestashop has to work on an extra option. 

  

is there already a solution for the image show on the invoice?

Link to comment
Share on other sites

  • 2 weeks later...
On 1/17/2019 at 1:52 PM, Inform-All said:

Hi,
I came across the same problem as you guys. For some reason Prestashop didn't get a invoice url.
Being (lazy) me here is a quick fix:

Go to your FTP environment en go the file "pdf/header.tpl"
And replace this: 


	{if $logo_path}
			<img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" />
	{/if}

With:
 


<img src="your-logo-url" style="width:250px; height:100px;" />

I used the logo url from my shop, so if that is changed it automatically updated on the invoices to.

Thank you. It has worked well for me.

Link to comment
Share on other sites

  • 2 weeks later...
17 hours ago, fjratelier said:

Hi,

Have the same problem here. Have the PS 1.7.5.0 version. I looked at the solution you have here. But what about the multishop? I have 6 shops with different domains and logos. How can I solve this here? Thanks.

Yeah, this is a problem, the fix i provided does not keep track in which Multistore the order was placed.
So you can use my fix, but this only allows 1 logo for all the multistores.

Link to comment
Share on other sites

12 hours ago, Inform-All said:

Did you try my workaround? Could u share with us what u exactly did? (if needed, send me a private message)

I have done nothing at all, just move the webshop to a different folder, and then I will see the image of the product on the invoice. So I now wonder what this is about.

Link to comment
Share on other sites

13 hours ago, Web HvD said:

I have done nothing at all, just move the webshop to a different folder, and then I will see the image of the product on the invoice. So I now wonder what this is about.

Ehm, you mean you want to see the product images on the invoice? 
Maybe start a new post with your question, en be really specific what does not work anymore.

Link to comment
Share on other sites

Hello,

I had the same problem on 1.7.4.4, to solve this problem i overrided the getLogo function in HTMLTemplate.php and i replaced

if (Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop) != false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop))) {

	$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop);

} elseif (Configuration::get('PS_LOGO', null, null, $id_shop) != false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop))) {

	$logo = _PS_IMG_DIR_.Configuration::get('PS_LOGO', null, null, $id_shop);

}

by

if (Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop) != false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop))) {

	$logo = __PS_BASE_URI__ . 'img/' . Configuration::get('PS_LOGO_INVOICE', null, null, $id_shop);

} elseif (Configuration::get('PS_LOGO', null, null, $id_shop) != false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO', null, null, $id_shop))) {

$logo = __PS_BASE_URI__ . 'img/' . Configuration::get('PS_LOGO', null, null, $id_shop);

}

 

I didn't tested in multishop, but it works well for me now,

 

Hope it will help

Link to comment
Share on other sites

En

En 27/3/2019 a las 4:37 PM, Stefand dijo:

Hola, esta solución está funcionando cuando también tiene este problema con el logotipo faltante en la factura en 1.7.5.1:
https://github.com/PrestaShop/PrestaShop/commit/93db0c4a6afaaf138f417005ce93fb38d66659bf#diff-bba6e05abcc88201platin

A mi me ha funcionado en la versión 1.7.5.1.

Lo que no me aparecen son las imágenes de producto en el albarán, ni en la factura. A alguien le ha pasado lo mismo y lo ha podido solucionar.

Gracias.

Link to comment
Share on other sites

  • 4 weeks later...

Hola,

 

Despues de migrar la base de datos completa y el contenido mediante FTP al servidor de produccion, a mi tampoco me aparecen las imagenes en miniatura en facturas y albaranes. he comprobado que si se ven en el servidor de desarrollo. 

He probado a borrar la cache desde el BO pero sigue sin funcionar.

 

La versión que estoy usando es la 1.7.5.0

 

Un saludo,

  Ibon

 

Link to comment
Share on other sites

4 hours ago, apnow said:

Hola,

 

Despues de migrar la base de datos completa y el contenido mediante FTP al servidor de produccion, a mi tampoco me aparecen las imagenes en miniatura en facturas y albaranes. he comprobado que si se ven en el servidor de desarrollo. 

He probado a borrar la cache desde el BO pero sigue sin funcionar.

 

La versión que estoy usando es la 1.7.5.0

 

Un saludo,

  Ibon

 

Have you tried regenerating the images in the backoffice at "Design > Image Settings > Regenerate thumbnails" ?
 

P.S. this part of the forum is English speaking only. 

Link to comment
Share on other sites

Hi Inform-All,

 

Yes I did but nothing changed. I tried to debug a bit the issue but still stuck:

I checked how the invoice was created in HTMLTemplateInvoice.php file. and log the vars in a file using FileLogger. so far, this is the html content created and sent to the tcpdf.php pdf generator:

<img src="/usr/home/<<websitename>>/web/img/tmp/product_mini_44_0.jpg" alt="" class="imgm img-thumbnail" />

I checked that the file exists and even changed img/tmp/ folder permissions to 777 but no luck.

Any hint'

BR,

  Ibon

 

Link to comment
Share on other sites

Hi,

I think I found it a workaround:

 

$order_detail['image_tag'] = preg_replace(
         '/\.*' . preg_quote(__PS_BASE_URI__, '/') . '/',
         _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR,
         ImageManager::thumbnail($path, $name, 45, 'jpg', false),
         1
);

 

Seems like this section in the function getContent() from the file HTMLTemplateInvoice.php constructs the image src path.

For some reason: _PS_ROOT_DIR_ constant points to /usr/home/<<websitename>>/web.

If I remove that constant then the image src point to the relative path: /img/tmp/... wich it works...

Any hint?

BR,

  Ibon

 

Link to comment
Share on other sites

  • 1 month later...

there is a pull request on github that fixes the issue. it will be added in PS1.7.6

https://github.com/PrestaShop/PrestaShop/commit/93db0c4a6afaaf138f417005ce93fb38d66659bf#diff-bba6e05abcc820c681135b7554fbafba

Link to comment
Share on other sites

  • 1 month later...
  • 8 months later...
  • 1 year later...
  • 4 months later...

Change this line in "/classes\pdf\HTMLTemplate.php" (it's line 157 in my file)

 

from:

'logo_path' => Tools::getShopProtocol() . Tools::getMediaServer(_PS_IMG_) . _PS_IMG_ . $logo,

to:

'logo_path' => _PS_IMG_ . $logo,

 

This should do the trick

 

 

  • Like 1
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...