Jump to content

image and product description in the invoice you do not see together


Recommended Posts

hello, 
 
in the invoice I would like to see the picture of the product and a short description of the product. 
I managed to make this change. 
but does not display them together, if the active modification of the description shows me the description of the product, but if I active also changes to display the images, the descriptions is delete and you only see the images. 
 
I'll explain: 
 
 
to put a short description of the article:

- in the file pdf/invoice.tpl  basta inserire questo {$order_detail.description_short}

- in the file classes/order/OrderInvoice.php:

 
change this:
 
        public function getProductsDetail()
        {
                return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
                SELECT *
                FROM `'._DB_PREFIX_.'order_detail` od
                LEFT JOIN `'._DB_PREFIX_.'product` p
                ON p.id_product = od.product_id
                LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
                WHERE od.`id_order` = '.(int)$this->id_order.'
                AND od.`id_order_invoice` = '.(int)$this->id);
        }
 
on this:
 
        public function getProductsDetail()
        {
                return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
                SELECT *
                FROM `'._DB_PREFIX_.'order_detail` od
                LEFT JOIN `'._DB_PREFIX_.'product` p
                ON p.id_product = od.product_id
                LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
                ON pl.id_product = od.product_id
                LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
                WHERE od.`id_order` = '.(int)$this->id_order.'
                AND od.`id_order_invoice` = '.(int)$this->id);
        }
 
 

- tu put the images

in 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>

in questo file :  \classes\pdf\HTMLTemplateInvoice.php
/**
* 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
));

$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('order_details', $prod_dtl_id);
return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code));
}

/**
* Returns the tax tab content
*/

 

 

if you do a test with the changes only to see the description displays the description, but if you put the change even for images then you can not see the description


help me 

i want see together descriptions and images 

i use ps 1.5.6.1

 

 

post-721668-0-48195500-1403710690_thumb.jpg

post-721668-0-79656300-1403710692_thumb.jpg

post-721668-0-37514600-1403710694_thumb.jpg

post-721668-0-00833500-1403710696_thumb.jpg

Link to comment
Share on other sites

×
×
  • Create New...