jahyax Posted July 10, 2013 Share Posted July 10, 2013 Good day every one I am currently working on prestashop 1.5.x invoice customazation, what I am working is showing the images on pdf invoice. this is what I have moded on the pdf/invoice.tpl <!-- 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> . . . . and on the classes/pdf/HTMTemplateInvoice I have added this mods 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; } $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)); } } The code above seems to work but my problem is the images seems to be pixelated, My question in relation to this is that, how do i show the images a litlte bit high res. and is there a cleaner or better way to code this one. Link to comment Share on other sites More sharing options...
tuk66 Posted July 11, 2013 Share Posted July 11, 2013 Images in _PS_TMP_IMG_DIR_ directory are only small thumbnails. Use function getImageLink() from Link class to obtain the image link instead. Link to comment Share on other sites More sharing options...
cjrent Posted October 18, 2013 Share Posted October 18, 2013 tuk66 where would you make this change? I'd like to use this, but the image is blurry and i'm not familiar with this function. Link to comment Share on other sites More sharing options...
macjone Posted March 21, 2014 Share Posted March 21, 2014 (edited) tuk66 where would you make this change? I'd like to use this, but the image on pdf is blurry and i'm not familiar with this function. what is the resolution of inserted image file? Edited March 21, 2014 by macjone (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted March 21, 2014 Share Posted March 21, 2014 Thumbnails are around 50px. 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