Jump to content

Inverser adresse facturation avec livraison


Recommended Posts

Bonjour,

J'envoi mes factures dans des enveloppes à fenêtres, j'aimerai que sur la facture PDF l'adresse de facturation soit à gauche et l'adresse de livraison à droite de la facture.
J'ai fouiller un peu dans classes/PDF.php mais trop compliqué pour moi. Et je ne trouve pas de solution ni sur google ni sur le forum.
Si vous avez la solution j'suis preneur.

Merci pour vos futures réponses.

Thomas

Link to comment
Share on other sites

  • 1 month later...

yop, c'est super simple. il suffit d'inverser l'ordre des lignes dans /* Display address information */ . Ca donne ca:

       /* Display address information */

       $invoice_address = new Address(intval($order->id_address_invoice));
       $invoiceState = $invoice_address->id_state ? new State($invoice_address->id_state) : false;
       $delivery_address = new Address(intval($order->id_address_delivery));
       $deliveryState = $delivery_address->id_state ? new State($delivery_address->id_state) : false;
       $shop_country = Configuration::get('PS_SHOP_COUNTRY');
       $invoice_customer = new Customer(intval($invoice_address->id_customer));

       $width = 100;

       $pdf->SetX(10);
       $pdf->SetY(25);
       $pdf->SetFont(self::fontname(), '', 12);
       $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->_blank_, 0, 'L');
       $pdf->Cell($width, 10, $delivery_address->phone, 0, 'L');
       if($invoice_customer->dni != NULL)
       $pdf->Cell($width, 10, self::l('Tax ID number:').' '.Tools::iconv('utf-8', self::encoding(), $invoice_customer->dni), 0, 'L');
       if (!empty($delivery_address->phone_mobile))
       {
           $pdf->Ln(5);
           $pdf->Cell($width, 10, $delivery_address->_blank_, 0, 'L');
           $pdf->Cell($width, 10, $delivery_address->phone_mobile, 0, 'L');
       }


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