dulantziko Posted May 11, 2014 Share Posted May 11, 2014 (edited) Hola, He conseguido añadir las imágenes de los productos en la factura pero la calidad es muy mala. ¿Alguien sabe decirme como solucionarlo? Modificar el archivo pdf/invoice.tpl PRODUCTS TAB Suprimir el siguiente código: <td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 10px; font-weight: bold; width: {if !$tax_excluded_display}35%{else}45% {/if}">{l s='Product / Reference' pdf='true'}</td> Por el de a continuación: <td style="background-color: #4D4D4D; color: #FFF; text-align: right; 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: {if !$tax_excluded_display}25%{else}35% {/if}">{l s='Product / Reference' pdf='true'}</td> PRODUCTS Suprimir el siguiente código: <td style="text-align: left; width: {if !$tax_excluded_display}35%{else}45%{/if}" >{$order_detail.product_name}</td> Por el de a continuación: <td style="text-align: left; width:10%"><img src="{$order_detail.pro_img}" /></td> <td style="text-align: left; width: {if !$tax_excluded_display}25%{else}35%{/if}" >{$order_detail.product_name}</td> Modificar el archivo \classes\pdf\HTMLTemplateInvoice.php Suprimir el siguiente código: /** * Returns the template's HTML content * @return string HTML content */ public function getContent() { $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 )); return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code)); } Por el de a continuación: /** * 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)); } Espero alguien pueda ayudarme. Adjunto pantallazo de prueba. Gracias. Edited May 11, 2014 by dulantziko (see edit history) Link to comment Share on other sites More sharing options...
w3bsolutions Posted May 11, 2014 Share Posted May 11, 2014 Has probado a utilizar un tamaño más grande que el "mini"? Qué dimensiones tiene en el panel de control? Link to comment Share on other sites More sharing options...
dulantziko Posted May 12, 2014 Author Share Posted May 12, 2014 Hola, En el panel tengo 45 x 45 pixels. Pero el problema no es el tamaño sino la calidad. Si amplio tambien lo hace la pixelación. ¿Alguien lo tiene bien o sabe que modificar? Gracias. Link to comment Share on other sites More sharing options...
tuk66 Posted May 13, 2014 Share Posted May 13, 2014 Sólo trate de utilizar imágenes más grandes. Sugiero al menos 200 x 200 px. Just try to use bigger images. I suggest at least 200 x 200 px. Link to comment Share on other sites More sharing options...
dulantziko Posted May 13, 2014 Author Share Posted May 13, 2014 Gracias tuk. Estoy al corriente de uno de tus módulos pero se me va de precio y me voy apañando con mis pequeños cambios en la factura. Saludos. Link to comment Share on other sites More sharing options...
dulantziko Posted May 13, 2014 Author Share Posted May 13, 2014 (edited) <td style="width: 50%"> {if $logo_path} <img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" /> {/if} </td> <td style="width: 50%"> {if $logo_path} <img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" /> {/if} </td> <td style="width: 50%"> {if $logo_path} <img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" /> {/if} </td> Edited January 27, 2015 by dulantziko (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts