Jump to content

[Solved] Adding cart id to PDF invoice


Recommended Posts

I'd like to add the cart_id to the invoice, to get a better grip on made payments of our payment provider, who uses the cart id.

I looked into classes/PDF.php and looked at the following code, where it should come i.m.o., but i'm not sure how to add it.

Anyone got a clue here?

/*
                * display order information
                */
               $carrier = new Carrier(self::$order->id_carrier);
               if (empty($carrier->name))
                               $carrier->name = Configuration::get('PS_SHOP_NAME');
               $history = self::$order->getHistory(self::$order->id_lang);
               foreach($history as $h)
                       if ($h['id_order_state'] == _PS_OS_SHIPPING_)
                               $shipping_date = $h['date_add'];
               $pdf->Ln(12);
               $pdf->SetFillColor(240, 240, 240);
               $pdf->SetTextColor(0, 0, 0);
               $pdf->SetFont(self::fontname(), '', 9);
               if (self::$orderSlip)
                       $pdf->Cell(0, 6, self::l('SLIP #').sprintf('d', self::$orderSlip->id).' '.self::l('from') . ' ' .Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
               elseif (self::$delivery)
                       $pdf->Cell(0, 6, self::l('DELIVERY SLIP #').Configuration::get('PS_DELIVERY_PREFIX', intval($cookie->id_lang)).sprintf('d', self::$delivery).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
               else
                       $pdf->Cell(0, 6, self::l('INVOICE #').Configuration::get('PS_INVOICE_PREFIX', intval($cookie->id_lang)).sprintf('d', self::$order->invoice_number).' '.self::l('from') . ' ' .Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
               $pdf->Cell(55, 6, self::l('Order #').sprintf('d', self::$order->id), 'L', 0);
               $pdf->Cell(70, 6, self::l('Carrier:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
               $pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
               $pdf->Ln(5);
               $pdf->Cell(55, 6, (isset($shipping_date) ? self::l('Shipping date:').' '.Tools::displayDate($shipping_date, self::$order->id_lang) : ' '), 'LB', 0);
               $pdf->Cell(70, 6, ($order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name)), 'LRB');
               $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
               $pdf->Ln(15);
               $pdf->ProdTab((self::$delivery ? true : ''));

               /* Exit if delivery */



Thanks in advanced,

Marco

48560_6zumFwsDBC4s3UFSEZje_t

Link to comment
Share on other sites

Thanks, stubled with it for an hour, and did not manage to get it nice in line, as it broke the tabels, so placed it under the invoice address:

/*
                * display order information
                */
               $carrier = new Carrier(self::$order->id_carrier);
               if (empty($carrier->name))
                               $carrier->name = Configuration::get('PS_SHOP_NAME');
               $history = self::$order->getHistory(self::$order->id_lang);
               foreach($history as $h)
                       if ($h['id_order_state'] == _PS_OS_SHIPPING_)
                               $shipping_date = $h['date_add'];
                               $pdf->Cell(70, 6, self::l('Cart-ID: ').sprintf('d', self::$order->id_cart), 0,'L');
               $pdf->Ln(12);



This is working ok, for those who also may need it.
Will digg into it later again, most important is that it works now.

Marco

Link to comment
Share on other sites

  • 11 months later...

around line 630, outcomment order No and replace with cart ID....

 

 

$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);

/* $pdf->Cell(55, 6, self::l('Order #').' '.sprintf('%06d', self::$order->id), 'L', 0); */
$pdf->Cell(55, 6, self::l('Cart-ID: ').' '.sprintf('%06d', self::$order->id_cart), 'L', 0);
$pdf->Cell(70, 6, self::l('Carrier:').($order->gift ? ' '.Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
$pdf->Cell(0, 6, self::l('Payment method:'), 'LR');

Edited by thorsten119 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...