コード例 #1
0
//$billing = ORM::factory('user_billing_info')->where('user_id', $userid)->find();
$pdf->Cell(80, 8, 'DELIVER TO:', 0, 1);
$pdf->Cell(80, 8, $shipping->firstname . ' ' . $shipping->lastname, 0, 1);
$pdf->Cell(80, 8, $shipping->address1, 0, 1);
if ($shipping->address2) {
    $pdf->Cell(80, 8, $shipping->address2, 0, 1);
}
$pdf->Cell(80, 8, $shipping->city . ' ' . $shipping->state . ' ' . $shipping->zip, 0, 1);
$pdf->Ln(20);
if ($order_id != '' && $order_id != false) {
    $pdf->Cell(60, 8, 'Order: MCH' . $order_id, 0, 0);
} else {
    $pdf->Cell(60, 8, 'Order Number Not Available', 0, 0);
}
$pdf->Cell(60, 8, 'Date of order: ' . format::format_date($order->date_created), 0, 1);
$pdf->Cell(60, 8, 'Requested Delivery Date: ' . format::format_date($order->order_delivery_date), 0, 2);
$pdf->Ln(15);
$order_products = Basket::getBasketContentForOrder($id);
$order_subtotal = 0;
$shipping = $order->shipping_total;
//$tax = $order->tax;
$string = '';
foreach ($order_products as $product) {
    $pr = Product::getProductById($product->product_id);
    $order_subtotal += $product->subtotal;
    $string .= $pr->name . ';' . $product->qty . ';' . $pr->price . ';' . $product->subtotal . "\r\n";
}
$myFile = '/tmp/file.txt';
$fh = fopen($myFile, 'w');
fwrite($fh, $string);
fclose($fh);