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; }
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; }
for ($i = 0, $n = sizeof($products); $i < $n; $i++) { if (STOCK_CHECK == 'true') { $mark_stock = xtc_check_stock($products[$i]['id'], $products[$i]['quantity']); if ($mark_stock) { $_SESSION['any_out_of_stock'] = 1; } } $image = ''; if ($products[$i]['image'] != '') { $image = DIR_WS_THUMBNAIL_IMAGES . $products[$i]['image']; } //show 'delete button' in shopping cart $del_button = '<a href="' . xtc_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&prd_id=' . $products[$i]['id'], 'NONSSL') . '">' . xtc_image_button('cart_del.gif', IMAGE_BUTTON_DELETE) . '</a>'; //show 'delete link' in shopping cart $del_link = '<a href="' . xtc_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&prd_id=' . $products[$i]['id'], 'NONSSL') . '">' . IMAGE_BUTTON_DELETE . '</a>'; $module_content[$i] = array('PRODUCTS_NAME' => $products[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"') . xtc_draw_hidden_field('products_id[]', $products[$i]['id']) . xtc_draw_hidden_field('old_qty[]', $products[$i]['quantity']), 'PRODUCTS_MODEL' => $products[$i]['model'], 'PRODUCTS_SHIPPING_TIME' => $products[$i]['shipping_time'], 'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $products[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $products[$i]['id']), 'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products[$i]['id'], $products[$i]['name'])), 'BUTTON_DELETE' => $del_button, 'LINK_DELETE' => $del_link, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($products[$i]['price'] * $products[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($products[$i]['price'], true), 'PRODUCTS_VPE' => $products[$i]['vpe'], 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($products[$i]['id']), 'ATTRIBUTES' => ''); //products attributes if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { $subindex = 0; reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $hidden_options .= xtc_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = $main->getAttributes($products[$i]['id'], $option, $value); $attribute_stock_check = ''; if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') { if ($attributes['attributes_stock'] - $products[$i]['quantity'] < 0) { $attribute_stock_check = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>'; $_SESSION['any_out_of_stock'] = 1; } } $module_content[$i]['ATTRIBUTES'][$subindex] = array('ID' => $attributes['products_attributes_id'], 'MODEL' => $attributes['attributes_model'], 'EAN' => $attributes['attributes_ean'], 'NAME' => $attributes['products_options_name'], 'VALUE_NAME' => $attributes['products_options_values_name'] . $attribute_stock_check);