function _getPDFInvoice($orderIds = array()){
$app = JFactory::getApplication();
if(!class_exists('HTML2PDF')) include(dirname(__FILE__).DS.'attachinvoice'.DS.'html2pdf.class.php');
$config =& hikashop_config();
$class = hikashop_get('class.order');
$currencyHelper = hikashop_get('class.currency');
$fields = array();
$null = null;
$fieldsClass = hikashop_get('class.field');
$fields['item'] = $fieldsClass->getFields('backend_listing',$null,'item');
if(!empty($order->order_payment_id)){
$pluginsPayment = hikashop_get('type.plugins');
$pluginsPayment->type='payment';
}
if(!empty($order->order_shipping_id)){
$pluginsShipping = hikashop_get('type.plugins');
$pluginsShipping->type='shipping';
}
//This array stores all pdf pages...
$pdfContent = array();
foreach($orderIds as $orderId){
$order = $class->loadFullOrder($orderId,true,false);
$fields['order'] = $fieldsClass->getFields('backend',$order,'order');
ob_start();
if(file_exists(HIKASHOP_MEDIA.'plugins'.DS.'invoice.php')){
$file = HIKASHOP_MEDIA.'plugins'.DS.'invoice.php';
}else{
$file = dirname(__FILE__).DS.'attachinvoice'.DS.'invoice.php';
}
require($file);
$pdfContent[] = ob_get_clean();
}
$content = implode('<div style="page-break-before:always"></div>',$pdfContent);
$content = hikashop_absoluteURL($content);
//$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf = new HTML2PDF('P', 'A4', 'en',true, 'UTF-8');
$font = $this->params->get('font');
if(!empty($font)){
$html2pdf->setDefaultFont($font);
}
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content);
if(count($orderIds) == 1){
if(empty( $order->order_invoice_number)) $order->order_invoice_number = $order->order_number;
$fileName =
JText::_('INVOICE').(string)$order->order_invoice_number;
}
$html2pdf->Output($fileName.'.pdf','D');
if(count($orderIds) == 1) $fileName.= '_'.reset($orderIds);
$html2pdf->Output($fileName.'.pdf','D');
exit;
}
Thanks for your support.