Jump to content

(SOLVED) Delivery slip: change locations addressess


Recommended Posts

Hey all,
I was wondering ( didn't find a solution yet) how to change the location of the addressess on the delivery slip in pdf.
Now the delivery address is on the left and the invoice address in the right.
My envelopes have a window on the right side. So i would like to have the delivery address on the right side also on the pdf.
Is there a way to fix this, and most of all: how?

Thx in advance!

10509_dh09OxkuX0PcXYLldNEN_t

Link to comment
Share on other sites

Just edit classes/PDF.php

Find

$pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');



Then you will see that the address section of the invoice is structured so that there are one or more statements to print a line of the Delivery address Cell(), followed by the same for the Invoice address. Then we go down the page a little Ln(5) and repeat the process for the next line of each address.

Just swapping the two over so that Invoice address comes first should do it

See www.fpdf.org for more information on the syntax

Link to comment
Share on other sites

So it should be solved:
This is what i did:

Find:

        $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
       $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
       $pdf->Ln(5);
       $pdf->SetFont(self::fontname(), '', 9);

       if (!empty($delivery_address->company) OR !empty($invoice_address->company))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->company), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->company), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->lastname), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->lastname), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address1), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address1), 0, 'L');
       $pdf->Ln(5);
       if (!empty($invoice_address->address2) OR !empty($delivery_address->address2))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address2), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address2), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, $delivery_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->city), 0, 'L');
       $pdf->Cell($width, 10, $invoice_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->city), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->country.($deliveryState ? ' - '.$deliveryState->name : '')), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->country.($invoiceState ? ' - '.$invoiceState->name : '')), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, $delivery_address->phone, 0, 'L');
       if (!empty($delivery_address->phone_mobile))
       {
           $pdf->Ln(5);
           $pdf->Cell($width, 10, $delivery_address->phone_mobile, 0, 'L');
       }

       /*
        * display order information
        */



Replace with:

        $pdf->Cell($width, 10, self::l('Invoicing'), 0, 'L');
       $pdf->Cell($width, 10, self::l('Delivery'), 0, 'L');
       $pdf->Ln(5);
       $pdf->SetFont(self::fontname(), '', 9);

       if (!empty($delivery_address->company) OR !empty($invoice_address->company))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->company), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->company), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->lastname), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->firstname).' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->lastname), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address1), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address1), 0, 'L');
       $pdf->Ln(5);
       if (!empty($invoice_address->address2) OR !empty($delivery_address->address2))
       {
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->address2), 0, 'L');
           $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->address2), 0, 'L');
           $pdf->Ln(5);
       }
       $pdf->Cell($width, 10, $invoice_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $invoice_address->city), 0, 'L');
       $pdf->Cell($width, 10, $delivery_address->postcode.' '.Tools::iconv('utf-8', self::encoding(), $delivery_address->city), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $invoice_address->country.($invoiceState ? ' - '.$invoiceState->name : '')), 0, 'L');
       $pdf->Cell($width, 10, Tools::iconv('utf-8', self::encoding(), $delivery_address->country.($deliveryState ? ' - '.$deliveryState->name : '')), 0, 'L');
       $pdf->Ln(5);
       $pdf->Cell($width, 10, $delivery_address->phone, 0, 'L');
       if (!empty($delivery_address->phone_mobile))
       {
           $pdf->Ln(5);
           $pdf->Cell($width, 10, $delivery_address->phone_mobile, 0, 'L');
       }

       /*
        * display order information
        */



thanks, as far as i can see it works great:)

10522_dVcL2cqK6t7urbNAjlkP_t

Link to comment
Share on other sites

×
×
  • Create New...