插入代码在 1.7 中不起作用,而在 1.6 中起作用

Insertion code does not work in 1.7 which was working in 1.6

我有一个 Prestashop 1.6 模块,它在某一点上准备了带有条形码的 PDF。 我升级到 1.7 的同一个模块,但现在生成的 PDF 没有条形码。我没有更改模板和控制器中的任何内容,但没有显示条形码。

我跟着thislink准备了1.6版本的条码

以下是我准备条码的控制器代码。

// Initiat PDF class
$pdf = new PDFGenerator((bool)Configuration::get('PS_PDF_USE_CACHE'));

// Prepare barcode
$barcode_params = $pdf->serializeTCPDFtagParameters(array(
   '123456789',
  'C39',
  '',
  '',
  50,
  20,
  0.2,
  array(
   'position'=>'S',
   'border'=>false,
   'padding'=>0,
   'fgcolor'=>array(0,0,0),
   'bgcolor'=>array(255,255,255),
   'text'=>true,
   'font'=>'Helvetica',
   'fontsize'=>8,
   'stretchtext'=>0),
   'N'));

模板代码如下,

<tr>
 <td>
   <b>Shipper Order Number:</b>

 </td>
 <td >    
   <tcpdf method="write1DBarcode" params="{$barcode_params}"/>                                    
 </td>
</tr>

任何建议将不胜感激..

好的,我自己解决了这个问题。

但不是用这个方法。出于某种原因

<tcpd method="write1DBarcode" ... ' 

好像不行。

所以我所做的是绕过标签的 'HTMLTemplate..' class 创建和智能模板,而是使用正常方法使用本机函数输出 PDF 自定义 HTML 标签TCPD class。

所以这是我用来生成 PDF 标签的代码。

$style = array(
'position' => 'C',
'align' => 'C',
'stretch' => false,
'fitwidth' => true,
'cellfitalign' => '',
'border' => true,
'hpadding' => 'auto',
'vpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);

$html = '<html><head><title></title><style>table { border-collapse: 
collapse;font-family:arial;}td {padding: 10px; vertical-align: center;}';
$html .= '</style></head><body>';

foreach ($orders_array as $order)
{
 $html = $this->prepare_html_label($order); //  this is where my html 
 template is prepared with actual values
 $pdf->setXY(93,472);
 $pdf->Ln(5);
 $pdf->write1DBarcode('*'.$order['awb'].'*', 'C128', '', '', '', 18, 0.4, 
 $style, 'N');
 $pdf->Ln(10);
 $pdf->writeHTML($html, true, false, true, false, '');
}

$pdf->Output('labels.pdf', 'D');
}


Problem solved.! 
Hope this helps some one.