Jump to content

How to Add Image To PDF Invoice Prestashop 1.5


Recommended Posts

Here is the modified code of my /classes/PDF.php : line #776 (Prestashop 1.4)

 

if ($productQuantity)
			{
				$before = $this->GetY();
				$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B');
				$lineSize = $this->GetY() - $before;
				$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
				$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? $product['product_reference'] : ''), 'B');

				 if (!$delivery)
					$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true, false)), 'B', 0, 'R');
				$this->Cell($w[++$i], $lineSize, $productQuantity, 'B', 0, 'C');
				if (!$delivery)
					$this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true, false)), 'B', 0, 'R');

				//Modif : Ajout photo sur pdf
				$cover = Product::getCover((int)($product['product_id']));
				if(is_array($cover)) $product = array_merge($cover, $product);
				$limage = _PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg';
				if (file_exists($limage)){
					$this->Image($limage,110,null,13);
				} else{
					$this->Image(_PS_IMG_DIR_.'/p/noimage.jpg',110,null,13);
				}

				$this->Ln();
			}

 

Can you tell me how to add this coce to Prestashop 1.5.

What is the file for add this code?

 

My header and footer of my invoice pdf not correct, I changed my font to my langguage, but not to show my language (thai) correct (show ????). How to solve this font or problem?

Share this post


Link to post
Share on other sites

  • 7 months later...

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More