$info_smarty->assign('PRODUCTS_TAX_INFO', $tax_info);
     }
     $info_smarty->assign('PRODUCTS_SHIPPING_LINK', strip_tags($main->getShippingLink()));
 }
 $info_smarty->assign('PRODUCTS_MODEL', $product->data['products_model']);
 $info_smarty->assign('PRODUCTS_EAN', $product->data['products_ean']);
 $info_smarty->assign('PRODUCTS_QUANTITY', $product->data['products_quantity']);
 $info_smarty->assign('PRODUCTS_WEIGHT', $product->data['products_weight']);
 $info_smarty->assign('PRODUCTS_STATUS', $product->data['products_status']);
 $info_smarty->assign('PRODUCTS_ORDERED', $product->data['products_ordered']);
 $info_smarty->assign('PRODUCTS_DESCRIPTION', stripslashes($product->data['products_description']));
 $info_smarty->assign('PRODUCTS_SHORT_DESCRIPTION', stripslashes($product->data['products_short_description']));
 $info_smarty->assign('PRODUCTS_IMAGE', $product->productImage($product->data['products_image'], 'thumbnail'));
 $info_smarty->assign('PRODUCTS_URL', !empty($product->data['products_url']) ? sprintf(TEXT_MORE_INFORMATION, xtc_href_link(FILENAME_REDIRECT, 'action=product&id=' . $product->data['products_id'], 'NONSSL', true, false)) : '');
 // more images
 $mo_images = xtc_get_products_mo_images($product->data['products_id']);
 if ($mo_images != false) {
     $more_images_data = array();
     foreach ($mo_images as $img) {
         $mo_img = $product->productImage($img['image_name'], 'thumbnail');
         $more_images_data[] = array('PRODUCTS_IMAGE' => $mo_img, 'PRODUCTS_POPUP_LINK' => 'javascript:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product->data['products_id'] . '&imgID=' . $img['image_nr']) . '\')');
         //next 2 lines only needed for non modified templates
         $info_smarty->assign('PRODUCTS_IMAGE_' . $img['image_nr'], $mo_img);
         $info_smarty->assign('PRODUCTS_POPUP_LINK_' . $img['image_nr'], 'javascript:popupWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product->data['products_id'] . '&imgID=' . $img['image_nr']) . '\')');
     }
     $info_smarty->assign('more_images', $more_images_data);
 }
 // product discount
 if ($_SESSION['customers_status']['customers_status_public'] == 1 && $_SESSION['customers_status']['customers_status_discount'] != '0.00') {
     $discount = 0.0;
     $discount = $_SESSION['customers_status']['customers_status_discount'];
   -----------------------------------------------------------------------------------------
   Third Party contributions:
   Modified by BIA Solutions (www.biasolutions.com) to create a bordered look to the image

   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
require 'includes/application_top.php';
require_once DIR_FS_INC . 'xtc_get_products_mo_images.inc.php';
//BOF - Dokuman - 2009-06-05 - replace table with div
//<body bgcolor="#FFFFFF">
//<table align="center">
//<tr>
echo '<body>';
echo '<div align="center">';
//EOF - Dokuman - 2009-06-05 - replace table with div
$mo_images = xtc_get_products_mo_images((int) $_GET['pID']);
if ((int) $_GET['imgID'] == 0) {
    $actual = ' bgcolor="#FF0000"';
} else {
    unset($actual);
}
//BOF - Dokuman - 2009-06-05 - replace table with div
//echo '<td align="left"'.$actual.'>';
echo '<div style="display:inline">';
//EOF - Dokuman - 2009-06-05 - replace table with div
$products_query = xtc_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int) $_GET['pID'] . "' and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'");
$products_values = xtc_db_fetch_array($products_query);
//BOF - Dokuman - 2009-06-05 - replace table with div
//echo '<a href="popup_image.php?pID='.(int) $_GET['pID'].'&imgID=0" target="_parent">'.xtc_image(DIR_WS_THUMBNAIL_IMAGES.$products_values['products_image'], $products_values['products_name']).'</a>';
//echo '</td>';
echo '<a href="popup_image.php?pID=' . (int) $_GET['pID'] . '&imgID=0" target="_parent">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $products_values['products_image'], $products_values['products_name']) . '</a>&nbsp;&nbsp;';
 function get_html($p_coo_product, $p_current_category_id = 0)
 {
     $t_html_output = '';
     $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);
     $main = new main();
     $group_check = '';
     // xs:booster start (v1.041)
     $xsb_tx = array();
     if (@is_array($_SESSION['xtb0']['tx'])) {
         foreach ($_SESSION['xtb0']['tx'] as $tx) {
             if ($tx['products_id'] == $p_coo_product->data['products_id']) {
                 $xsb_tx = $tx;
                 break;
             }
         }
     }
     // xs:booster end
     if (!is_object($p_coo_product) || !$p_coo_product->isProduct()) {
         // product not found in database
         $error = TEXT_PRODUCT_NOT_FOUND;
         include DIR_WS_MODULES . FILENAME_ERROR_HANDLER;
         $t_html_output = $main_content;
     } else {
         if (ACTIVATE_NAVIGATOR == 'true') {
             $coo_product_navigator = MainFactory::create_object('ProductNavigatorContentView');
             $t_view_html = $coo_product_navigator->get_html($p_coo_product, $p_current_category_id);
             $this->set_content_data('PRODUCT_NAVIGATOR', $t_view_html);
         }
         xtc_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . $p_coo_product->data['products_id'] . "' and language_id = '" . $_SESSION['languages_id'] . "'");
         $products_price = $xtPrice->xtcGetPrice($p_coo_product->data['products_id'], $format = true, 1, $p_coo_product->data['products_tax_class_id'], $p_coo_product->data['products_price'], 1);
         // check if customer is allowed to add to cart
         // BOF GM_MOD:
         if ($_SESSION['customers_status']['customers_status_show_price'] != '0' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             // fsk18
             if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
                 if ($p_coo_product->data['products_fsk18'] == '0') {
                     // BOF GM_MOD:
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', gm_convert_qty($p_coo_product->data['gm_min_order'], false), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                     $t_quantity = gm_convert_qty($p_coo_product->data['gm_min_order'], false);
                     $t_disabled_quantity = 0;
                     if (@$xsb_tx['XTB_ALLOW_USER_CHQTY'] == 'true' || $xsb_tx['products_id'] != $p_coo_product->data['products_id']) {
                         $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', str_replace('.', ',', (double) $p_coo_product->data['gm_min_order']), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                     } else {
                         $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', '1', 'disabled="disabled" style="background-color:gray;"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_attr_calc_qty"'));
                         $t_quantity = 1;
                         $t_disabled_quantity = 1;
                     }
                     $this->set_content_data('QUANTITY', $t_quantity);
                     $this->set_content_data('DISABLED_QUANTITY', $t_disabled_quantity);
                     $this->set_content_data('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'id="cart_button"'));
                     if (gm_get_conf('GM_SHOW_WISHLIST') == 'true') {
                         $this->set_content_data('ADD_WISHLIST_BUTTON', '<a href="javascript:submit_to_wishlist()" id="gm_wishlist_link">' . xtc_image_button('button_in_wishlist.gif', NC_WISHLIST) . '</a>');
                     }
                 } else {
                     $this->set_content_data('GM_PID', xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 }
             } else {
                 // BOF GM_MOD:
                 $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', gm_convert_qty($p_coo_product->data['gm_min_order'], false), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 $t_quantity = gm_convert_qty($p_coo_product->data['gm_min_order'], false);
                 $t_disabled_quantity = 0;
                 if (@$xsb_tx['XTB_ALLOW_USER_CHQTY'] == 'true' || $xsb_tx['products_id'] != $p_coo_product->data['products_id']) {
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', str_replace('.', ',', (double) $p_coo_product->data['gm_min_order']), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 } else {
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', '1', 'disabled="disabled" style="background-color:gray;"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_attr_calc_qty"'));
                     $t_quantity = 1;
                     $t_disabled_quantity = 1;
                 }
                 $this->set_content_data('QUANTITY', $t_quantity);
                 $this->set_content_data('DISABLED_QUANTITY', $t_disabled_quantity);
                 $this->set_content_data('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'id="cart_button"'));
                 if (gm_get_conf('GM_SHOW_WISH_LIST') == 'true') {
                     $this->set_content_data('ADD_WISHLIST_BUTTON', '<a href="javascript:submit_to_wishlist()">' . xtc_image_button('button_in_wishlist.gif', NC_WISHLIST) . '</a>');
                 }
             }
         } elseif ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) > 0 || $_SESSION['customers_status']['customers_status_show_price'] == '0') {
             $this->set_content_data('GM_PID', xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
         }
         if ($p_coo_product->data['products_fsk18'] == '1') {
             $this->set_content_data('PRODUCTS_FSK18', 'true');
         }
         // BOF GM_MOD:
         if (ACTIVATE_SHIPPING_STATUS == 'true' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             $this->set_content_data('SHIPPING_NAME', $main->getShippingStatusName($p_coo_product->data['products_shippingtime']));
             $this->set_content_data('SHIPPING_IMAGE', $main->getShippingStatusImage($p_coo_product->data['products_shippingtime']));
         }
         // BOF_GM_MOD:
         $this->set_content_data('FORM_ACTION', xtc_draw_form('cart_quantity', xtc_href_link(FILENAME_PRODUCT_INFO, xtc_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'name="cart_quantity" onsubmit="gm_qty_check = new GMOrderQuantityChecker(); return gm_qty_check.check();"'));
         $this->set_content_data('FORM_ACTION_URL', xtc_href_link(FILENAME_PRODUCT_INFO, xtc_get_all_get_params(array('action')) . 'action=add_product'));
         $this->set_content_data('FORM_ID', 'cart_quantity');
         $this->set_content_data('FORM_NAME', 'cart_quantity');
         $this->set_content_data('FORM_METHOD', 'post');
         // BOF GM_MOD GX-Customizer
         $coo_gm_gprint_product_manager = new GMGPrintProductManager();
         if ($coo_gm_gprint_product_manager->get_surfaces_groups_id($p_coo_product->data['products_id']) !== false) {
             $coo_gm_gprint_configuration = new GMGPrintConfiguration($_SESSION['languages_id']);
             $this->set_content_data('GM_GPRINT_SHOW_PRODUCTS_DESCRIPTION', $coo_gm_gprint_configuration->get_configuration('SHOW_PRODUCTS_DESCRIPTION'));
             $this->set_content_data('GM_GPRINT', 1);
         }
         // EOF GM_MOD GX-Customizer
         $this->set_content_data('FORM_END', '</form>');
         $this->set_content_data('PRODUCTS_PRICE', $products_price['formated']);
         if ($p_coo_product->data['products_vpe_status'] == 1 && $p_coo_product->data['products_vpe_value'] != 0.0 && $products_price['plain'] > 0) {
             $this->set_content_data('PRODUCTS_VPE', $xtPrice->xtcFormat($products_price['plain'] * (1 / $p_coo_product->data['products_vpe_value']), true) . TXT_PER . xtc_get_vpe_name($p_coo_product->data['products_vpe']));
         }
         $this->set_content_data('PRODUCTS_ID', $p_coo_product->data['products_id']);
         $this->set_content_data('PRODUCTS_NAME', $p_coo_product->data['products_name']);
         // BOF GM_MOD:
         if ($_SESSION['customers_status']['customers_status_show_price'] != 0 && ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0 || $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 2 && $p_coo_product->data['products_price'] > 0)) {
             // price incl tax
             $tax_rate = $xtPrice->TAX[$p_coo_product->data['products_tax_class_id']];
             $tax_info = $main->getTaxInfo($tax_rate);
             $this->set_content_data('PRODUCTS_TAX_INFO', $tax_info);
             // BOF GM_MOD:
             if ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
                 $this->set_content_data('PRODUCTS_SHIPPING_LINK', $main->getShippingLink(true));
             }
         }
         // BOF GM_MOD
         if (gm_get_conf('GM_TELL_A_FRIEND') == 'true') {
             $this->set_content_data('GM_TELL_A_FRIEND', 1);
         }
         if ($p_coo_product->data['gm_show_price_offer'] == 1 && $_SESSION['customers_status']['customers_status_show_price'] != '0' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             $this->set_content_data('GM_PRICE_OFFER', 1);
         }
         if ((double) $p_coo_product->data['gm_min_order'] != 1) {
             $this->set_content_data('GM_MIN_ORDER', gm_convert_qty($p_coo_product->data['gm_min_order'], false));
         }
         if ((double) $p_coo_product->data['gm_graduated_qty'] != 1) {
             $this->set_content_data('GM_GRADUATED_QTY', gm_convert_qty($p_coo_product->data['gm_graduated_qty'], false));
         }
         // EOF GM_MOD
         $this->set_content_data('PRODUCTS_MODEL', $p_coo_product->data['products_model']);
         $this->set_content_data('PRODUCTS_EAN', $p_coo_product->data['products_ean']);
         if ($p_coo_product->data['gm_show_qty_info'] == 1) {
             $this->set_content_data('PRODUCTS_QUANTITY', gm_convert_qty(xtc_get_products_stock($p_coo_product->data['products_id']), false));
             if ($p_coo_product->data['quantity_unit_id'] > 0) {
                 $this->set_content_data('PRODUCTS_QUANTITY_UNIT', $p_coo_product->data['unit_name']);
             }
         }
         // BOF GM_MOD
         if ($p_coo_product->data['gm_show_weight'] == '1') {
             $this->set_content_data('SHOW_PRODUCTS_WEIGHT', 1);
             $this->set_content_data('PRODUCTS_WEIGHT', gm_prepare_number($p_coo_product->data['products_weight'], $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']));
         }
         // EOF GM_MOD
         $this->set_content_data('PRODUCTS_STATUS', $p_coo_product->data['products_status']);
         $this->set_content_data('PRODUCTS_ORDERED', $p_coo_product->data['products_ordered']);
         $this->set_content_data('PRODUCTS_PRINT', '<img src="templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/print.gif"  style="cursor:hand;" onclick="javascript:window.open(\'' . xtc_href_link(FILENAME_PRINT_PRODUCT_INFO, 'products_id=' . $p_coo_product->data['products_id']) . '\', \'popup\', \'toolbar=0, width=640, height=600\')" alt="" />');
         //GM_MOD:
         $gmTabTokenizer = MainFactory::create_object('GMTabTokenizer', array(stripslashes($p_coo_product->data['products_description'])));
         $gm_products_descrition = $gmTabTokenizer->get_prepared_output();
         $this->set_content_data('PRODUCTS_DESCRIPTION', $gm_products_descrition);
         $t_gm_images_data = array();
         $t_thumbnails_array = array();
         $t_main_max_width = 369;
         $t_main_max_height = 279;
         $t_thumbnail_max_width = 86;
         $t_thumbnail_max_height = 86;
         // BOF GM_MOD
         require_once DIR_FS_CATALOG . 'gm/classes/GMGMotion.php';
         $coo_gm_gmotion = new GMGMotion();
         $this->set_content_data('GMOTION', $coo_gm_gmotion->check_status($p_coo_product->data['products_id']));
         // EOF GM_MOD
         if (isset($xsb_tx['XTB_REDIRECT_USER_TO']) && $xsb_tx['products_id'] == $p_coo_product->data['products_id']) {
             $this->set_content_data('XTB_REDIRECT_USER_TO', $xsb_tx['XTB_REDIRECT_USER_TO']);
         }
         // BOF GM_MOD
         if ($p_coo_product->data['products_image'] != '' && $p_coo_product->data['gm_show_image'] == '1') {
             $t_info_image_size_array = @getimagesize(DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image']);
             $t_thumbnail_image_size_array = @getimagesize(DIR_WS_IMAGES . 'product_images/gallery_images/' . $p_coo_product->data['products_image']);
             $t_main_padding_left = 0;
             $t_main_padding_top = 0;
             if (isset($t_info_image_size_array[0]) && $t_info_image_size_array[0] < $t_main_max_width) {
                 $t_main_padding_left = round(($t_main_max_width - $t_info_image_size_array[0]) / 2);
             }
             if (isset($t_info_image_size_array[1]) && $t_info_image_size_array[1] < $t_main_max_height) {
                 $t_main_padding_top = round(($t_main_max_height - $t_info_image_size_array[1]) / 2);
             }
             $t_zoom_image = DIR_WS_POPUP_IMAGES . $p_coo_product->data['products_image'];
             if (file_exists(DIR_WS_ORIGINAL_IMAGES . $p_coo_product->data['products_image'])) {
                 $t_zoom_image = DIR_WS_ORIGINAL_IMAGES . $p_coo_product->data['products_image'];
             }
             $t_gm_images_data[] = array('IMAGE' => DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image'], 'IMAGE_ALT' => $p_coo_product->data['gm_alt_text'], 'IMAGE_NR' => 0, 'ZOOM_IMAGE' => $t_zoom_image, 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_main_padding_left, 'PADDING_TOP' => $t_main_padding_top, 'WIDTH' => $t_info_image_size_array[0], 'HEIGHT' => $t_info_image_size_array[1]);
             $t_thumbnail_padding_left = 0;
             $t_thumbnail_padding_top = 0;
             if (isset($t_thumbnail_image_size_array[0]) && $t_thumbnail_image_size_array[0] < $t_thumbnail_max_width) {
                 $t_thumbnail_padding_left = round(($t_thumbnail_max_width - $t_thumbnail_image_size_array[0]) / 2);
             }
             if (isset($t_thumbnail_image_size_array[1]) && $t_thumbnail_image_size_array[1] < $t_thumbnail_max_height) {
                 $t_thumbnail_padding_top = round(($t_thumbnail_max_height - $t_thumbnail_image_size_array[1]) / 2);
             }
             $t_thumbnails_array[] = array('IMAGE' => DIR_WS_IMAGES . 'product_images/gallery_images/' . $p_coo_product->data['products_image'], 'IMAGE_ALT' => $p_coo_product->data['gm_alt_text'], 'IMAGE_NR' => 0, 'ZOOM_IMAGE' => $t_zoom_image, 'INFO_IMAGE' => DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image'], 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_thumbnail_padding_left, 'PADDING_TOP' => $t_thumbnail_padding_top);
         }
         $t_gm_images = xtc_get_products_mo_images($p_coo_product->data['products_id']);
         if ($t_gm_images != false) {
             $coo_gm_alt_form = MainFactory::create_object('GMAltText');
             foreach ($t_gm_images as $t_gm_image) {
                 $t_info_image_size_array = @getimagesize(DIR_WS_INFO_IMAGES . $t_gm_image['image_name']);
                 $t_thumbnail_image_size_array = @getimagesize(DIR_WS_IMAGES . 'product_images/gallery_images/' . $t_gm_image['image_name']);
                 $t_main_padding_left = 0;
                 $t_main_padding_top = 0;
                 if (isset($t_info_image_size_array[0]) && $t_info_image_size_array[0] < $t_main_max_width) {
                     $t_main_padding_left = round(($t_main_max_width - $t_info_image_size_array[0]) / 2);
                 }
                 if (isset($t_info_image_size_array[1]) && $t_info_image_size_array[1] < $t_main_max_height) {
                     $t_main_padding_top = round(($t_main_max_height - $t_info_image_size_array[1]) / 2);
                 }
                 $t_zoom_image = DIR_WS_POPUP_IMAGES . $t_gm_image['image_name'];
                 if (file_exists(DIR_WS_ORIGINAL_IMAGES . $t_gm_image['image_name'])) {
                     $t_zoom_image = DIR_WS_ORIGINAL_IMAGES . $t_gm_image['image_name'];
                 }
                 $t_gm_images_data[] = array('IMAGE' => DIR_WS_INFO_IMAGES . $t_gm_image['image_name'], 'IMAGE_ALT' => $coo_gm_alt_form->get_alt($t_gm_image["image_id"], $t_gm_image['image_nr'], $p_coo_product->data['products_id']), 'IMAGE_NR' => $t_gm_image['image_nr'], 'ZOOM_IMAGE' => $t_zoom_image, 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_main_padding_left, 'PADDING_TOP' => $t_main_padding_top, 'IMAGE_POPUP_URL' => DIR_WS_POPUP_IMAGES . $t_gm_image['image_name']);
                 $t_thumbnail_padding_left = 0;
                 $t_thumbnail_padding_top = 0;
                 if (isset($t_thumbnail_image_size_array[0]) && $t_thumbnail_image_size_array[0] < $t_thumbnail_max_width) {
                     $t_thumbnail_padding_left = round(($t_thumbnail_max_width - $t_thumbnail_image_size_array[0]) / 2);
                 }
                 if (isset($t_thumbnail_image_size_array[1]) && $t_thumbnail_image_size_array[1] < $t_thumbnail_max_height) {
                     $t_thumbnail_padding_top = round(($t_thumbnail_max_height - $t_thumbnail_image_size_array[1]) / 2);
                 }
                 $t_thumbnails_array[] = array('IMAGE' => DIR_WS_IMAGES . 'product_images/gallery_images/' . $t_gm_image['image_name'], 'IMAGE_ALT' => $coo_gm_alt_form->get_alt($t_gm_image["image_id"], $t_gm_image['image_nr'], $p_coo_product->data['products_id']), 'IMAGE_NR' => $t_gm_image['image_nr'], 'ZOOM_IMAGE' => $t_zoom_image, 'INFO_IMAGE' => DIR_WS_INFO_IMAGES . $t_gm_image['image_name'], 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_thumbnail_padding_left, 'PADDING_TOP' => $t_thumbnail_padding_top);
             }
         }
         $this->set_content_data('images', $t_gm_images_data);
         $this->set_content_data('thumbnails', $t_thumbnails_array);
         // EOF GM_MOD
         $discount = 0.0;
         if ($_SESSION['customers_status']['customers_status_discount'] != '0.00') {
             // BOF GM_MOD:
             $discount = $_SESSION['customers_status']['customers_status_discount'];
             if ($p_coo_product->data['products_discount_allowed'] < $_SESSION['customers_status']['customers_status_discount']) {
                 $discount = $p_coo_product->data['products_discount_allowed'];
             }
             if ($discount != '0.00') {
                 $this->set_content_data('PRODUCTS_DISCOUNT', $discount . '%');
             }
         }
         // BOF GM_MOD
         if (PRODUCT_IMAGE_INFO_WIDTH < 190 - 16) {
             $this->set_content_data('MIN_IMAGE_WIDTH', 188);
             $this->set_content_data('MIN_INFO_BOX_WIDTH', 156 - 10);
             $this->set_content_data('MARGIN_LEFT', 188 + 10);
         } else {
             $this->set_content_data('MIN_IMAGE_WIDTH', PRODUCT_IMAGE_INFO_WIDTH + 16);
             $this->set_content_data('MIN_INFO_BOX_WIDTH', PRODUCT_IMAGE_INFO_WIDTH + 16 - 32 - 10);
             $this->set_content_data('MARGIN_LEFT', PRODUCT_IMAGE_INFO_WIDTH + 16 + 10);
         }
         // EOF GM_MOD
         $coo_product_attributes = MainFactory::create_object('ProductAttributesContentView', array($p_coo_product->data['options_template']));
         $t_view_html = $coo_product_attributes->get_html($p_coo_product);
         $this->set_content_data('MODULE_product_options', $t_view_html);
         $coo_product_reviews = MainFactory::create_object('ProductReviewsContentView');
         $t_view_html = $coo_product_reviews->get_html($p_coo_product);
         $this->set_content_data('MODULE_products_reviews', $t_view_html);
         if (xtc_not_null($p_coo_product->data['products_url'])) {
             $this->set_content_data('PRODUCTS_URL', sprintf(TEXT_MORE_INFORMATION, xtc_href_link(FILENAME_REDIRECT, 'action=product&id=' . $p_coo_product->data['products_id'], 'NONSSL', true)));
         }
         if ($p_coo_product->data['products_date_available'] > date('Y-m-d H:i:s')) {
             $this->set_content_data('PRODUCTS_DATE_AVIABLE', sprintf(TEXT_DATE_AVAILABLE, xtc_date_long($p_coo_product->data['products_date_available'])));
         } else {
             // BOF GM_MOD:
             if ($p_coo_product->data['products_date_added'] != '0000-00-00 00:00:00' && $p_coo_product->data['gm_show_date_added'] == 1) {
                 $this->set_content_data('PRODUCTS_ADDED', sprintf(TEXT_DATE_ADDED, xtc_date_long($p_coo_product->data['products_date_added'])));
             }
         }
         $coo_product_media = MainFactory::create_object('ProductMediaContentView');
         $t_view_html = $coo_product_media->get_html($p_coo_product->data['products_id'], $_SESSION['languages_id']);
         $this->set_content_data('MODULE_products_media', $t_view_html);
         $coo_graduated_prices = MainFactory::create_object('GraduatedPricesContentView');
         $t_view_html = $coo_graduated_prices->get_html($p_coo_product);
         $this->set_content_data('MODULE_graduated_price', $t_view_html);
         $coo_also_purchased = MainFactory::create_object('AlsoPurchasedContentView');
         $t_view_html = $coo_also_purchased->get_html($p_coo_product);
         $this->set_content_data('MODULE_also_purchased', $t_view_html);
         $coo_cross_selling = MainFactory::create_object('CrossSellingContentView', array('cross_selling'));
         $t_view_html = $coo_cross_selling->get_html($p_coo_product);
         $this->set_content_data('MODULE_cross_selling', $t_view_html);
         $coo_reverse_cross_selling = MainFactory::create_object('CrossSellingContentView', array('reverse_cross_selling'));
         $t_view_html = $coo_reverse_cross_selling->get_html($p_coo_product);
         $this->set_content_data('MODULE_reverse_cross_selling', $t_view_html);
         $i = count($_SESSION['tracking']['products_history']);
         if ($i > 6) {
             array_shift($_SESSION['tracking']['products_history']);
             $_SESSION['tracking']['products_history'][6] = $p_coo_product->data['products_id'];
             $_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
         } else {
             $_SESSION['tracking']['products_history'][$i] = $p_coo_product->data['products_id'];
             $_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
         }
         $coo_stop_watch = new StopWatch();
         $coo_stop_watch->start();
         $coo_properties_view = MainFactory::create_object('PropertiesView', array($_GET, $_POST));
         $t_properties_selection_form = $coo_properties_view->get_selection_form($p_coo_product->data['products_id'], $_SESSION['languages_id']);
         if (trim($t_properties_selection_form) != "") {
             if ($p_coo_product->data['gm_show_qty_info'] == 1) {
                 if ($p_coo_product->data['use_properties_combis_quantity'] == 0 && STOCK_CHECK == 'true' && ATTRIBUTES_STOCK_CHECK == 'true' || $p_coo_product->data['use_properties_combis_quantity'] == 2) {
                     $this->set_content_data('PRODUCTS_QUANTITY', '-');
                     $this->set_content_data('SHOW_PRODUCTS_QUANTITY', true);
                 } else {
                     if ($p_coo_product->data['use_properties_combis_quantity'] == 1) {
                         $this->set_content_data('SHOW_PRODUCTS_QUANTITY', true);
                     }
                 }
             }
             $this->set_content_data('SHOW_PRODUCTS_MODEL', true);
             if (APPEND_PROPERTIES_MODEL == "false" || trim($p_coo_product->data['products_model']) == '') {
                 $this->set_content_data('PRODUCTS_MODEL', '-');
             }
             if (ACTIVATE_SHIPPING_STATUS == 'true' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0 && $p_coo_product->data['use_properties_combis_shipping_time'] == 1) {
                 $this->set_content_data('SHOW_SHIPPING_TIME', true);
                 $this->set_content_data('SHIPPING_NAME', '');
                 $this->set_content_data('SHIPPING_IMAGE', 'admin/images/icons/gray.png');
             }
         }
         $this->set_content_data('properties_selection_form', $t_properties_selection_form);
         $coo_stop_watch->stop();
         //$coo_stop_watch->log_total_time('PropertiesView get_selection_form');
         // BOF GM_MOD
         $t_gm_show_wishlist = gm_get_conf('GM_SHOW_WISHLIST');
         if ($t_gm_show_wishlist == 'true') {
             $this->set_content_data('GM_SHOW_WISHLIST', 1);
         }
         $t_show_facebook = gm_get_conf('SHOW_FACEBOOK');
         if ($t_show_facebook == 'true') {
             $this->set_content_data('SHOW_FACEBOOK', 1);
         }
         $t_show_twitter = gm_get_conf('SHOW_TWITTER');
         if ($t_show_twitter == 'true') {
             $this->set_content_data('SHOW_TWITTER', 1);
         }
         $t_show_googleplus = gm_get_conf('SHOW_GOOGLEPLUS');
         if ($t_show_googleplus == 'true') {
             $this->set_content_data('SHOW_GOOGLEPLUS', 1);
         }
         $t_show_pinterest = gm_get_conf('SHOW_PINTEREST');
         if ($t_show_pinterest == 'true') {
             $this->set_content_data('SHOW_PINTEREST', 1);
         }
         $t_show_print = gm_get_conf('SHOW_PRINT');
         if ($t_show_print == 'true') {
             $this->set_content_data('SHOW_PRINT', 1);
         }
         $t_show_bookmarking = gm_get_conf('SHOW_BOOKMARKING');
         if ($t_show_bookmarking == 'true') {
             $this->set_content_data('SHOW_BOOKMARKING', 1);
         }
         // EOF GM_MOD
         // 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($products_price['plain'] / MODULE_PAYMENT_BITCOIN_BTCEUR * $multiplier, $digits, '.', '');
                 $this->set_content_data('BITCOIN_PRICE', $btcPrice . ' ' . MODULE_PAYMENT_BITCOIN_UNITS);
         }
         // Bitcoin Payment - Commerce Coding - END
         include_once DIR_FS_DOCUMENT_ROOT . '/shopgate/plugins/gambiogx/system/views/product_info/ProductInfoContentView.inc.php';
         $t_html_output = $this->build_html();
     }
     return $t_html_output;
 }
 function duplicate_product($src_products_id, $dest_categories_id)
 {
     $src_products_id = (int) $src_products_id;
     $dest_categories_id = (int) $dest_categories_id;
     //get data
     $product_query = xtc_db_query("SELECT * FROM " . TABLE_PRODUCTS . "\n                                        WHERE products_id = '" . $src_products_id . "'");
     $product = xtc_db_fetch_array($product_query);
     if ($dest_categories_id == 0) {
         $startpage = 1;
         $products_status = 1;
     } else {
         $startpage = 0;
         $products_status = $product['products_status'];
     }
     //copy data
     $sql_data_array = $product;
     //set new data (overrides)
     unset($sql_data_array['products_id']);
     $sql_data_array['products_startpage'] = $startpage;
     $sql_data_array['products_date_added'] = 'now()';
     $sql_data_array['products_status'] = $products_status;
     //get customers statuses and set group_permissions
     //not needed, because group_permissions are in $sql_data_array
     //write data to DB
     xtc_db_perform(TABLE_PRODUCTS, $sql_data_array);
     //get duplicate id
     $dup_products_id = xtc_db_insert_id();
     //duplicate image if there is one
     if ($product['products_image'] != '') {
         //build new image_name for duplicate
         $pname_arr = explode('.', $product['products_image']);
         $nsuffix = array_pop($pname_arr);
         $dup_products_image_name = $dup_products_id . '_0' . '.' . $nsuffix;
         //write to DB
         xtc_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_image = '" . $dup_products_image_name . "' WHERE products_id = '" . $dup_products_id . "'");
         @copy(DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_INFO_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_INFO_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_POPUP_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_POPUP_IMAGES . '/' . $dup_products_image_name);
         //h-h-h - 2011-01-27 - set file rights
         $this->set_products_images_file_rights($dup_products_image_name);
     } else {
         unset($dup_products_image_name);
     }
     //get description data
     $description_query = xtc_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . "\n                                               WHERE products_id = '" . $src_products_id . "'");
     $old_products_id = $src_products_id;
     while ($description = xtc_db_fetch_array($description_query)) {
         //copy description data
         $sql_data_array = $description;
         //set description data (overrides)
         $sql_data_array['products_id'] = $dup_products_id;
         $sql_data_array['products_viewed'] = 0;
         //write description data to DB
         xtc_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
     }
     xtc_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                          SET products_id   = '" . $dup_products_id . "',\n                              categories_id = '" . $dest_categories_id . "'");
     //mo_images by Novalis@eXanto.de
     $mo_images = xtc_get_products_mo_images($src_products_id);
     if (is_array($mo_images)) {
         foreach ($mo_images as $dummy => $mo_img) {
             //build new image_name for duplicate
             $pname_arr = explode('.', $mo_img['image_name']);
             $nsuffix = array_pop($pname_arr);
             $dup_products_image_name = $dup_products_id . '_' . $mo_img['image_nr'] . '.' . $nsuffix;
             //copy org images to duplicate
             @copy(DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_INFO_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_INFO_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_POPUP_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_POPUP_IMAGES . '/' . $dup_products_image_name);
             // h-h-h - 2011-01-27 - set file rights
             $this->set_products_images_file_rights($dup_products_image_name);
             //write to DB
             xtc_db_query("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "\n                                           SET products_id = '" . $dup_products_id . "',\n                                               image_nr    = '" . $mo_img['image_nr'] . "',\n\t\t\t\t\t\t\t\t\t\t\t  image_title    = '" . $mo_img['image_title'] . "',\n\t\t\t\t\t\t\t\t\t\t\t  image_alt    = '" . $mo_img['image_alt'] . "',\n                                               image_name  = '" . $dup_products_image_name . "'");
         }
     }
     //mo_images EOF
     $products_id = $dup_products_id;
     $group_query = xtc_db_query("SELECT customers_status_id FROM " . TABLE_CUSTOMERS_STATUS . "\n                                                           WHERE language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                                             AND customers_status_id != '0'");
     $i = 0;
     while ($group_values = xtc_db_fetch_array($group_query)) {
         // load data into array
         $i++;
         $group_data[$i] = array('STATUS_ID' => $group_values['customers_status_id']);
     }
     for ($col = 0, $n = sizeof($group_data); $col < $n + 1; $col++) {
         if ($group_data[$col]['STATUS_ID'] != '') {
             $copy_query = xtc_db_query("SELECT quantity,\n                                           personal_offer\n                                      FROM personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                                     WHERE products_id = '" . $old_products_id . "'");
             while ($copy_data = xtc_db_fetch_array($copy_query)) {
                 xtc_db_query("INSERT INTO personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n                               SET price_id       = '',\n                                   products_id    = '" . $products_id . "',\n                                   quantity       = '" . $copy_data['quantity'] . "',\n                                   personal_offer = '" . $copy_data['personal_offer'] . "'");
             }
         }
     }
     //dublicate products attributes
     if (isset($_POST['attr_copy']) && $_POST['attr_copy'] == 'attr_copy') {
         $attribute_copy_query = xtc_db_query("SELECT *\n                                              FROM products_attributes\n                                             WHERE products_id = '" . $old_products_id . "'\n                                          ");
         while ($attribute_copy_data = xtc_db_fetch_array($attribute_copy_query)) {
             $sql_data_array = $attribute_copy_data;
             //set attributes data (overrides)
             unset($sql_data_array['products_attributes_id']);
             $sql_data_array['products_id'] = $dup_products_id;
             //write attributes data to DB
             xtc_db_perform(TABLE_PRODUCTS_ATTRIBUTES, $sql_data_array);
         }
     }
 }
 // display images fields:
 echo '<tr><td colspan="4">' . xtc_draw_separator('pixel_trans.gif', '1', '10') . '</td></tr><tr>';
 if ($pInfo->products_image) {
     echo '<td colspan="4"><table><tr><td align="center" class="main" width="' . (PRODUCT_IMAGE_THUMBNAIL_WIDTH + 15) . '">' . xtc_image(DIR_WS_CATALOG_THUMBNAIL_IMAGES . $pInfo->products_image, 'Standard Image') . '</td>';
 }
 echo '<td class="main">' . TEXT_PRODUCTS_IMAGE . '<br />' . xtc_draw_file_field('products_image') . '<br />' . xtc_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $pInfo->products_image . xtc_draw_hidden_field('products_previous_image_0', $pInfo->products_image);
 if ($pInfo->products_image != '') {
     echo '</tr><tr><td align="center" class="main" valign="middle">' . xtc_draw_selection_field('del_pic', 'checkbox', $pInfo->products_image) . ' ' . TEXT_DELETE . '</td></tr></table>';
 } else {
     echo '</td></tr>';
 }
 echo '<tr><td colspan="4" class="main">' . TEXT_PRODUCTS_IMAGE_TITLE . xtc_draw_input_field('products_image_title', $pInfo->products_image_title, 'style="width: 100% !important;"') . '</td></tr>';
 echo '<tr><td colspan="4" class="main">' . TEXT_PRODUCTS_IMAGE_ALT . xtc_draw_input_field('products_image_alt', $pInfo->products_image_alt, 'style="width: 100% !important;"') . '</td></tr>';
 // display MO PICS
 if (MO_PICS > 0) {
     $mo_images = xtc_get_products_mo_images($pInfo->products_id);
     for ($i = 0; $i < MO_PICS; $i++) {
         echo '<tr><td colspan="4">' . xtc_draw_separator('pixel_black.gif', '100%', '1') . '</td></tr>';
         echo '<tr><td colspan="4">' . xtc_draw_separator('pixel_trans.gif', '1', '10') . '</td></tr>';
         if ($mo_images[$i]["image_name"]) {
             echo '<tr><td colspan="4"><table><tr><td align="center" class="main" width="' . (PRODUCT_IMAGE_THUMBNAIL_WIDTH + 15) . '">' . xtc_image(DIR_WS_CATALOG_THUMBNAIL_IMAGES . $mo_images[$i]["image_name"], 'Image ' . ($i + 1)) . '</td>';
         } else {
             echo '<tr>';
         }
         echo '<td class="main">' . TEXT_PRODUCTS_IMAGE . ' ' . ($i + 1) . '<br />' . xtc_draw_file_field('mo_pics_' . $i) . '<br />' . xtc_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $mo_images[$i]["image_name"] . xtc_draw_hidden_field('products_previous_image_' . ($i + 1), $mo_images[$i]["image_name"]);
         if (isset($mo_images[$i]["image_name"])) {
             echo '</tr><tr><td align="center" class="main" valign="middle">' . xtc_draw_selection_field('del_mo_pic[]', 'checkbox', $mo_images[$i]["image_name"]) . ' ' . TEXT_DELETE . '</td></tr></table>';
         } else {
             echo '</td></tr>';
         }
         echo '<tr><td colspan="4" class="main">' . TEXT_PRODUCTS_IMAGE_TITLE . xtc_draw_input_field('image_title[' . $i . ']', $mo_images[$i]["image_title"], 'style="width: 100% !important;"') . '</td></tr>';