Пример #1
0
 function getOrderData($oID)
 {
     global $xtPrice;
     require_once DIR_FS_INC . 'xtc_get_attributes_model.inc.php';
     $order_query = "SELECT\r\n\t        \tproducts_id,\r\n\t        \torders_products_id,\r\n\t        \tproducts_model,\r\n\t        \tproducts_name,\r\n\t        \tfinal_price,\r\n\t        \tproducts_shipping_time,\r\n\t        \tproducts_quantity\r\n\t        \tFROM " . TABLE_ORDERS_PRODUCTS . "\r\n\t        \tWHERE orders_id='" . (int) $oID . "'";
     $order_data = array();
     $order_query = xtc_db_query($order_query);
     while ($order_data_values = xtc_db_fetch_array($order_query)) {
         $attributes_query = "SELECT\r\n\t\t        \tproducts_options,\r\n\t\t        \tproducts_options_values,\r\n\t\t        \tprice_prefix,\r\n\t\t        \toptions_values_price\r\n\t\t        \tFROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "\r\n\t\t        \tWHERE orders_products_id='" . $order_data_values['orders_products_id'] . "'";
         $attributes_data = '';
         $attributes_model = '';
         $attributes_query = xtc_db_query($attributes_query);
         while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) {
             $attributes_data .= '<br />' . $attributes_data_values['products_options'] . ':' . $attributes_data_values['products_options_values'];
             $attributes_model .= '<br />' . xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options']);
         }
         $order_data[] = array('PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_SHIPPING_TIME' => $order_data_values['products_shipping_time'], 'PRODUCTS_ATTRIBUTES' => $attributes_data, 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($order_data_values['final_price'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($order_data_values['final_price'] / $order_data_values['products_quantity'], true), 'PRODUCTS_QTY' => $order_data_values['products_quantity']);
     }
     return $order_data;
 }
//for ($i=0, $n=sizeof($temp_prods); $i<$n; $i++) {
$n = sizeof($temp_prods);
for ($i = 0; $i < $n; $i++) {
    //EOF - DokuMan - 2011-12-19 - precount for performance
    //	$temp_prods[$i]['details']='&nbsp;&#187;<a style="cursor:pointer" onclick="javascript:window.open(\''.xtc_href_link(FILENAME_PRINT_PRODUCT_INFO, 'products_id='.$temp_prods[$i]['id']).'\', \'popup\', \'toolbar=0, width=640, height=600\')" alt="" /><small>Details</small></a>';
    $temp_prods[$i]['details'] = '&nbsp;&#187;<a href="' . xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($temp_prods[$i]['id'], $temp_prods[$i]['name'])) . '" target="_blank"><small>Details</small></a>';
    $image = xtc_get_products_image($temp_prods[$i]['id']);
    if ($image != '') {
        $temp_prods[$i]['image'] = '<img height="60px" src="' . DIR_WS_THUMBNAIL_IMAGES . $image . '" alt="' . $temp_prods[$i]['name'] . '" title="' . $temp_prods[$i]['name'] . '" />';
    }
    if (isset($temp_prods[$i]['attributes'])) {
        //Dokuman - 2012-05-31 - fix paypal_checkout notices
        $attributes_model = '';
        reset($temp_prods[$i]['attributes']);
        while (list($option, $value) = each($temp_prods[$i]['attributes'])) {
            $attributes_model .= xtc_get_attributes_model($temp_prods[$i]['id'], $value['value'], $value['option']);
        }
        if ($attributes_model) {
            $temp_prods[$i]['model'] .= $attributes_model;
        }
    }
}
$smarty->assign('products_data', $temp_prods);
if (MODULE_ORDER_TOTAL_INSTALLED) {
    $smarty->assign('total_block', $order_total_modules->pp_output());
}
if (isset($checkout_payment_modules->modules) && is_array($checkout_payment_modules->modules)) {
    //Dokuman - 2012-05-31 - fix paypal_checkout notices
    if ($confirmation = $checkout_payment_modules->confirmation()) {
        for ($i = 0, $n = sizeof($confirmation['fields']); $i < $n; $i++) {
            $payment_info[] = array('TITLE' => $confirmation['fields'][$i]['title'], 'FIELD' => stripslashes($confirmation['fields'][$i]['field']));
Пример #3
0
 if (sizeof($order->products[$i]['attributes']) > 0) {
     for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
         echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . ': ';
     }
     echo '</i></small></nobr>';
 }
 echo '            </td>' . "\n" . '            <td class="dataTableContent" valign="top">';
 if ($order->products[$i]['model'] != '') {
     echo $order->products[$i]['model'];
 } else {
     echo '<br />';
 }
 // attribute models
 if (sizeof($order->products[$i]['attributes']) > 0) {
     for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
         $model = xtc_get_attributes_model($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['value'], $order->products[$i]['attributes'][$j]['option']);
         if ($model != '') {
             echo $model . '<br />';
         } else {
             echo '<br />';
         }
     }
 }
 //BOF - DokuMan - 2010-07-13 - Error while editing orders with quantity with zero
 //echo '&nbsp;</td>'."\n".'            <td class="dataTableContent" align="right" valign="top">'.format_price($order->products[$i]['final_price'] / $order->products[$i]['qty'], 1, $order->info['currency'], $order->products[$i]['allow_tax'], $order->products[$i]['tax']).'</td>'."\n";
 echo '&nbsp;</td>' . "\n" . '            <td class="dataTableContent" align="right" valign="top">' . format_price($order->products[$i]['price'], 1, $order->info['currency'], $order->products[$i]['allow_tax'], $order->products[$i]['tax']) . '</td>' . "\n";
 //EOF - DokuMan - 2010-07-13 - Error while editing orders with quantity with zero
 if ($order->products[$i]['allow_tax'] == 1) {
     echo '<td class="dataTableContent" align="right" valign="top">';
     echo xtc_display_tax_value($order->products[$i]['tax']) . '%';
     echo '</td>' . "\n";
 function paypal_get_products($paymentAmount, $order_tax, $order_discount, $order_fee, $order_shipping, $order_gs, $express_call = False)
 {
     // für beide PayPal Versionen
     // Artikel Details mitgeben incl. Attribute
     // Für den Express Call Vermerk für den Versand + Vorläufige Kosten mitgeben
     // Stand: 19.10.2010
     global $xtPrice, $order;
     require_once DIR_FS_INC . 'xtc_get_attributes_model.inc.php';
     $products_sum_amt = 0;
     $tmp_products = '';
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         $products_price = round($order->products[$i]['price'], $xtPrice->get_decimal_places($order->info['currency']));
         $products_sum_amt += $products_price * $order->products[$i]['qty'];
         $attributes_data = '';
         $attributes_model = '';
         if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 $attributes_data .= ' - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
                 $attributes_model .= '-' . xtc_get_attributes_model($order->products[$i]['id'], $order->products[$i]['attributes'][$j]['value'], $order->products[$i]['attributes'][$j]['option']);
             }
         }
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr($order->products[$i]['name'] . $attributes_data, 0, 127))) . '&L_NUMBER' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr($order->products[$i]['model'] . $attributes_model, 0, 127))) . '&L_QTY' . $i . '=' . urlencode($order->products[$i]['qty']) . '&L_AMT' . $i . '=' . urlencode(number_format($products_price, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
     }
     if ($order_discount != 0) {
         // ist ein - Betrag !
         $products_sum_amt += $order_discount;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(SUB_TITLE_OT_DISCOUNT, 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_discount, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     if ($order_gs != 0) {
         // ist ein - Betrag !
         $products_sum_amt += $order_gs;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(PAYPAL_GS, 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_gs, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     if ($order_fee != 0) {
         $products_sum_amt += $order_fee;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", "Handling")) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_fee, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     if ($order_shipping != 0) {
         $products_sum_amt += $order_shipping;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(SHIPPING_COSTS, 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_shipping, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     $products_sum_amt = round($products_sum_amt, $xtPrice->get_decimal_places($order->info['currency']));
     if ($order_tax != 0 && trim($paymentAmount - $products_sum_amt) >= $order_tax) {
         $products_sum_amt += $order_tax;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(PAYPAL_TAX, 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_tax, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     if ($express_call && PAYPAL_EXP_WARN != '') {
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(html_entity_decode(PAYPAL_EXP_WARN), 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=0' . '&L_AMT' . $i . '=0';
         $i++;
     }
     if ($express_call && PAYPAL_EXP_VORL != '' && PAYPAL_EXP_VERS != 0) {
         $products_sum_amt += PAYPAL_EXP_VERS;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", substr(html_entity_decode(PAYPAL_EXP_VORL), 0, 127))) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format(PAYPAL_EXP_VERS, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
         $i++;
     }
     $products_sum_amt = round($products_sum_amt, $xtPrice->get_decimal_places($order->info['currency']));
     if (trim($paymentAmount) != trim($products_sum_amt)) {
         $order_diff = round($paymentAmount - $products_sum_amt, $xtPrice->get_decimal_places($order->info['currency']));
         $products_sum_amt += $order_diff;
         $tmp_products .= '&L_NAME' . $i . '=' . urlencode($this->mn_iconv($_SESSION['language_charset'], "UTF-8", "Differenz")) . '&L_NUMBER' . $i . '=' . '&L_QTY' . $i . '=1' . '&L_AMT' . $i . '=' . urlencode(number_format($order_diff, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
     }
     $tmp_products .= "&ITEMAMT=" . urlencode(number_format($products_sum_amt, $xtPrice->get_decimal_places($order->info['currency']), '.', ','));
     // Artikel Details Ende
     return $tmp_products;
 }
include DIR_WS_CLASSES . 'order.php';
$order = new order($_GET['oID']);
$smarty->assign('address_label_customer', xtc_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'));
$smarty->assign('address_label_shipping', xtc_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'));
$smarty->assign('address_label_payment', xtc_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'));
$smarty->assign('csID', $order->customer['csID']);
// get products data
$order_query = xtc_db_query("SELECT\r\n\r\n        \t\t\t\tproducts_id,\r\n\r\n        \t\t\t\torders_products_id,\r\n\r\n        \t\t\t\tproducts_model,\r\n\r\n        \t\t\t\tproducts_name,\r\n\r\n        \t\t\t\tfinal_price,\r\n\r\n        \t\t\t\tproducts_quantity\r\n\r\n        \t\t\t\tFROM " . TABLE_ORDERS_PRODUCTS . "\r\n\r\n        \t\t\t\tWHERE orders_id='" . (int) $_GET['oID'] . "'");
$order_data = array();
while ($order_data_values = xtc_db_fetch_array($order_query)) {
    $attributes_query = xtc_db_query("SELECT\r\n\r\n        \t\t\t\tproducts_options,\r\n\r\n        \t\t\t\tproducts_options_values,\r\n\r\n        \t\t\t\tprice_prefix,\r\n\r\n        \t\t\t\toptions_values_price\r\n\r\n        \t\t\t\tFROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "\r\n\r\n        \t\t\t\tWHERE orders_products_id='" . $order_data_values['orders_products_id'] . "'");
    $attributes_data = '';
    $attributes_model = '';
    while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) {
        $attributes_data .= '<br />' . $attributes_data_values['products_options'] . ':' . $attributes_data_values['products_options_values'];
        $attributes_model .= '<br />' . xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options']);
    }
    $order_data[] = array('PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_ATTRIBUTES' => $attributes_data, 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, 'PRODUCTS_PRICE' => xtc_format_price_order($order_data_values['final_price'], 1, $order->info['currency']), 'PRODUCTS_QTY' => $order_data_values['products_quantity']);
}
// get order_total data
$oder_total_query = xtc_db_query("SELECT\r\n\r\n                      title,\r\n\r\n                      text,\r\n\r\n                      class,\r\n\r\n                      value,\r\n\r\n                      sort_order\r\n\r\n  \t\t\t\t\tFROM " . TABLE_ORDERS_TOTAL . "\r\n\r\n  \t\t\t\t\tWHERE orders_id='" . $_GET['oID'] . "'\r\n\r\n  \t\t\t\t\tORDER BY sort_order ASC");
$order_total = array();
while ($oder_total_values = xtc_db_fetch_array($oder_total_query)) {
    $order_total[] = array('TITLE' => $oder_total_values['title'], 'CLASS' => $oder_total_values['class'], 'VALUE' => $oder_total_values['value'], 'TEXT' => $oder_total_values['text']);
    if ($oder_total_values['class'] = 'ot_total') {
        $total = $oder_total_values['value'];
    }
}
// assign language to template for caching
$smarty->assign('language', $_SESSION['language']);
$smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
function SendOrders()
{
    global $_GET, $order_total_class;
    $order_from = xtc_db_prepare_input($_GET['order_from']);
    $order_to = xtc_db_prepare_input($_GET['order_to']);
    $order_status = xtc_db_prepare_input($_GET['order_status']);
    if (defined('SET_TIME_LIMIT')) {
        @set_time_limit(0);
    }
    $schema = '<?xml version="1.0" encoding="' . CHARSET . '"?>' . "\n" . '<ORDER>' . "\n";
    echo $schema;
    $sql = "select * from " . TABLE_ORDERS . " where orders_id >= '" . xtc_db_input($order_from) . "'";
    if (!isset($order_status) && !isset($order_from)) {
        $order_status = 1;
        $sql .= "and orders_status = " . $order_status;
    }
    if ($order_status != '') {
        $sql .= " and orders_status = " . $order_status;
    }
    $orders_query = xtc_db_query($sql);
    while ($orders = xtc_db_fetch_array($orders_query)) {
        // Geburtsdatum laden
        $cust_sql = "select * from " . TABLE_CUSTOMERS . " where customers_id=" . $orders['customers_id'];
        $cust_query = xtc_db_query($cust_sql);
        if ($cust_query && ($cust_data = xtc_db_fetch_array($cust_query))) {
            $cust_dob = $cust_data['customers_dob'];
            $cust_gender = $cust_data['customers_gender'];
        } else {
            $cust_dob = '';
            $cust_gender = '';
        }
        if ($orders['billing_company'] == '') {
            $orders['billing_company'] = $orders['delivery_company'];
        }
        if ($orders['billing_name'] == '') {
            $orders['billing_name'] = $orders['delivery_name'];
        }
        if ($orders['billing_lastname'] == '') {
            $orders['billing_lastname'] = $orders['delivery_lastname'];
        }
        if ($orders['billing_firstname'] == '') {
            $orders['billing_firstname'] = $orders['delivery_firstname'];
        }
        if ($orders['billing_street_address'] == '') {
            $orders['billing_street_address'] = $orders['delivery_street_address'];
        }
        if ($orders['billing_postcode'] == '') {
            $orders['billing_postcode'] = $orders['delivery_postcode'];
        }
        if ($orders['billing_city'] == '') {
            $orders['billing_city'] = $orders['delivery_city'];
        }
        if ($orders['billing_suburb'] == '') {
            $orders['billing_suburb'] = $orders['delivery_suburb'];
        }
        if ($orders['billing_state'] == '') {
            $orders['billing_state'] = $orders['delivery_state'];
        }
        if ($orders['billing_country'] == '') {
            $orders['billing_country'] = $orders['delivery_country'];
        }
        if ($orders['billing_country_iso_code_2'] == '') {
            $orders['billing_country_iso_code_2'] = $orders['delivery_country_iso_code_2'];
        }
        $schema = '<ORDER_INFO>' . "\n" . '<ORDER_HEADER>' . "\n" . '<ORDER_ID>' . $orders['orders_id'] . '</ORDER_ID>' . "\n" . '<CUSTOMER_ID>' . $orders['customers_id'] . '</CUSTOMER_ID>' . "\n" . '<CUSTOMER_CID>' . $orders['customers_cid'] . '</CUSTOMER_CID>' . "\n" . '<CUSTOMER_GROUP>' . $orders['customers_status'] . '</CUSTOMER_GROUP>' . "\n" . '<ORDER_DATE>' . $orders['date_purchased'] . '</ORDER_DATE>' . "\n" . '<ORDER_STATUS>' . $orders['orders_status'] . '</ORDER_STATUS>' . "\n" . '<ORDER_IP>' . $orders['customers_ip'] . '</ORDER_IP>' . "\n" . '<ORDER_CURRENCY>' . encode_htmlspecialchars($orders['currency']) . '</ORDER_CURRENCY>' . "\n" . '<ORDER_CURRENCY_VALUE>' . $orders['currency_value'] . '</ORDER_CURRENCY_VALUE>' . "\n" . '</ORDER_HEADER>' . "\n" . '<BILLING_ADDRESS>' . "\n" . '<VAT_ID>' . encode_htmlspecialchars($orders['customers_vat_id']) . '</VAT_ID>' . "\n" . '<COMPANY>' . encode_htmlspecialchars($orders['billing_company']) . '</COMPANY>' . "\n" . '<NAME>' . encode_htmlspecialchars($orders['billing_name']) . '</NAME>' . "\n" . '<FIRSTNAME>' . encode_htmlspecialchars($orders['billing_firstname']) . '</FIRSTNAME>' . "\n" . '<LASTNAME>' . encode_htmlspecialchars($orders['billing_lastname']) . '</LASTNAME>' . "\n" . '<STREET>' . encode_htmlspecialchars($orders['billing_street_address']) . '</STREET>' . "\n" . '<POSTCODE>' . encode_htmlspecialchars($orders['billing_postcode']) . '</POSTCODE>' . "\n" . '<CITY>' . encode_htmlspecialchars($orders['billing_city']) . '</CITY>' . "\n" . '<SUBURB>' . encode_htmlspecialchars($orders['billing_suburb']) . '</SUBURB>' . "\n" . '<STATE>' . encode_htmlspecialchars($orders['billing_state']) . '</STATE>' . "\n" . '<COUNTRY>' . encode_htmlspecialchars($orders['billing_country_iso_code_2']) . '</COUNTRY>' . "\n" . '<TELEPHONE>' . encode_htmlspecialchars($orders['customers_telephone']) . '</TELEPHONE>' . "\n" . '<EMAIL>' . encode_htmlspecialchars($orders['customers_email_address']) . '</EMAIL>' . "\n" . '<BIRTHDAY>' . encode_htmlspecialchars($cust_dob) . '</BIRTHDAY>' . "\n" . '<GENDER>' . encode_htmlspecialchars($cust_gender) . '</GENDER>' . "\n" . '</BILLING_ADDRESS>' . "\n" . '<DELIVERY_ADDRESS>' . "\n" . '<COMPANY>' . encode_htmlspecialchars($orders['delivery_company']) . '</COMPANY>' . "\n" . '<NAME>' . encode_htmlspecialchars($orders['delivery_name']) . '</NAME>' . "\n" . '<FIRSTNAME>' . encode_htmlspecialchars($orders['delivery_firstname']) . '</FIRSTNAME>' . "\n" . '<LASTNAME>' . encode_htmlspecialchars($orders['delivery_lastname']) . '</LASTNAME>' . "\n" . '<STREET>' . encode_htmlspecialchars($orders['delivery_street_address']) . '</STREET>' . "\n" . '<POSTCODE>' . encode_htmlspecialchars($orders['delivery_postcode']) . '</POSTCODE>' . "\n" . '<CITY>' . encode_htmlspecialchars($orders['delivery_city']) . '</CITY>' . "\n" . '<SUBURB>' . encode_htmlspecialchars($orders['delivery_suburb']) . '</SUBURB>' . "\n" . '<STATE>' . encode_htmlspecialchars($orders['delivery_state']) . '</STATE>' . "\n" . '<COUNTRY>' . encode_htmlspecialchars($orders['delivery_country_iso_code_2']) . '</COUNTRY>' . "\n" . '</DELIVERY_ADDRESS>' . "\n" . '<PAYMENT>' . "\n" . '<PAYMENT_METHOD>' . encode_htmlspecialchars($orders['payment_method']) . '</PAYMENT_METHOD>' . "\n" . '<PAYMENT_CLASS>' . encode_htmlspecialchars($orders['payment_class']) . '</PAYMENT_CLASS>' . "\n";
        switch ($orders['payment_class']) {
            case 'banktransfer':
                // Bankverbindung laden, wenn aktiv
                $bank_name = '';
                $bank_blz = '';
                $bank_kto = '';
                $bank_inh = '';
                $bank_stat = -1;
                $bank_sql = "select * from banktransfer where orders_id = " . $orders['orders_id'];
                $bank_query = xtc_db_query($bank_sql);
                if ($bank_query && ($bankdata = xtc_db_fetch_array($bank_query))) {
                    $bank_name = $bankdata['banktransfer_bankname'];
                    $bank_blz = $bankdata['banktransfer_blz'];
                    $bank_kto = $bankdata['banktransfer_number'];
                    $bank_inh = $bankdata['banktransfer_owner'];
                    $bank_stat = $bankdata['banktransfer_status'];
                }
                $schema .= '<PAYMENT_BANKTRANS_BNAME>' . encode_htmlspecialchars($bank_name) . '</PAYMENT_BANKTRANS_BNAME>' . "\n" . '<PAYMENT_BANKTRANS_BLZ>' . encode_htmlspecialchars($bank_blz) . '</PAYMENT_BANKTRANS_BLZ>' . "\n" . '<PAYMENT_BANKTRANS_NUMBER>' . encode_htmlspecialchars($bank_kto) . '</PAYMENT_BANKTRANS_NUMBER>' . "\n" . '<PAYMENT_BANKTRANS_OWNER>' . encode_htmlspecialchars($bank_inh) . '</PAYMENT_BANKTRANS_OWNER>' . "\n" . '<PAYMENT_BANKTRANS_STATUS>' . encode_htmlspecialchars($bank_stat) . '</PAYMENT_BANKTRANS_STATUS>' . "\n";
                break;
        }
        $schema .= '</PAYMENT>' . "\n" . '<SHIPPING>' . "\n" . '<SHIPPING_METHOD>' . encode_htmlspecialchars($orders['shipping_method']) . '</SHIPPING_METHOD>' . "\n" . '<SHIPPING_CLASS>' . encode_htmlspecialchars($orders['shipping_class']) . '</SHIPPING_CLASS>' . "\n" . '</SHIPPING>' . "\n" . '<ORDER_PRODUCTS>' . "\n";
        $sql = "select\n             orders_products_id,\n             allow_tax,\n             products_id,\n             products_model,\n             products_name,\n             final_price,\n             products_tax,\n             products_quantity\n            from " . TABLE_ORDERS_PRODUCTS . "\n            where\n             orders_id = '" . $orders['orders_id'] . "'";
        $products_query = xtc_db_query($sql);
        while ($products = xtc_db_fetch_array($products_query)) {
            if ($products['allow_tax'] == 1) {
                $products['final_price'] = $products['final_price'] / (1 + $products['products_tax'] * 0.01);
            }
            $schema .= '<PRODUCT>' . "\n" . '<PRODUCTS_ID>' . $products['products_id'] . '</PRODUCTS_ID>' . "\n" . '<PRODUCTS_QUANTITY>' . $products['products_quantity'] . '</PRODUCTS_QUANTITY>' . "\n" . '<PRODUCTS_MODEL>' . encode_htmlspecialchars($products['products_model']) . '</PRODUCTS_MODEL>' . "\n" . '<PRODUCTS_NAME>' . encode_htmlspecialchars($products['products_name']) . '</PRODUCTS_NAME>' . "\n" . '<PRODUCTS_PRICE>' . $products['final_price'] / $products['products_quantity'] . '</PRODUCTS_PRICE>' . "\n" . '<PRODUCTS_TAX>' . $products['products_tax'] . '</PRODUCTS_TAX>' . "\n" . '<PRODUCTS_TAX_FLAG>' . $products['allow_tax'] . '</PRODUCTS_TAX_FLAG>' . "\n";
            $attributes_query = xtc_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . $orders['orders_id'] . "' and orders_products_id = '" . $products['orders_products_id'] . "'");
            if (xtc_db_num_rows($attributes_query)) {
                while ($attributes = xtc_db_fetch_array($attributes_query)) {
                    require_once DIR_FS_INC . 'xtc_get_attributes_model.inc.php';
                    $attributes_model = xtc_get_attributes_model($products['products_id'], $attributes['products_options_values']);
                    $schema .= '<OPTION>' . "\n" . '<PRODUCTS_OPTIONS>' . encode_htmlspecialchars($attributes['products_options']) . '</PRODUCTS_OPTIONS>' . "\n" . '<PRODUCTS_OPTIONS_VALUES>' . encode_htmlspecialchars($attributes['products_options_values']) . '</PRODUCTS_OPTIONS_VALUES>' . "\n" . '<PRODUCTS_OPTIONS_MODEL>' . $attributes_model . '</PRODUCTS_OPTIONS_MODEL>' . "\n" . '<PRODUCTS_OPTIONS_PRICE>' . $attributes['price_prefix'] . ' ' . $attributes['options_values_price'] . '</PRODUCTS_OPTIONS_PRICE>' . "\n" . '</OPTION>' . "\n";
                }
            }
            $schema .= '</PRODUCT>' . "\n";
        }
        $schema .= '</ORDER_PRODUCTS>' . "\n";
        $schema .= '<ORDER_TOTAL>' . "\n";
        $totals_query = xtc_db_query("select title, value, class, sort_order from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . $orders['orders_id'] . "' order by sort_order");
        while ($totals = xtc_db_fetch_array($totals_query)) {
            $total_prefix = "";
            $total_tax = "";
            $total_prefix = $order_total_class[$totals['class']]['prefix'];
            $total_tax = $order_total_class[$totals['class']]['tax'];
            $schema .= '<TOTAL>' . "\n" . '<TOTAL_TITLE>' . encode_htmlspecialchars($totals['title']) . '</TOTAL_TITLE>' . "\n" . '<TOTAL_VALUE>' . encode_htmlspecialchars($totals['value']) . '</TOTAL_VALUE>' . "\n" . '<TOTAL_CLASS>' . encode_htmlspecialchars($totals['class']) . '</TOTAL_CLASS>' . "\n" . '<TOTAL_SORT_ORDER>' . encode_htmlspecialchars($totals['sort_order']) . '</TOTAL_SORT_ORDER>' . "\n" . '<TOTAL_PREFIX>' . encode_htmlspecialchars($total_prefix) . '</TOTAL_PREFIX>' . "\n" . '<TOTAL_TAX>' . encode_htmlspecialchars($total_tax) . '</TOTAL_TAX>' . "\n" . '</TOTAL>' . "\n";
        }
        $schema .= '</ORDER_TOTAL>' . "\n";
        /*
        $sql = "select
                 comments
                from " .
                 TABLE_ORDERS_STATUS_HISTORY . "
                where
                 orders_id = '" . $orders['orders_id'] . "' and
                 orders_status_id = '" . $orders['orders_status'] . "' ";
        
        $comments_query = xtc_db_query($sql);
        if ($comments =  xtc_db_fetch_array($comments_query))
        {
          $schema .=  '<ORDER_COMMENTS>' . encode_htmlspecialchars($comments['comments']) . '</ORDER_COMMENTS>' . "\n";
        }
        */
        //Es werden jetzt alle Kommentare mit übertragen, nicht nur der letzte
        //JP 2008-12-15
        $comments_query = "SELECT comments FROM " . TABLE_ORDERS_STATUS_HISTORY . " WHERE orders_id = '" . $orders['orders_id'] . "'";
        $comments_result = xtc_db_query($comments_query);
        $schema .= '<ORDER_COMMENTS>';
        $oc = '';
        while ($comments = xtc_db_fetch_array($comments_result)) {
            if (strlen($oc) > 0) {
                $oc .= "\r\n";
            }
            $oc .= encode_htmlspecialchars($comments['comments']);
        }
        $schema .= $oc . '</ORDER_COMMENTS>' . "\n";
        $schema .= '</ORDER_INFO>' . "\n\n";
        echo $schema;
    }
    $schema = '</ORDER>' . "\n\n";
    echo $schema;
}
 function get_html($p_products_array)
 {
     $coo_properties_control = MainFactory::create_object('PropertiesControl');
     $coo_properties_view = MainFactory::create_object('PropertiesView');
     $t_content_array = array();
     $module_content = array();
     $any_out_of_stock = '';
     $mark_stock = '';
     $coo_seo_boost = MainFactory::create_object('GMSEOBoost');
     $coo_main = new main();
     $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);
     for ($i = 0, $n = sizeof($p_products_array); $i < $n; $i++) {
         $t_combis_id = $coo_properties_control->extract_combis_id($p_products_array[$i]['id']);
         // check if combis_id is empty
         if ($t_combis_id == '') {
             // combis_id is empty = article without properties
             if (STOCK_CHECK == 'true') {
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             }
         }
         $image = '';
         if ($p_products_array[$i]['image'] != '') {
             $image = DIR_WS_THUMBNAIL_IMAGES . $p_products_array[$i]['image'];
         }
         //bof gm
         $gm_products_id = $p_products_array[$i]['id'];
         $gm_products_id = str_replace('{', '_', $gm_products_id);
         $gm_products_id = str_replace('}', '_', $gm_products_id);
         $gm_query = xtc_db_query("SELECT gm_show_weight FROM products WHERE products_id='" . $p_products_array[$i]['id'] . "'");
         $gm_array = xtc_db_fetch_array($gm_query);
         if (empty($gm_array['gm_show_weight'])) {
             $p_products_array[$i]['gm_weight'] = 0;
         }
         $gm_product_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_products_array[$i]['id'], $p_products_array[$i]['name']) . '&no_boost=1');
         include DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart.php';
         $t_shipping_time = $p_products_array[$i]['shipping_time'];
         $t_products_weight = $p_products_array[$i]['gm_weight'];
         $t_products_model = $p_products_array[$i]['model'];
         #properties
         if ($t_combis_id != '') {
             $t_properties_html = $coo_properties_view->get_order_details_by_combis_id($t_combis_id, 'cart');
             $coo_products = MainFactory::create_object('GMDataObject', array('products', array('products_id' => $p_products_array[$i]['id'])));
             $use_properties_combis_quantity = $coo_products->get_data_value('use_properties_combis_quantity');
             if ($use_properties_combis_quantity == 1) {
                 // check article quantity
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             } else {
                 if ($use_properties_combis_quantity == 0 && ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' || $use_properties_combis_quantity == 2) {
                     // check combis quantity
                     $t_properties_stock = $coo_properties_control->get_properties_combis_quantity($t_combis_id);
                     if ($t_properties_stock < $p_products_array[$i]['quantity']) {
                         $_SESSION['any_out_of_stock'] = 1;
                         $mark_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
                     }
                 }
             }
             $t_weight = $coo_properties_control->get_properties_combis_weight($t_combis_id);
             if ($coo_products->get_data_value('use_properties_combis_weight') == 1) {
                 $t_products_weight = gm_prepare_number($t_weight, $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             } else {
                 $t_products_weight = gm_prepare_number($t_weight + $p_products_array[$i]['weight'], $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             }
             if ($coo_products->get_data_value('use_properties_combis_shipping_time') == 1) {
                 $t_shipping_time = $coo_properties_control->get_properties_combis_shipping_time($t_combis_id);
             }
             $t_combi_model = $coo_properties_control->get_properties_combis_model($t_combis_id);
             if (APPEND_PROPERTIES_MODEL == "true") {
                 // Artikelnummer (Kombi) an Artikelnummer (Artikel) anhängen
                 if ($t_products_model != '' && $t_combi_model != '') {
                     $t_products_model = $t_products_model . '-' . $t_combi_model;
                 } else {
                     if ($t_combi_model != '') {
                         $t_products_model = $t_combi_model;
                     }
                 }
             } else {
                 // Artikelnummer (Artikel) durch Artikelnummer (Kombi) ersetzen
                 if ($t_combi_model != '') {
                     $t_products_model = $t_combi_model;
                 }
             }
         } else {
             $t_properties_html = '';
         }
         $module_content[$i] = array('PRODUCTS_NAME' => $p_products_array[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', gm_convert_qty($p_products_array[$i]['quantity'], false), ' size="2" onblur="gm_qty_is_changed(' . $p_products_array[$i]['quantity'] . ', this.value, \'' . GM_QTY_CHANGED_MESSAGE . '\')"', 'text', true, "gm_cart_data gm_class_input") . xtc_draw_hidden_field('products_id[]', $p_products_array[$i]['id'], 'class="gm_cart_data"') . xtc_draw_hidden_field('old_qty[]', $p_products_array[$i]['quantity']), 'PRODUCTS_OLDQTY_INPUT_NAME' => 'old_qty[]', 'PRODUCTS_QTY_INPUT_NAME' => 'cart_quantity[]', 'PRODUCTS_QTY_VALUE' => gm_convert_qty($p_products_array[$i]['quantity'], false), 'PRODUCTS_ID_INPUT_NAME' => 'products_id[]', 'PRODUCTS_ID_EXTENDED' => $p_products_array[$i]['id'], 'PRODUCTS_MODEL' => $t_products_model, 'SHOW_PRODUCTS_MODEL' => SHOW_PRODUCTS_MODEL, 'PRODUCTS_SHIPPING_TIME' => $t_shipping_time, 'PRODUCTS_TAX' => (double) $p_products_array[$i]['tax'], 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $p_products_array[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $p_products_array[$i]['id'], false, 'id="gm_delete_product_' . $gm_products_id . '"'), 'PRODUCTS_LINK' => $gm_product_link, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'] * $p_products_array[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($p_products_array[$i]['id']), 'ATTRIBUTES' => '', 'PROPERTIES' => $t_properties_html, 'GM_WEIGHT' => $t_products_weight, 'PRODUCTS_ID' => $gm_products_id, 'UNIT' => $p_products_array[$i]['unit_name']);
         //eof gm
         // Product options names
         $attributes_exist = isset($p_products_array[$i]['attributes']) ? 1 : 0;
         if ($attributes_exist == 1) {
             reset($p_products_array[$i]['attributes']);
             while (list($option, $value) = each($p_products_array[$i]['attributes'])) {
                 if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' && $value != 0) {
                     $attribute_stock_check = xtc_check_stock_attributes($p_products_array[$i][$option]['products_attributes_id'], $p_products_array[$i]['quantity']);
                     if ($attribute_stock_check) {
                         $_SESSION['any_out_of_stock'] = 1;
                     }
                 }
                 $module_content[$i]['ATTRIBUTES'][] = array('ID' => $p_products_array[$i][$option]['products_attributes_id'], 'MODEL' => xtc_get_attributes_model(xtc_get_prid($p_products_array[$i]['id']), $p_products_array[$i][$option]['products_options_values_name'], $p_products_array[$i][$option]['products_options_name']), 'NAME' => $p_products_array[$i][$option]['products_options_name'], 'VALUE_NAME' => $p_products_array[$i][$option]['products_options_values_name'] . $attribute_stock_check);
                 // BOF GM_MOD GX-Customizer:
                 require DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart_2.php';
             }
         }
     }
     $total_content = '';
     $total = $_SESSION['cart']->show_total();
     if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $price = $total - $_SESSION['cart']->show_tax(false);
         } else {
             $price = $total;
         }
         // BOF GM_MOD
         $discount = round($xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']), 2);
         $total_content = $_SESSION['customers_status']['customers_status_ot_discount'] . ' % ' . SUB_TITLE_OT_DISCOUNT . ' -' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false) . '<br />';
         $this->set_content_data('DISCOUNT_TEXT', round((double) $_SESSION['customers_status']['customers_status_ot_discount'], 2) . '% ' . SUB_TITLE_OT_DISCOUNT);
         $this->set_content_data('DISCOUNT_VALUE', '-' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false));
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $total -= $discount;
         }
         $total_content .= SUB_TITLE_SUB_TOTAL . $xtPrice->xtcFormat($total, true) . '<br />';
         $t_total = $xtPrice->xtcFormat($total + $discount, true);
     } else {
         $total_content .= NOT_ALLOWED_TO_SEE_PRICES . '<br />';
     }
     // display only if there is an ot_discount
     if ($customer_status_value['customers_status_ot_discount'] != 0) {
         $total_content .= TEXT_CART_OT_DISCOUNT . $customer_status_value['customers_status_ot_discount'] . '%';
     }
     if (SHOW_SHIPPING == 'true') {
         $this->set_content_data('SHIPPING_INFO', ' ' . SHIPPING_EXCL . '<a href="' . $coo_main->gm_get_shipping_link(true) . '" target="_blank" class="lightbox_iframe"> ' . SHIPPING_COSTS . '</a>');
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         $gm_cart_tax_info = '';
         if (gm_get_conf('TAX_INFO_TAX_FREE') == 'true') {
             $gm_cart_tax_info = GM_TAX_FREE . '<br />';
             $this->set_content_data('TAX_FREE_TEXT', GM_TAX_FREE);
         } else {
             $gm_cart_tax_info = $_SESSION['cart']->show_tax();
             if (!empty($gm_cart_tax_info) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0' && $_SESSION['customers_status']['customers_status_add_tax_ot'] == '1') {
                 if (!defined(MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX)) {
                     include_once DIR_FS_CATALOG . 'lang/' . $_SESSION['language'] . '/modules/order_total/ot_subtotal.php';
                 }
                 $t_gm_tax = 0;
                 foreach ($_SESSION['cart']->tax as $t_gm_key => $t_gm_value) {
                     $t_gm_tax += $t_gm_value['value'];
                 }
                 $gm_cart_tax_info = MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX . ': ' . $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax, true) . '<br />' . $gm_cart_tax_info;
                 $t_total = $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax + $discount, true);
             }
         }
         $this->set_content_data('UST_CONTENT', $gm_cart_tax_info, 1);
     }
     $t_taxes_data_array = explode('<br />', $_SESSION['cart']->show_tax(true));
     $t_tax_array = array();
     for ($i = 0; $i < count($t_taxes_data_array); $i++) {
         if (!empty($t_taxes_data_array[$i])) {
             $t_tax_data_array = explode(':', $t_taxes_data_array[$i]);
             $t_tax_array[] = array('TEXT' => $t_tax_data_array[0], 'VALUE' => $t_tax_data_array[1]);
         }
     }
     $this->set_content_data('tax_data', $t_tax_array);
     $this->set_content_data('SUBTOTAL', $t_total);
     $this->set_content_data('TOTAL', $xtPrice->xtcFormat($total, true));
     $this->set_content_data('TOTAL_CONTENT', $total_content, 1);
     $this->set_content_data('language', $_SESSION['language']);
     $this->set_content_data('module_content', $module_content);
     $coo_gift_cart = MainFactory::create_object('GiftCartContentView');
     $t_view_html = $coo_gift_cart->get_html();
     $this->set_content_data('MODULE_gift_cart', $t_view_html);
     // Bitcoin Payment - Commerce Coding - BEGIN
     $multiplier = 1;
     $digits = 8;
     switch (MODULE_PAYMENT_BITCOIN_UNITS) {
         case 'uBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'mBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'BTC':
             $btcPrice = number_format($total / MODULE_PAYMENT_BITCOIN_BTCEUR * $multiplier, $digits, '.', '');
             $this->set_content_data('BITCOIN_PRICE', $btcPrice . ' ' . MODULE_PAYMENT_BITCOIN_UNITS);
     }
     // Bitcoin Payment - Commerce Coding - END
     $t_html_output = $this->build_html();
     return $t_html_output;
 }
Пример #8
0
 function getOrderData($oID)
 {
     global $xtPrice;
     require_once DIR_FS_INC . 'xtc_get_attributes_model.inc.php';
     require_once DIR_FS_INC . 'xtc_get_short_description.inc.php';
     require_once DIR_FS_INC . 'xtc_get_products_image.inc.php';
     $order_lang_query = xtc_db_query("SELECT languages_id\n                                    FROM " . TABLE_LANGUAGES . "\n                                   WHERE directory = '" . $this->info['language'] . "'");
     $order_lang_array = xtc_db_fetch_array($order_lang_query);
     $order_lang_id = $order_lang_array['languages_id'];
     $order_query = "SELECT *\n                        FROM " . TABLE_ORDERS_PRODUCTS . "\n                       WHERE orders_id='" . (int) $oID . "'";
     $order_data = array();
     $order_query = xtc_db_query($order_query);
     while ($order_data_values = xtc_db_fetch_array($order_query)) {
         $attributes_query = "SELECT *\n                               FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "\n                              WHERE orders_products_id='" . $order_data_values['orders_products_id'] . "'\n                           ORDER BY orders_products_attributes_id";
         $attributes_data = '';
         $attributes_model = '';
         $attributes_query = xtc_db_query($attributes_query);
         while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) {
             $attributes_data .= '<br />' . $attributes_data_values['products_options'] . ':' . $attributes_data_values['products_options_values'];
             $attributes_model .= '<br />' . xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options'], $order_lang_id);
         }
         $short_description = CHECKOUT_USE_PRODUCTS_SHORT_DESCRIPTION == 'true' ? xtc_get_short_description($order_data_values['products_id'], $order_lang_id) : '';
         //using short description  if order description is not defined or empty
         $order_description = '';
         if (array_key_exists('products_order_description', $order_data_values) && !empty($order_data_values['products_order_description'])) {
             $order_description = $order_data_values['products_order_description'];
         }
         $order_description = !empty($order_description) ? $order_description : $short_description;
         $order_data[] = array('PRODUCTS_ID' => $order_data_values['products_id'], 'PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_IMAGE' => xtc_get_products_image($order_data_values['products_id']), 'PRODUCTS_ORDER_DESCRIPTION' => $order_description, 'PRODUCTS_SHORT_DESCRIPTION' => $short_description, 'PRODUCTS_SHIPPING_TIME' => $order_data_values['products_shipping_time'], 'PRODUCTS_ATTRIBUTES' => $attributes_data, 'PRODUCTS_ATTRIBUTES_MODEL' => $attributes_model, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($order_data_values['final_price'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($order_data_values['final_price'] / $order_data_values['products_quantity'], true), 'PRODUCTS_TAX' => $order_data_values['products_tax'] > 0.0 ? number_format($order_data_values['products_tax'], TAX_DECIMAL_PLACES) : 0, 'PRODUCTS_QTY' => $order_data_values['products_quantity']);
     }
     return $order_data;
 }
Пример #9
0
/*
 * -> get customers status / tax info
 */
$gm_tax_query = xtc_db_query("\n\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\tcustomers_status_show_price_tax\n\t\t\t\t\t\t\t\t\tAS\n\t\t\t\t\t\t\t\t\t\ttax\n\t\t\t\t\t\t\t\t\tFROM " . TABLE_CUSTOMERS_STATUS . "\n\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\tcustomers_status_id = '" . $order->info['status'] . "' \n\t\t\t\t\t\t\t\t");
$gm_tax = xtc_db_fetch_array($gm_tax_query);
/*
 * -> order data 
 */
$order_query = xtc_db_query("\n\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\top.products_id,\n\t\t\t\t\t\t\t\t\top.orders_products_id,\n\t\t\t\t\t\t\t\t\top.products_model,\n\t\t\t\t\t\t\t\t\top.products_name,\n\t\t\t\t\t\t\t\t\top.final_price,\n\t\t\t\t\t\t\t\t\top.products_tax,\n\t\t\t\t\t\t\t\t\top.products_quantity,\n\t\t\t\t\t\t\t\t\topqu.quantity_unit_id,\n\t\t\t\t\t\t\t\t\topqu.unit_name\n\t\t\t\t\t\t\t\tFROM " . TABLE_ORDERS_PRODUCTS . " op\n\t\t\t\t\t\t\t\tLEFT JOIN orders_products_quantity_units opqu USING (orders_products_id)\n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\top.orders_id='" . (int) $_GET['oID'] . "'\n\t\t\t\t\t\t\t\tORDER \n\t\t\t\t\t\t\t\t\tby op.products_model ASC\n\t\t\t\t\t\t\t");
$order_data = array();
while ($order_data_values = xtc_db_fetch_array($order_query)) {
    $attributes_query = xtc_db_query("\n\t\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\t\tproducts_options,\n\t\t\t\t\t\t\t\t\t\t\tproducts_options_values,\n\t\t\t\t\t\t\t\t\t\t\tprice_prefix,\n\t\t\t\t\t\t\t\t\t\t\toptions_values_price\n\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "\n\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\torders_products_id='" . $order_data_values['orders_products_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\tAND orders_id='" . (int) $_GET['oID'] . "'\n\t\t\t\t\t\t\t\t\t");
    $attributes_data = array();
    $attributes_model = '';
    while ($attributes_data_values = xtc_db_fetch_array($attributes_query)) {
        $attributes_data[] = array(xtc_get_attributes_model($order_data_values['products_id'], $attributes_data_values['products_options_values'], $attributes_data_values['products_options']), $attributes_data_values['products_options'] . ': ' . $attributes_data_values['products_options_values']);
    }
    // BOF GM_MOD GX-Customizer:
    require DIR_FS_CATALOG . 'gm/modules/gm_gprint_admin_gm_pdf_order.php';
    # properties BOF
    $t_properties_query = xtc_db_query("SELECT\n\t\t\t\t\t\t\t\t\t\t\t\tproperties_name,\n\t\t\t\t\t\t\t\t\t\t\t\tvalues_name\n\t\t\t\t\t\t\t\t\t\t\tFROM orders_products_properties\n\t\t\t\t\t\t\t\t\t\t\tWHERE orders_products_id='" . $order_data_values['orders_products_id'] . "'");
    while ($t_properties_array = xtc_db_fetch_array($t_properties_query)) {
        $attributes_data[] = array('', $t_properties_array['properties_name'] . ': ' . $t_properties_array['values_name']);
    }
    # properties EOF
    $order_data[] = array('PRODUCTS_MODEL' => $order_data_values['products_model'], 'PRODUCTS_NAME' => $order_data_values['products_name'], 'PRODUCTS_QTY' => gm_prepare_number($order_data_values['products_quantity']), 'PRODUCTS_UNIT' => $order_data_values['unit_name'], 'PRODUCTS_TAX' => xtc_display_tax_value($order_data_values['products_tax']) . "%", 'PRODUCTS_PRICE_SINGLE' => xtc_format_price_order($order_data_values['final_price'] / $order_data_values['products_quantity'], 1, $order->info['currency']), 'PRODUCTS_PRICE' => xtc_format_price_order($order_data_values['final_price'], 1, $order->info['currency']), 'PRODUCTS_ATTRIBUTES' => $attributes_data);
}
// handling article no
$gm_use_products_model = false;
if (gm_get_conf('GM_PDF_USE_PRODUCTS_MODEL') == 1) {
    $gm_use_products_model = true;