screentekdesignsltd Posted May 18, 2011 Share Posted May 18, 2011 HiI am trying to retreieve an image from the /img folder related to the product by product_id & id_imageI get this far but the id_image is 0 and should be 215 which is the records id_image number.The code I am using is:-$this->Image(_PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($image['id_image']).'-small.jpg', 15);and I am getting this error:-FPDF error: Missing or incorrect image file: /xxx/xxx/xxx/screentekdesigns.com/img/p/52-0-small.jpgJust need to get the id_image number relating to the product id within the ps_image table.Anyone can help much appreciated.ThanksBETTER SOLUTION AT POST #4 Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 18, 2011 Author Share Posted May 18, 2011 HiHave browsed my img/p/ directory and the makup of the image files are as so:-eg. 52-215-small.jpgThe 52 is the id_product, the 215 is the id_image in ps_image table and selecting the small version of image created there are others for the product like home,large,medium,thickbox and watermarkThanks Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 19, 2011 Author Share Posted May 19, 2011 Hi EveryoneAfter the above was long and tiresome, I found a better way and used the product_mini_??.jpg in the temp img/tmp directoryusing the following code in the PDF file.$this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 25);instant solution. it works better Hope this helps. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 19, 2011 Author Share Posted May 19, 2011 UPDATEAdded a file exist senario incase no file exists as below to be put in PDF.php file in the classes folder under your admin folderif (file_exists(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg'))$this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 25); else $this->Image(_PS_IMG_DIR_.'tmp/noimage.jpg', 25); Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 19, 2011 Author Share Posted May 19, 2011 A Screenshot of the PDF Delivery note, these can be altered around if you are happy with altering the PDF File. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 19, 2011 Author Share Posted May 19, 2011 Thanks for the tipsIn our case, we only use 1 image and thats the product cover image, so it works for us but for ppl who have multiple images and want the cover image then your solutions above could be incorporated into the scripts.Thanks Link to comment Share on other sites More sharing options...
softwarehelper Posted May 24, 2011 Share Posted May 24, 2011 Hello dear, thanks a lot for your real smart work. I understood the logic and I think I can try embedding the code, however I am very sure where I should embed this code.!if (file_exists(PS_IMG_DIR.‘tmp/product_mini_’.(int)($product[‘product_id’]).’.jpg’))$this->Image(PS_IMG_DIR.‘tmp/product_mini_’.(int)($product[‘product_id’]).’.jpg’, 25); else$this->Image(PS_IMG_DIR.‘tmp/noimage.jpg’, 25);I found file called pdf.php just under the admin folder and also AdminPDF.php in Tabs in Admin. Can you please let me know where I should insert this code?Your answer would be so much appreciated. Thanks a lot. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted May 24, 2011 Author Share Posted May 24, 2011 HiGlad you can you use it, works a treat for us.Ok, you need the pdf.php file in the classes folder. Open the file and search for displayPrice($final_pricewe inserted the script just below that statement, we had to rearrange the columns here and there to align the other fieldscolumns we have is product picture, product name, reference, weight and quantity.Screenshot below Link to comment Share on other sites More sharing options...
rom1z Posted June 2, 2011 Share Posted June 2, 2011 hello can you send me a file of your pdf.php? Link to comment Share on other sites More sharing options...
nini1505 Posted June 3, 2011 Share Posted June 3, 2011 Hi,I'm french, I dont' understand all...Can you see us a part of your pdf.php, please ?Thanks a lot Link to comment Share on other sites More sharing options...
charade Posted June 7, 2011 Share Posted June 7, 2011 From this topic, I built a working solution to display the product "cover" image, in place of the product reference that I don't use. (To move the image, just change 110 to another x value)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(); } Hope this will help. Link to comment Share on other sites More sharing options...
nini1505 Posted June 8, 2011 Share Posted June 8, 2011 Merci à toi je vais essayer tout cela !Merci pour ton partage !Bonne journée Link to comment Share on other sites More sharing options...
rom1z Posted June 11, 2011 Share Posted June 11, 2011 De mon coté j'arrive a rien. avez vous réussi? Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted June 11, 2011 Author Share Posted June 11, 2011 I have it working at my site Link to comment Share on other sites More sharing options...
rom1z Posted June 11, 2011 Share Posted June 11, 2011 Can you send me pdf.php file? for sampleThank's Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted June 11, 2011 Author Share Posted June 11, 2011 The File is for version 1.4.2.5 Do you have this installedThanks Link to comment Share on other sites More sharing options...
rom1z Posted June 11, 2011 Share Posted June 11, 2011 Yes y have version 1.4.2.5 Link to comment Share on other sites More sharing options...
choussamaster Posted June 20, 2011 Share Posted June 20, 2011 HelloI need the pdf.php file to for presta 1.4 can you send me it Thanks very much Link to comment Share on other sites More sharing options...
Nérim Posted July 20, 2011 Share Posted July 20, 2011 Hi,How do you get this space?Look at the pics plz.I don't have the same result, all the line is tightened and the image overtakes of the line. EDIT : SOLVED Link to comment Share on other sites More sharing options...
rom1z Posted July 24, 2011 Share Posted July 24, 2011 Can you send me pdf.php file? for sample Thank's Link to comment Share on other sites More sharing options...
troyrob Posted July 27, 2011 Share Posted July 27, 2011 Hi,How do you get this space?Look at the pics plz.I don't have the same result, all the line is tightened and the image overtakes of the line. <br/> <br/>EDIT : SOLVED How did you solve the issue? i have the same issue? Kindest regards Link to comment Share on other sites More sharing options...
dark_effie Posted August 1, 2011 Share Posted August 1, 2011 Change the x and y value of your image. $this->Image($limage,x_value,y_value,13); I hope this will help you. Link to comment Share on other sites More sharing options...
Ulisses Ramos Posted August 28, 2011 Share Posted August 28, 2011 As the new image file system does not produce a image in the img/tmp/ folder as creates a lot of folders to save the image, how would one add a image to a store running 1.4.4 and the new image file system? Link to comment Share on other sites More sharing options...
M3g4S4nt1k4 Posted October 12, 2011 Share Posted October 12, 2011 i need this too, i need to display product images on my invoice, still no solution Link to comment Share on other sites More sharing options...
Ulisses Ramos Posted October 18, 2011 Share Posted October 18, 2011 Hi,How do you get this space?Look at the pics plz.I don't have the same result, all the line is tightened and the image overtakes of the line. EDIT : SOLVED How did you solved it ? Link to comment Share on other sites More sharing options...
tuk66 Posted October 19, 2011 Share Posted October 19, 2011 You need use code something like this (not exactly, just example) $link->getImageLink($product->name, $product->id_image) It meets both old and new image file system. Link to comment Share on other sites More sharing options...
css117 Posted December 8, 2011 Share Posted December 8, 2011 Hi, here is a working solution to wait until 1.5 with pdf template ! with thumbnail at the begining of each line (it keeps reference) place the attached file in this directory : override/classes/PDF.php and it works ! PDF.php Link to comment Share on other sites More sharing options...
Guest Posted December 8, 2011 Share Posted December 8, 2011 Hi Sorry for the hijack - but you folk seem to know all about the PDF file. I am looking for a way to change the font of the reference number to display as a barcode. I have barcode ttf files. Any idea how I can incorporate this? Link to comment Share on other sites More sharing options...
tuk66 Posted December 9, 2011 Share Posted December 9, 2011 Look at www.presta-addons.com - M4 PDF Extensions. This module can display barcode, and can use your own TTF font file. Link to comment Share on other sites More sharing options...
Guest Posted December 9, 2011 Share Posted December 9, 2011 Look at www.presta-addons.com - M4 PDF Extensions. This module can display barcode, and can use your own TTF font file. Thanks, I will take a look Link to comment Share on other sites More sharing options...
nostradamus Posted March 30, 2012 Share Posted March 30, 2012 how can i add a margin so the description doesn't drop behind the image? Link to comment Share on other sites More sharing options...
จอมเทพไซเบอร์ Posted September 15, 2012 Share Posted September 15, 2012 How to Add Image To PDF Invoice Prestashop 1.5 1 Link to comment Share on other sites More sharing options...
De Angel Net Posted October 1, 2012 Share Posted October 1, 2012 UPDATE Added a file exist senario incase no file exists as below to be put in PDF.php file in the classes folder under your admin folder if (file_exists(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg')) $this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 25); else $this->Image(_PS_IMG_DIR_.'tmp/noimage.jpg', 25); Need help with this code. I have already put the code and it is work. But, how to move the image, move the line, etc. If somebody can post the pdf.php i'm so appreciate it. Link to comment Share on other sites More sharing options...
De Angel Net Posted October 5, 2012 Share Posted October 5, 2012 Will anybody post or share pdf.php (invoice with image)? Since I don't understand about php script maybe someone can help me to repair my pdf.php Link to comment Share on other sites More sharing options...
De Angel Net Posted October 6, 2012 Share Posted October 6, 2012 (edited) if ($productQuantity) { //add photo products on pdf invoice -- start $cover = Product::getCover((int)($product['product_id'])); if(is_array($cover)) $product = array_merge($cover, $product); $limage = _PS_IMG_DIR_.‘tmp/product_mini_’.(int)($product[‘product_id’]).’.jpg’; $withcover = file_exists($limage) ; if ($withcover) { $this->SetX($this->GetX()+13); } $before = $this->GetY(); $this->MultiCell($w[++$i]-($withcover?8:0), 13, 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'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'B'); if (!$delivery) $this->Cell($w[++$i], $lineSize,(self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), '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)), 'B', 0, 'R'); //add photo products on pdf invoice -- start if ($withcover){ $this->Image($limage,10,null,13); } else{ $this->Image(_PS_IMG_DIR_.'tmp/noimage.jpg',110,null,13); } //add photo products on pdf invoice -- end I'm using this code but the problem is the picture always said no image. the file name example in img/tmp/product_mini_4176.jpg But why the invoice can't show the product image. Anyone can help? If i force the code with this : if ($withcover){ $this->Image($limage,10,null,13); } else{ $this->Image($limage,10,null,13); } //add photo products on pdf invoice -- end FPDF error: Image file has no extension and no type was specified: /home/delovisn/public_html/po/img/4176’jpg’ Solved : ‘tmp/product_mini_’ different with 'tmp/product_mini_' (the right one) The problem now there are two type temporary file. _0.jpg and .jpg Edited October 6, 2012 by De Angel Net (see edit history) Link to comment Share on other sites More sharing options...
De Angel Net Posted October 6, 2012 Share Posted October 6, 2012 (edited) PROBLEM : Two type temporary files in img/tmp/ product_mini_XXXX.jpg and product_mini_XXXX_0.jpg SOLUTION : Using double if function for the .jpg and _0.jpg. if ($productQuantity) { //add photo products on pdf invoice -- start $cover = Product::getCover((int)($product['product_id'])); if(is_array($cover)) $product = array_merge($cover, $product); $limage = _PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg'; $limage0 = _PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'_0.jpg'; $withcover = file_exists($limage) ; $withcover0 = file_exists($limage0) ; if ($withcover) { $this->SetX($this->GetX()+13); } $before = $this->GetY(); $this->MultiCell($w[++$i]-($withcover?8:0), 13, 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'] ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '--'), 'B'); if (!$delivery) $this->Cell($w[++$i], $lineSize,(self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true)), '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)), 'B', 0, 'R'); //add photo products on pdf invoice -- start if ($withcover){ $this->Image($limage,110,null,13); } if ($withcover0) { $this->Image($limage0,110,null,13); } else{ $this->Image(_PS_IMG_DIR_.'tmp/noimage.jpg',110,null,13); } //add photo products on pdf invoice -- end $this->Ln(1); } } Another problem : Need more help for setting the line so the image not above the line. Edited October 6, 2012 by De Angel Net (see edit history) Link to comment Share on other sites More sharing options...
lanner Posted October 15, 2012 Share Posted October 15, 2012 Hello, i have test this code and it's ok the image is in the middle , but how to put in same time behind the text reference ? Thanks I have try to find how to put in the first place the image but i don't have find Link to comment Share on other sites More sharing options...
sadlyblue Posted February 20, 2013 Share Posted February 20, 2013 Hi, I'm also trying to add the product image to the invoice. But without no success. Can someone be a little more specific on how to do it? Thanks Link to comment Share on other sites More sharing options...
jahyax Posted April 17, 2013 Share Posted April 17, 2013 (edited) Good day I am new to prestashop and using prestashop 1.5.4 I am a little bit lost about the code in adding it to PDF.php if (file_exists(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg')) $this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 25); else $this->Image(_PS_IMG_DIR_.'tmp/noimage.jpg', 25); where do I exactly add this code? and which line? Help is really appreciated. Thank you. Edited April 17, 2013 by jahyax (see edit history) Link to comment Share on other sites More sharing options...
snt Posted July 29, 2013 Share Posted July 29, 2013 I´m interested in a solution for prestashop 1.5.4 too! Please post an example of a invoice.tpl with productpictures, thanks! Link to comment Share on other sites More sharing options...
jahyax Posted July 30, 2013 Share Posted July 30, 2013 I´m interested in a solution for prestashop 1.5.4 too! Please post an example of a invoice.tpl with productpictures, thanks! This might help http://www.prestashop.com/forums/topic/260636-images-on-pdf-invoice/page__p__1298746?do=findComment&comment=1298746 Link to comment Share on other sites More sharing options...
marlyor Posted July 30, 2013 Share Posted July 30, 2013 I´m interested in a solution for prestashop 1.5.4 but,I don't know how to use,can you help me? Link to comment Share on other sites More sharing options...
designerfort Posted August 15, 2013 Share Posted August 15, 2013 i need image to be displayed for prestashop 1.5.4 any valued help is highly appreciated. thanks Link to comment Share on other sites More sharing options...
Abigail111 Posted August 19, 2013 Share Posted August 19, 2013 Use below AddImage method to add image to new PDF document page public override int AddImage(int pageIdx); Link to comment Share on other sites More sharing options...
[email protected] Posted August 19, 2013 Share Posted August 19, 2013 Hello everyone. This is the solution for version 1.5.X. It's very simple. Modify the file : \pdf\invoice.tpl <!-- PRODUCTS TAB --> <table style="width: 100%"> <tr> <td style="width: 85%; text-align: right"> <table style="width: 100%; font-size: 8pt;"> <tr style="line-height:4px;"> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 10px; font-weight: bold; width: 15%">{l s='Image' pdf='true'}</td> . . . <!-- PRODUCTS --> {foreach $order_details as $order_detail} {cycle values='#FFF,#DDD' assign=bgcolor} <tr style="line-height:6px;background-color:{$bgcolor};"> <td style="text-align: left; width: 15%"><img src="{$order_detail.pro_img}"/></td> Next, modify the file: \classes\pdf\HTMLTemplateInvoice.php /** * Returns the template's HTML content * @return string HTML content */ public function getContent() { $prod_dtl_id = $this->order->getProducts(); foreach($prod_dtl_id as &$product) { if ($product['image'] != null) { $name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg'; // generate image cache, only for back office $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg'); if (file_exists(_PS_TMP_IMG_DIR_.$name)) $product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name); else $product['image_size'] = false; } $product['pro_img'] = _PS_TMP_IMG_DIR_.$name; } $country = new Country((int)$this->order->id_address_invoice); $invoice_address = new Address((int)$this->order->id_address_invoice); $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' '); $formatted_delivery_address = ''; if ($this->order->id_address_delivery != $this->order->id_address_invoice) { $delivery_address = new Address((int)$this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' '); } $customer = new Customer((int)$this->order->id_customer); $this->smarty->assign(array( 'order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'cart_rules' => $this->order->getCartRules($this->order_invoice->id), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group), 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer )); $this->smarty->assign('order_details', $prod_dtl_id); return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code)); } /** * Returns the tax tab content */ That's all. works 100%. How to configure User Interface, I think the problems will not make. Link to comment Share on other sites More sharing options...
cjrent Posted October 18, 2013 Share Posted October 18, 2013 [email protected] thank you so much, this works great, however, my only problem is that the image is so pixelated. Is there a way to fix this? Link to comment Share on other sites More sharing options...
OllyL Posted November 5, 2013 Share Posted November 5, 2013 Hi There, For newer version of PrestaShop (time of writing 05 November 2013) you can get away with editing two files: In pdf/invoice.tpl file follow the instructions above. I added: <td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: 10%"> </td> on line 100 to expand the header row. You also need to amend the product detail column (line 101) to width: 35% to allow for the new column. To add the main row amend/add the lines 129 & 130 to the product table amend line 129: <tr{if isset($order_detail.image) && $order_detail.image->id && isset($order_detail.image_size)} height="{$order_detail['image_size'][1] + 7}"{/if} style="line-height:6px;background-color:{$bgcolor};"> add line 130: <td style="text-align: center; width: 10%" align="center">{if isset($order_detail.image) && $order_detail.image->id}<img src="{$order_detail.pro_img}"/>{/if}</td> Then in the file /classes/order/OrderLine.php insert the following at line 229 (inside the if() {} block) $name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg'; $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 100, 'jpg'); if (file_exists(_PS_TMP_IMG_DIR_.$name)) $product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name); else $product['image_size'] = false; $product['pro_img'] = _PS_TMP_IMG_DIR_.$name; Hope this helps Link to comment Share on other sites More sharing options...
OllyL Posted November 5, 2013 Share Posted November 5, 2013 If you want a less pixelated image then you maybe able to get a bigger image by tinkering with these lines: $name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg'; $product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 100, 'jpg'); This is where you are generating the temp thumbnail so you might be able to generate a bigger image. Try looking at the developer documentation or digging around in the ImageManager class. Link to comment Share on other sites More sharing options...
Centaure Posted May 6, 2014 Share Posted May 6, 2014 Hello,I used cescodes and I managed to embed the image in the invoice, thank you!By cons I have not managed to use a better picture ...someone he succeeded?I also tried to do the same thing for the delivery but I did not succeed ...pdf is not calculated ...Thank you in advance for your answerscordiallyJulian Link to comment Share on other sites More sharing options...
creationata Posted January 13, 2016 Share Posted January 13, 2016 Hello, I added this code (prestashop 1.4) $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(_PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg')) $this->Image(_PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg', 110,null,20); else $this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 110,null,20); And it works, but only for products which don't have severals attributes... I just would like the main image cover appear, not specificly another... but no one... Any ideas ? Link to comment Share on other sites More sharing options...
julianbaros Posted July 4, 2018 Share Posted July 4, 2018 Hello, I would like to know if it's possible to add image on the delivery form (HTMLTemplateDeliverySlip.php). I'm on 1.6.0.11 prestashop version. I already add a column for the image, but I don't know how can I recover the picture of the product. This is my function getContent() in HTMLTemplateDeliverySlip.php public function getContent() { $delivery_address = new Address((int)$this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' '); $formatted_invoice_address = ''; if ($this->order->id_address_delivery != $this->order->id_address_invoice) { $invoice_address = new Address((int)$this->order->id_address_invoice); $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, array(), '<br />', ' '); } $carrier = new Carrier($this->order->id_carrier); $carrier->name = ($carrier->name == '0' ? Configuration::get('PS_SHOP_NAME') : $carrier->name); $this->smarty->assign(array( 'order' => $this->order, 'order_details' => $this->order_invoice->getProducts(), 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'order_invoice' => $this->order_invoice, 'carrier' => $carrier )); return $this->smarty->fetch($this->getTemplate('delivery-slip')); } This my product tab in delivery-slip.tpl <tr style="line-height:6px;"> <td style="background-color: #4D4D4D; color: #FFF; text-align: center; font-weight: bold; width: 10%">{l s='IMAGE' pdf='true'}</td> <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 10px; font-weight: bold; width: 55%">{l s='ITEMS TO BE DELIVERED' pdf='true'}</td> <td style="background-color: #4D4D4D; color: #FFF; text-align: left; font-weight: bold; width: 20%">{l s='REFERENCE' pdf='true'}</td> <td style="background-color: #4D4D4D; color: #FFF; text-align: center; font-weight: bold; width: 15%">{l s='QTY' pdf='true'}</td> </tr> {foreach $order_details as $order_detail} {cycle values='#FFF,#DDD' assign=bgcolor} <tr style="line-height:6px;background-color:{$bgcolor};"> <td style="text-align: center; width: 10%">{html_image file='https://www.monsite.fr/191637-thickbox_default/productref-10000419.jpg' height="40px" width="40px"}</td> <td style="text-align: left; width: 55%;">{$order_detail.product_name}</td> <td style="text-align: left; width: 20%;"> {if empty($order_detail.product_reference)} --- {else} {$order_detail.product_reference} {/if} </td> <td style="text-align: center; width: 15%;">{$order_detail.product_quantity}</td> </tr> With this code I can add directly the image I want but I want it automatic. Can you help me please ? 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