Jump to content

[Solved]Invoice/PDF How to add product weight


Recommended Posts

Hello!

I have question about product weight in invoice. How to add product weight in invoice between "reference" and "U.price"?

And how can I disable invoicing address(in invoice, steps and any other places, because I need only one address where send and choosing invoicing address and shipping address same or different in steps might confuse customer)

Best regards

Link to comment
Share on other sites

Change the following on lines 567-574 of classes/PDF.php from:

$header = array(
   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')
);
$w = array(100, 15, 30, 15, 30);



to:

$header = array(
   array(self::l('Description'), 'L'),
   array(self::l('Reference'), 'L'),
   array(self::l('Weight'), 'L'),
   array(self::l('U. price'), 'R'),
   array(self::l('Qty'), 'C'),
   array(self::l('Total'), 'R')
);
$w = array(85, 15, 15, 30, 15, 30);



and line 671 from:

$this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');



to:

$this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');
$this->Cell($w[++$i], $lineSize, $product['product_weight'] . ' ' . Configuration::get('PS_WEIGHT_UNIT'), 'B');

Link to comment
Share on other sites

My changes in pdf.php (lines can be different)

line 318

       $header = array(
           array(self::l('Description'), 'L'),
           array(self::l('Reference'), 'L'),
           array(self::l('Weight'), 'L'),
           array(self::l('Qty'), 'C')
       );
       $w = array(90, 25, 20, 20);



line 339 to 341

           $this->Cell($w[1], $lineSize, ($product['product_reference'] != '' ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '---'), 'B');
           $this->Cell($w[2], $lineSize, $product['product_weight'], 'B');
           $this->Cell($w[3], $lineSize, $product['product_quantity'], 'B', 0, 'C');



line 544

          $header = array(
               array(self::l('Description'), 'L'),
               array(self::l('Reference'), 'L'),
               array(self::l('Weight'), 'L'),
               array(self::l('U. price'), 'R'),
               array(self::l('Qty'), 'C'),
               array(self::l('Total'), 'R')
           );
           $w = array(85, 15, 15, 30, 15, 30); 



line 556

            $header = array(
               array(self::l('Description'), 'L'),
               array(self::l('Reference'), 'L'),
               array(self::l('Weight'), 'L'),
               array(self::l('Qty'), 'C'),
           );
           $w = array(100, 30, 20, 10);



line 581

       if (!$delivery)
           $w = array(85, 15, 15, 30, 15, 30);
       else
           $w = array(100, 30, 20, 10);



line 650 to 651

                   $this->Cell($w[++$i], $lineSize, $product['product_reference'], 'B');
                   $this->Cell($w[++$i], $lineSize, $product['product_weight'] . ' ' . Configuration::get('PS_WEIGHT_UNIT'), 'B'); 



line 670 to 671

                   $this->Cell($w[++$i], $lineSize, ($product['product_reference'] ? $product['product_reference'] : '--'), 'B');
                   $this->Cell($w[++$i], $lineSize, ($product['product_weight'] ? $product['product_weight'] : '--'), 'B');



I hope I don't forget something. :)

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