Jump to content

immagine e descrizione prodotto nella fattura non si visualizzano insieme


Recommended Posts

ciao ,

nella fattura vorrei che si vedesse l'immagine del prodotto e la descrizione breve del prodotto.
io sono riuscito a fare questa modifica.
ma non le visualizza insieme , cioè se attivo delle righe mi mostra la descrizione , ma se attivo anche le righe per visualizzare le immagini si cancellano le descrizioni e si vedono solo le immagini.

mi spiego meglio: 

per mettere la descrizione breve dell'articolo :

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

- nel file classes/order/OrderInvoice.php:

 
cambiare questo:
 
        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);
        }
 
con questo:
 
        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);
        }
 
 

- per mettere le immagini 

in questo 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
*/

 

 

 

-----  se si fa una prova con le modifiche solo per la descrizione si visualizza la descrizione , se invece si mette la modifica anche per le immagini poi non si vede la descrizione 


non so come fare , secondo me la riga che da problemi è questa :


$this->smarty->assign('order_details', $prod_dtl_id)




uso ps 1.5.6.1 

post-721668-0-45002300-1403709848_thumb.jpg

post-721668-0-36421600-1403709850_thumb.jpg

post-721668-0-34347800-1403709851_thumb.jpg

post-721668-0-70584300-1403709852_thumb.jpg

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

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