// $invoice_id = tep_db_prepare_input($_GET['id']); // $invoice = $class_mi->retrieveDetail($invoice_id); // $orders_array = array($invoice['orders_id']); // $orders = tep_db_prepare_input($_GET['id']); $orders_array = explode(',', $orders); } else { exit; } $order_counter = 0; foreach ($orders_array as $order_id) { $pdf->AddPage(); $order = $class_o->retrieveDetail($order_id, true); $items = $class_o->retrieveProducts($order_id, true); foreach ($items as $key => $item) { if ($class_o->productStatusIsCancelled($item['status'])) { unset($items[$key]); } } $print_delivery_note = false; $class_pi = new payone_invoice(); // echo "<pre>";var_dump($items);die(); if (strtoupper($order['payment_method']) == strtoupper(PAYMENT_METHOD_BANK_TRANSFER)) { //Vorkasse $class_pi->createFromOrderJNG($order, $items, '+1 month'); } elseif (strtoupper($order['payment_method']) == strtoupper(PAYMENT_METHOD_DIRECT_DEBIT)) { //Bankeinzug $class_pi->createFromOrderJNG($order, $items, '+0 days'); } elseif (strtoupper($order['payment_method']) == strtoupper(PAYMENT_METHOD_INVOICE)) { //Rechnung $class_pi->createFromOrderJNG($order, $items);
if (!$class_jo->statusIsCancelled($item['status']) && in_array($item['jng_sp_orders_items_id'], $items_array)) { $ptext = intval($item['order_quantity']) . ' x ' . $item['article_number']; //Go to col 2 when total items > pmax //if(count($pcol1)<$pmax) $pcol1[] = $ptext; //else $pcol2[] = $ptext; //Go to col 2 on even counter $item_counter++; if ($item_counter % 2 != 0) { $pcol1[] = $ptext; } else { $pcol2[] = $ptext; } } } else { //PROCESS ITEMS JNG if (!$class_o->productStatusIsCancelled($item['status']) && in_array($item['orders_products_id'], $items_array)) { $ptext = intval($item['products_quantity']) . ' x ' . $item['products_model']; //Go to col 2 when total items > pmax //if(count($pcol1)<$pmax) $pcol1[] = $ptext; //else $pcol2[] = $ptext; //Go to col 2 on even counter $item_counter++; if ($item_counter % 2 != 0) { $pcol1[] = $ptext; } else { $pcol2[] = $ptext; } } } } }
$result .= printPackageTip(EAN_MISMATCH_ERROR, $item['products_ean'], $ean_scan); } else { if ($item['status'] < intval($old_status)) { //If product status is not yet finish $errinfo = $template_error_not_finish; $result .= printPackageTip('E', $box_date, $errinfo, $sp_name, $sp_class); } elseif ($item['status'] == $old_status) { //If product status is finish $order = $class_o->retrieveDetail($item['orders_id']); $order_date = strtotime($order['date_purchased']); $box_date = date('d. M', $order_date); //Retrieve all products from the order $items = $class_o->retrieveProducts($order['orders_id']); foreach ($items as $key => $i) { //Exclude any canceled and complete products $iscanceled = $class_o->productStatusIsCancelled($i['status']); $iscomplete = $i['status'] == '9' || $i['status'] == '11'; if ($iscanceled || $iscomplete) { unset($items[$key]); } else { $items[$key]['products_ean'] = $class_ean->getEAN($i['products_id'], $i['products_articles_id']); } } if ($item['order_item_total'] == '1' || count($items) == 1) { //If order only consist of 1 product $packages = $class_mp->getUsablePackages(); if (count($packages) == 0) { //If no usable package found for JNG, create 1 $package_id = $class_mp->createNew(); } else { //If usable package found fo JNG, use it