Jump to content

Add Product Image in PDF Invoice (1.4.4.1)


Recommended Posts

on this thread http://www.prestashop.com/forums/topic/110162-solved-add-image-to-pdf-invoice/

 

there is this code:

 

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();

}

 

The problem is that the product images are not on p/ directory.

For example product 256 is on p/2/5/6/256.jpg

Produtct 3476 is on p/3/4/7/6/3476.jpg

 

is it possible to change that code above to use these images?

Link to comment
Share on other sites

  • 10 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
×
×
  • Create New...