Jump to content

Images on PDF Invoice


jahyax

Recommended Posts

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.

 

post-530272-0-77314400-1373484784_thumb.jpg

Link to comment
Share on other sites

  • 3 months later...
  • 5 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...