Jump to content

Añadir imagenes de productos en factura P.S. 1.5.6.1


dulantziko

Recommended Posts

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.

 

post-681950-0-96939300-1399820194_thumb.jpg

 

Gracias.

Edited by dulantziko (see edit history)
Link to comment
Share on other sites


<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 by dulantziko (see edit history)
Link to comment
Share on other sites

  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...