Jump to content

Change order the items are displayed on invoice PDF


Recommended Posts

Hi,

Hope someone can help....I've been trying to sort this without success

I'm trying to change the order items are displayed on the PDF invoice

For example at present the invoice displays

Description, Reference, U.Price, Qty and Total

If possible I'd like to move Qty to the first position

So it reads

Qty, Description, Reference, U.Price and Total

I've tried switching various bits of code around in the classes/PDF.php

but I don't really know what I'm doing!

Am I updating the correct file?

Also is it possible to change the styling of any of elements on the PDF invoice - eg. make Qty bold?

Thanks in advance

Brian

Link to comment
Share on other sites

Change lines 568-572 of classes/PDF.php from:

array(self::l('Description'), 'L'),
array(self::l('Reference'), 'L'),
array(self::l('U. price'), 'R'),
array(self::l('Qty'), 'C'),
array(self::l('Total'), 'R')



to:

$this->SetFont(self::fontname(), 'B', 8);
array(self::l('Qty'), 'C'),
$this->SetFont(self::fontname(), '', 8);
array(self::l('Description'), 'L'),
array(self::l('Reference'), 'L'),
array(self::l('U. price'), 'R'),
array(self::l('Total'), 'R')



This will move the Qty and make it bold.

Also change lines 686-696 from:

$before = $this->GetY();
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B');
$lineSize = $this->GetY() - $before;
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? $product['product_reference'] : '--'), 'B');
if (!$delivery)
   $this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true, false)), 'B', 0, 'R');
$this->Cell($w[++$i], $lineSize, $productQuantity, 'B', 0, 'C');
if (!$delivery)
   $this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true, false)), 'B', 0, 'R');
$this->Ln();



to:

$before = $this->GetY();
$this->Cell($w[++$i], $lineSize, $productQuantity, 'B', 0, 'C');
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $product['product_name']), 'B');
$lineSize = $this->GetY() - $before;
$this->SetXY($this->GetX() + $w[0] + ($delivery ? 15 : 0), $this->GetY() - $lineSize);
$this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? $product['product_reference'] : '--'), 'B');
if (!$delivery)
   $this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($unit_price, self::$currency, true, false)), 'B', 0, 'R');
if (!$delivery)
   $this->Cell($w[++$i], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($final_price, self::$currency, true, false)), 'B', 0, 'R');
$this->Ln();



This will move the product quantities too.

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