$cache_id = $_SESSION['language'] . $product->data['products_id'];
}
if (!$box_smarty->is_cached(CURRENT_TEMPLATE . '/boxes/box_manufacturers_info.html', $cache_id) || !$cache) {
    $box_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
    $rebuild = true;
    $manufacturer_query = xtDBquery("select\n                                            m.manufacturers_id,\n                                            m.manufacturers_name,\n                                            m.manufacturers_image,\n                                            mi.manufacturers_url\n                                       FROM " . TABLE_MANUFACTURERS . " m\n                                  LEFT JOIN " . TABLE_MANUFACTURERS_INFO . " mi\n                                         ON (m.manufacturers_id = mi.manufacturers_id\n                                        AND mi.languages_id = '" . (int) $_SESSION['languages_id'] . "'),\n                                            " . TABLE_PRODUCTS . " p\n                                       WHERE p.products_id = '" . $product->data['products_id'] . "'\n                                         AND p.manufacturers_id = m.manufacturers_id");
    if (xtc_db_num_rows($manufacturer_query, true)) {
        $manufacturer = xtc_db_fetch_array($manufacturer_query, true);
        $image = 'aaa';
        if (xtc_not_null($manufacturer['manufacturers_image'])) {
            $image = DIR_WS_IMAGES . $manufacturer['manufacturers_image'];
            // BOF - Tomcraft - 2009-10-30 - noimage.gif is displayed, when no image is defined
            if (!file_exists($image)) {
                $image = DIR_WS_IMAGES . 'manufacturers/noimage.gif';
            }
            // EOF - Tomcraft - 2009-10-30 - noimage.gif is displayed, when no image is defined
        }
        $box_smarty->assign('IMAGE', $image);
        $box_smarty->assign('NAME', $manufacturer['manufacturers_name']);
        if ($manufacturer['manufacturers_url'] != '') {
            $box_smarty->assign('URL', '<a href="' . xtc_href_link(FILENAME_REDIRECT, 'action=manufacturer&' . xtc_manufacturer_link($manufacturer['manufacturers_id'], $manufacturer['manufacturers_name'])) . '" onclick="window.open(this.href); return false;">' . sprintf(BOX_MANUFACTURER_INFO_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a>');
        }
        $box_smarty->assign('LINK_MORE', '<a href="' . xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link($manufacturer['manufacturers_id'], $manufacturer['manufacturers_name'])) . '">' . BOX_MANUFACTURER_INFO_OTHER_PRODUCTS . '</a>');
    }
}
if ($cache && !$rebuild) {
    $box_manufacturers_info = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers_info.html', $cache_id);
} else {
    $box_manufacturers_info = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers_info.html');
}
$smarty->assign('box_MANUFACTURERS_INFO', $box_manufacturers_info);
            }
            $manufacturers_list .= '<a href="' . xtc_href_link(DIR_WS_CATALOG . FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br />';
            //DokuMan - 2010-09-30 - added DIR_WS_CATALOG for manufacturer_dropdown to work properly
        }
        $box_content = $manufacturers_list;
    } else {
        // Display a drop-down
        $manufacturers_array = array();
        if (MAX_MANUFACTURERS_LIST < 2) {
            $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
        }
        while ($manufacturers = xtc_db_fetch_array($manufacturers_query, true)) {
            $manufacturers_name = strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name'];
            $manufacturers_array[] = array('id' => xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link($manufacturers['manufacturers_id'], $manufacturers['manufacturers_name'])), 'text' => $manufacturers_name);
        }
        //BOF - h-h-h - 2011-05-16 - fix view selected manufacturers
        //$box_content = xtc_draw_form('manufacturers', xtc_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get').xtc_draw_pull_down_menu('manufacturers_id', $manufacturers_array, isset($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '', 'onchange="if (form.manufacturers_id.selectedIndex != 0) location = form.manufacturers_id.options[form.manufacturers_id.selectedIndex].value;" size="'.MAX_MANUFACTURERS_LIST.'" style="width: 100%;"').xtc_hide_session_id().'</form>';
        $box_content = xtc_draw_form('manufacturers', xtc_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get') . xtc_draw_pull_down_menu('manufacturers_id', $manufacturers_array, isset($_GET['manufacturers_id']) ? xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link($_GET['manufacturers_id'], isset($_GET['manufacturers_name']) ? $_GET['manufacturers_name'] : '')) : '', 'onchange="if (form.manufacturers_id.selectedIndex != 0) location = form.manufacturers_id.options[form.manufacturers_id.selectedIndex].value;" size="' . MAX_MANUFACTURERS_LIST . '"  class="form-control"') . xtc_hide_session_id() . '</form>';
        //EOF - h-h-h - 2011-05-16 - fix view selected manufacturers
    }
    if ($box_content != '') {
        $box_smarty->assign('BOX_CONTENT', $box_content);
    }
}
// set cache ID
if (!$cache) {
    $box_manufacturers = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers.html');
} else {
    $box_manufacturers = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_manufacturers.html', $cache_id);
}
$smarty->assign('box_MANUFACTURERS', $box_manufacturers);
}
if (!is_object($product) || !$product->isProduct()) {
    // product not found in database
    $error = TEXT_PRODUCT_NOT_FOUND;
    include DIR_WS_MODULES . FILENAME_ERROR_HANDLER;
} else {
    // defaults
    $hide_qty = 0;
    $module_content = '';
    // Get manufacturer name etc. for the product page
    $manufacturer_query = xtc_db_query("SELECT m.manufacturers_id,\n                                             m.manufacturers_name,\n                                             m.manufacturers_image,\n                                             mi.manufacturers_url\n                                        FROM " . TABLE_MANUFACTURERS . " m\n                                   LEFT JOIN " . TABLE_MANUFACTURERS_INFO . " mi\n                                          ON (m.manufacturers_id = mi.manufacturers_id\n                                         AND mi.languages_id = '" . (int) $_SESSION['languages_id'] . "'),\n                                             " . TABLE_PRODUCTS . " p\n                                       WHERE p.products_id = '" . $product->data['products_id'] . "'\n                                         AND p.manufacturers_id = m.manufacturers_id");
    if (xtc_db_num_rows($manufacturer_query)) {
        $manufacturer = xtc_db_fetch_array($manufacturer_query);
        $info_smarty->assign('MANUFACTURER_IMAGE', !empty($manufacturer['manufacturers_image']) ? DIR_WS_IMAGES . $manufacturer['manufacturers_image'] : '');
        $info_smarty->assign('MANUFACTURER', $manufacturer['manufacturers_name']);
        $info_smarty->assign('MANUFACTURER_LINK', xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link($manufacturer['manufacturers_id'], $manufacturer['manufacturers_name'])));
    }
    // build products price
    $products_price = $xtPrice->xtcGetPrice($product->data['products_id'], $format = true, 1, $product->data['products_tax_class_id'], $product->data['products_price'], 1);
    $products_attributes_query = xtc_db_query("select count(*) as total \n                                               from " . TABLE_PRODUCTS_OPTIONS . " popt, \n                                                    " . TABLE_PRODUCTS_ATTRIBUTES . " patrib \n                                              where patrib.products_id='" . $product->data['products_id'] . "' \n                                                and patrib.options_id = popt.products_options_id \n                                                and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                            ");
    $products_attributes = xtc_db_fetch_array($products_attributes_query);
    if ($products_attributes['total'] > 0) {
        $products_options_name_query = xtc_db_query("select distinct popt.products_options_id, \n                                                                 popt.products_options_name \n                                                            from " . TABLE_PRODUCTS_OPTIONS . " popt, \n                                                                 " . TABLE_PRODUCTS_ATTRIBUTES . " patrib \n                                                           where patrib.products_id='" . $product->data['products_id'] . "' \n                                                             and patrib.options_id = popt.products_options_id \n                                                             and popt.language_id = '" . (int) $_SESSION['languages_id'] . "' \n                                                        order by popt.products_options_name\n                                                ");
        while ($products_options_name = xtc_db_fetch_array($products_options_name_query)) {
            $products_options_query = xtc_db_query(" select pov.products_options_values_id,\n                                                      pov.products_options_values_name,\n                                                      pa.options_values_price,\n                                                      pa.price_prefix,pa.attributes_stock,\n                                                      pa.attributes_model\n                                                 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa,\n                                                      " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov\n                                                where pa.products_id = '" . $product->data['products_id'] . "'\n                                                  and pa.options_id = '" . $products_options_name['products_options_id'] . "'\n                                                  and pa.options_values_id = pov.products_options_values_id\n                                                  and pov.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                             order by pa.sortorder\n                                            ");
            while ($products_options = xtc_db_fetch_array($products_options_query)) {
                $module_content[] = array('GROUP' => $products_options_name['products_options_name'], 'NAME' => $products_options['products_options_values_name']);
                if ($products_options['options_values_price'] != '0') {
                    if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                        $tax_rate = $xtPrice->TAX[$product->data['products_tax_class_id']];
                        $products_options['options_values_price'] = xtc_add_tax($products_options['options_values_price'], $xtPrice->TAX[$product->data['products_tax_class_id']]);
    $link_index = HEADER_TITLE_TOP;
} else {
    $breadcrumb->add(HEADER_TITLE_TOP, xtc_href_link('../'));
    $breadcrumb->add(HEADER_TITLE_CATALOG, xtc_href_link(FILENAME_DEFAULT));
    $link_index = HEADER_TITLE_CATALOG;
}
// add category names or the manufacturer name to the breadcrumb trail
if (isset($cPath_array)) {
    for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
        $group_check = '';
        if (GROUP_CHECK == 'true') {
            $group_check = "AND c.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
        }
        $categories_query = xtDBquery("-- /includes/application_top.php\n                                   SELECT cd.categories_name\n                                     FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd,\n                                          " . TABLE_CATEGORIES . " c\n                                    WHERE cd.categories_id = '" . $cPath_array[$i] . "'\n                                      AND c.categories_id=cd.categories_id\n                                          " . $group_check . "\n                                      AND cd.language_id='" . (int) $_SESSION['languages_id'] . "'");
        if (xtc_db_num_rows($categories_query, true) > 0) {
            $categories = xtc_db_fetch_array($categories_query, true);
            $breadcrumb->add($categories['categories_name'], xtc_href_link(FILENAME_DEFAULT, xtc_category_link($cPath_array[$i], $categories['categories_name'])));
        } else {
            break;
        }
    }
} elseif (isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id'])) {
    $_GET['manufacturers_id'] = (int) $_GET['manufacturers_id'];
    $manufacturers_query = xtDBquery("-- /includes/application_top.php\n                                    SELECT manufacturers_name \n                                      FROM " . TABLE_MANUFACTURERS . " \n                                     WHERE manufacturers_id = '" . (int) $_GET['manufacturers_id'] . "'");
    $manufacturers = xtc_db_fetch_array($manufacturers_query, true);
    $breadcrumb->add($manufacturers['manufacturers_name'], xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link((int) $_GET['manufacturers_id'], $manufacturers['manufacturers_name'])));
}
// add the products model/name to the breadcrumb trail
if ($product->isProduct()) {
    $breadcrumb->add($product->data['products_name'], xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($product->data['products_id'], $product->data['products_name'])));
}