Ulisses Ramos Posted September 17, 2011 Share Posted September 17, 2011 I would like to add the product image to my invoices. There is a way to do this with the old image file system, but i don´t know how to do it in the new image file system. Any help ? Thanks Link to comment Share on other sites More sharing options...
Ulisses Ramos Posted September 17, 2011 Author Share Posted September 17, 2011 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 More sharing options...
frenchhome Posted August 12, 2012 Share Posted August 12, 2012 Hello, I searched for an answer to the above question seeking updated code for the new image system, but can't find any. Can anyone help? thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now