Change:
protected function _setOrderArticlesToPdf($oPdf, &$iStartPos, $blShowPrice = true)
{
if (!$this->_oArticles) {
$this->_oArticles = $this->getOrderArticles(true);
}
$oCurr = $this->getCurrency();
$oPdfBlock = new InvoicepdfBlock();
// product list
foreach ($this->_oArticles as $key => $oOrderArt) {
// starting a new page ...
if ($iStartPos > 243) {
$this->pdffooter($oPdf);
$iStartPos = $this->pdfheaderplus($oPdf);
$oPdf->setFont($oPdfBlock->getFont(), '', 10);
} else {
$iStartPos = $iStartPos + 4;
}
// sold amount
$oPdf->text(20 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxamount->value), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value);
// product number
$oPdf->setFont($oPdfBlock->getFont(), '', 8);
$oPdf->text(28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value);
// product title
$oPdf->setFont($oPdfBlock->getFont(), '', 10);
$oPdf->text(45, $iStartPos, substr(strip_tags($this->_replaceExtendedChars($oOrderArt->oxorderarticles__oxtitle->getRawValue(), true)), 0, 58));
if ($blShowPrice) {
$oLang = oxRegistry::getLang();
// product VAT percent
$oPdf->text(140 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxvat->value), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value);
// product price
$dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
$dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;
$sText = $oLang->formatCurrency($dUnitPrice, $this->_oCur) . ' ' . $this->_oCur->name;
$oPdf->text(163 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
// total product price
$sText = $oLang->formatCurrency($dTotalPrice, $this->_oCur) . ' ' . $this->_oCur->name;
$oPdf->text(195 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
}
// additional variant info
if ($oOrderArt->oxorderarticles__oxselvariant->value) {
$iStartPos = $iStartPos + 4;
$oPdf->text(45, $iStartPos, substr($oOrderArt->oxorderarticles__oxselvariant->value, 0, 58));
}
}
}
to
protected function _setOrderArticlesToPdf($oPdf, &$iStartPos, $blShowPrice = true)
{
if (!$this->_oArticles) {
$this->_oArticles = $this->getOrderArticles(true);
}
$oCurr = $this->getCurrency();
$oPdfBlock = new InvoicepdfBlock();
// product list
[B]$cnt = 0;[/B]
foreach ($this->_oArticles as $key => $oOrderArt) {
// starting a new page ...
if ($iStartPos > 243) {
$this->pdffooter($oPdf);
$iStartPos = $this->pdfheaderplus($oPdf);
$oPdf->setFont($oPdfBlock->getFont(), '', 10);
} else {
[B]if($cnt == 0){ $iStartPos = $iStartPos + 4;}
else{$iStartPos = $iStartPos + 8;} // change value[/B]
}
// sold amount
$oPdf->text(20 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxamount->value), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value);
// product number
$oPdf->setFont($oPdfBlock->getFont(), '', 8);
$oPdf->text(28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value);
// product title
$oPdf->setFont($oPdfBlock->getFont(), '', 10);
$oPdf->text(45, $iStartPos, substr(strip_tags($this->_replaceExtendedChars($oOrderArt->oxorderarticles__oxtitle->getRawValue(), true)), 0, 58));
if ($blShowPrice) {
$oLang = oxRegistry::getLang();
// product VAT percent
$oPdf->text(140 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxvat->value), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value);
// product price
$dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
$dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;
$sText = $oLang->formatCurrency($dUnitPrice, $this->_oCur) . ' ' . $this->_oCur->name;
$oPdf->text(163 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
// total product price
$sText = $oLang->formatCurrency($dTotalPrice, $this->_oCur) . ' ' . $this->_oCur->name;
$oPdf->text(195 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
}
// additional variant info
if ($oOrderArt->oxorderarticles__oxselvariant->value) {
$iStartPos = $iStartPos + 4;
$oPdf->text(45, $iStartPos, substr($oOrderArt->oxorderarticles__oxselvariant->value, 0, 58));
}
[B]$cnt++;[/B]
}
}