if ($_GET['page'] > 1) {
    $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
}
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . SESSION_LANGUAGE_ID . "' and p.products_ordered > 0 group by pd.products_id order by p.products_ordered DESC, pd.products_name";
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
$products_query = olc_db_query($products_query_raw);
while ($products = olc_db_fetch_array($products_query)) {
    $rows++;
    if (strlen($rows) < 2) {
        $rows = '0' . $rows;
    }
    ?>
              <tr class="dataTableRow" onmouseover="this.className='dataTableRowOver';this.style.cursor='hand'"
								onmouseout="this.className='dataTableRow'"
								onclick="javascript:<?php 
    echo olc_onclick_link(FILENAME_CATEGORIES, 'action=new_product_preview&read=only&pID=' . $products['products_id'] . '&origin=' . FILENAME_STATS_PRODUCTS_PURCHASED . '?page=' . $_GET['page'], NONSSL);
    ?>
">
                <td class="dataTableContent"><?php 
    echo $rows;
    ?>
.</td>
                <td class="dataTableContent"><?php 
    echo $products['products_name'] . HTML_A_END;
    ?>
</td>
                <td class="dataTableContent" align="center"><?php 
    echo $products['products_ordered'];
    ?>
&nbsp;</td>
              </tr>
    } elseif (is_numeric($_GET['status'])) {
        $status = olc_db_prepare_input($_GET['status']);
        $payments_query_raw = "select p.* , s.affiliate_payment_status_name from " . TABLE_AFFILIATE_PAYMENT . " p , " . TABLE_AFFILIATE_PAYMENT_STATUS . " s where s.affiliate_payment_status_id = '" . olc_db_input($status) . "' and p.affiliate_payment_status = s.affiliate_payment_status_id and s.affiliate_language_id = '" . SESSION_LANGUAGE_ID . "' order by p.affiliate_payment_id DESC";
    } else {
        $payments_query_raw = "select p.* , s.affiliate_payment_status_name from " . TABLE_AFFILIATE_PAYMENT . " p , " . TABLE_AFFILIATE_PAYMENT_STATUS . " s where p.affiliate_payment_status = s.affiliate_payment_status_id and s.affiliate_language_id = '" . SESSION_LANGUAGE_ID . "' order by p.affiliate_payment_id DESC";
    }
    $payments_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $payments_query_raw, $payments_query_numrows);
    $payments_query = olc_db_query($payments_query_raw);
    while ($payments = olc_db_fetch_array($payments_query)) {
        if ((!$_GET['pID'] || $_GET['pID'] == $payments['affiliate_payment_id']) && !$pInfo) {
            $pInfo = new objectInfo($payments);
        }
        if (is_object($pInfo) && $payments['affiliate_payment_id'] == $pInfo->affiliate_payment_id) {
            echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->affiliate_payment_id . '&action=edit') . '">' . NEW_LINE;
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('pID')) . 'pID=' . $payments['affiliate_payment_id']) . '">' . NEW_LINE;
        }
        ?>
                <td class="dataTableContent"><?php 
        echo HTML_A_START . olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->affiliate_payment_id . '&action=edit') . '">' . olc_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $payments['affiliate_firstname'] . BLANK . $payments['affiliate_lastname'];
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo $currencies->format(strip_tags($payments['affiliate_payment']));
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo $currencies->format(strip_tags($payments['affiliate_payment'] + $payments['affiliate_payment_tax']));
        ?>
</td>
                <td class="dataTableContent" align="center"><?php 
echo TABLE_HEADING_ACTION;
?>
&nbsp;</td>
              </tr>
<?php 
$classes_query_raw = "select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from " . TABLE_TAX_CLASS . " order by tax_class_title";
$classes_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows);
$classes_query = olc_db_query($classes_query_raw);
while ($classes = olc_db_fetch_array($classes_query)) {
    if ((!$_GET['tID'] || @$_GET['tID'] == $classes['tax_class_id']) && !$tcInfo && substr($_GET['action'], 0, 3) != 'new') {
        $tcInfo = new objectInfo($classes);
    }
    if (is_object($tcInfo) && $classes['tax_class_id'] == $tcInfo->tax_class_id) {
        echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes['tax_class_id']) . '">' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent"><?php 
    echo $classes['tax_class_title'];
    ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    if (is_object($tcInfo) && $classes['tax_class_id'] == $tcInfo->tax_class_id) {
        echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', '');
    } else {
        echo HTML_A_START . olc_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes['tax_class_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
    }
    ?>
&nbsp;</td>
              </tr>
              </tr>
<?php 
$blacklist_query_raw = "select blacklist_id, blacklist_card_number, date_added, last_modified from " . TABLE_BLACKLIST . " order by blacklist_id";
$blacklist_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $blacklist_query_raw, $blacklist_query_numrows);
$blacklist_query = olc_db_query($blacklist_query_raw);
while ($blacklist = olc_db_fetch_array($blacklist_query)) {
    if ((!$_GET['bID'] || @$_GET['bID'] == $blacklist['blacklist_id']) && !$bInfo && substr($_GET['action'], 0, 3) != 'new') {
        $blacklist_numbers_query = olc_db_query("select count(*) as blacklist_count from " . TABLE_BLACKLIST . " where blacklist_id = '" . $blacklist['blacklist_id'] . APOS);
        $blacklist_numbers = olc_db_fetch_array($blacklist_numbers_query);
        $bInfo_array = olc_array_merge($blacklist, $blacklist_numbers);
        $bInfo = new objectInfo($bInfo_array);
    }
    if (is_object($bInfo) && $blacklist['blacklist_id'] == $bInfo->blacklist_id) {
        echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_BLACKLIST, 'page=' . $_GET['page'] . '&bID=' . $blacklist['blacklist_id'] . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_BLACKLIST, 'page=' . $_GET['page'] . '&bID=' . $blacklist['blacklist_id']) . '">' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent"><?php 
    echo $blacklist['blacklist_card_number'];
    ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    if (is_object($bInfo) && $blacklist['blacklist_id'] == $bInfo->blacklist_id) {
        echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif');
    } else {
        echo HTML_A_START . olc_href_link(FILENAME_BLACKLIST, 'page=' . $_GET['page'] . '&bID=' . $blacklist['blacklist_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
    }
    ?>
&nbsp;</td>
              </tr>
            $cc_query_raw = "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified from " . TABLE_COUPONS . " where coupon_type != 'G'";
        }
        $cc_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $cc_query_raw, $cc_query_numrows);
        $cc_query = olc_db_query($cc_query_raw);
        while ($cc_list = olc_db_fetch_array($cc_query)) {
            $rows++;
            if (strlen($rows) < 2) {
                $rows = '0' . $rows;
            }
            if ((!$_GET['cid'] || @$_GET['cid'] == $cc_list['coupon_id']) && !$cInfo) {
                $cInfo = new objectInfo($cc_list);
            }
            if (is_object($cInfo) && $cc_list['coupon_id'] == $cInfo->coupon_id) {
                echo '          <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link('coupon_admin.php', olc_get_all_get_params(array('cid', 'action')) . 'cid=' . $cInfo->coupon_id . '&action=edit') . '">' . NEW_LINE;
            } else {
                echo '          <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link('coupon_admin.php', olc_get_all_get_params(array('cid', 'action')) . 'cid=' . $cc_list['coupon_id']) . '">' . NEW_LINE;
            }
            $coupon_description_query = olc_db_query("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_list['coupon_id'] . "' and language_id = '" . SESSION_LANGUAGE_ID . APOS);
            $coupon_desc = olc_db_fetch_array($coupon_description_query);
            ?>
                <td class="dataTableContent"><?php 
            echo $coupon_desc['coupon_name'];
            ?>
</td>
                <td class="dataTableContent" align="center">
<?php 
            if ($cc_list['coupon_type'] == 'P') {
                echo $cc_list['coupon_amount'] . '%';
            } elseif ($cc_list['coupon_type'] == 'S') {
                echo TEXT_FREE_SHIPPING;
            } else {
                <td class="dataTableHeadingContent"><?php 
echo TABLE_HEADING_LAST_PAGE_URL;
?>
&nbsp;</td>
              </tr>
<?php 
$whos_online_query = olc_db_query("select customer_id, full_name, ip_address, time_entry, time_last_click, last_page_url, session_id from " . TABLE_WHOS_ONLINE);
while ($whos_online = olc_db_fetch_array($whos_online_query)) {
    $time_online = time() - $whos_online['time_entry'];
    if ((!$_GET['info'] || @$_GET['info'] == $whos_online['session_id']) && !$info) {
        $info = $whos_online['session_id'];
    }
    if ($whos_online['session_id'] == $info) {
        echo '              <tr class="dataTableRowSelected">' . NEW_LINE;
    } else {
        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_WHOS_ONLINE, olc_get_all_get_params(array('info', 'action')) . 'info=' . $whos_online['session_id'], NONSSL) . '">' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent"><?php 
    echo gmdate('H:i:s', $time_online);
    ?>
</td>
                <td class="dataTableContent" align="center"><?php 
    echo $whos_online['customer_id'];
    ?>
</td>
                <td class="dataTableContent"><?php 
    echo $whos_online['full_name'];
    ?>
</td>
                <td class="dataTableContent" align="center"><?php 
                }
            }
            $module_parameters_class = $module_parameters0 . $class;
            if ($is_object_mInfo_and_same_class) {
                if ($module->check() > 0) {
                    $main_content .= '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_MODULES, $module_parameters_class . $action_text . 'edit') . '">
';
                } else {
                    $main_content .= '              <tr class="dataTableRowSelected">
';
                }
            } else {
                $main_content .= '
              	<tr class="dataTableRow"
									onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'"
									onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_MODULES, $module_parameters_class) . '">
';
            }
            $s = $module->sort_order;
            $s = is_numeric($s) ? $module->sort_order : EMPTY_STRING;
            $main_content .= '
				          <td class="dataTableContent">' . $module->title . '</td>
									<td class="dataTableContent">' . str_replace(PHP, EMPTY_STRING, $file) . '</td>
	                <td class="dataTableContent" align="right">' . $s . HTML_NBSP . '</td>
	                <td class="dataTableContent" align="center">
';
            if ($is_object_mInfo_and_same_class) {
                $main_content .= $icon_arrow;
            } else {
                $main_content .= HTML_A_START . olc_href_link(FILENAME_MODULES, $module_parameters_class) . '">' . $icon_info . HTML_A_END;
            }
echo TABLE_HEADING_ACTION;
?>
&nbsp;</td>
		              </tr>
<?php 
$countries_query_raw = "select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " order by countries_name";
$countries_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $countries_query_raw, $countries_query_numrows);
$countries_query = olc_db_query($countries_query_raw);
while ($countries = olc_db_fetch_array($countries_query)) {
    if ((!$_GET['cID'] || @$_GET['cID'] == $countries['countries_id']) && !$cInfo && substr($_GET['action'], 0, 3) != 'new') {
        $cInfo = new objectInfo($countries);
    }
    if (is_object($cInfo) && $countries['countries_id'] == $cInfo->countries_id) {
        echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries['countries_id']) . '">' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent"><?php 
    echo $countries['countries_name'];
    ?>
</td>
                <td class="dataTableContent" align="center" width="40"><?php 
    echo $countries['countries_iso_code_2'];
    ?>
</td>
                <td class="dataTableContent" align="center" width="40"><?php 
    echo $countries['countries_iso_code_3'];
    ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    $zones_query = olc_db_query($zones_query_raw);
    while ($zones = olc_db_fetch_array($zones_query)) {
        if ((!$_GET['zID'] || @$_GET['zID'] == $zones['geo_zone_id']) && !$zInfo && substr($_GET['action'], 0, 3) != 'new') {
            $num_zones_query = olc_db_query("select count(*) as num_zones from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $zones['geo_zone_id'] . "' group by geo_zone_id");
            if (olc_db_num_rows($num_zones_query) > 0) {
                $num_zones = olc_db_fetch_array($num_zones_query);
                $zones['num_zones'] = $num_zones['num_zones'];
            } else {
                $zones['num_zones'] = 0;
            }
            $zInfo = new objectInfo($zones);
        }
        if (is_object($zInfo) && $zones['geo_zone_id'] == $zInfo->geo_zone_id) {
            echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zInfo->geo_zone_id . '&action=list') . '">' . NEW_LINE;
        } else {
            echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones['geo_zone_id']) . '">' . NEW_LINE;
        }
        ?>
                <td class="dataTableContent"><?php 
        echo HTML_A_START . olc_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones['geo_zone_id'] . '&action=list') . '">' . olc_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>&nbsp;' . $zones['geo_zone_name'];
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        if (is_object($zInfo) && $zones['geo_zone_id'] == $zInfo->geo_zone_id) {
            echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif');
        } else {
            echo HTML_A_START . olc_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $zones['geo_zone_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
        }
        ?>
&nbsp;</td>
              </tr>
                    $keys_extra[$module_keys[$j]]['description'] = constant($constant_name . '_DESC');
                }
                $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
                $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
            }
            $module_info['keys'] = $keys_extra;
            $mInfo = new objectInfo($module_info);
        }
        if (is_object($mInfo) && $class == $mInfo->code) {
            if ($module->check() > 0) {
                echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=' . $class . '&action=edit') . '">' . NEW_LINE;
            } else {
                echo '              <tr class="dataTableRowSelected">' . NEW_LINE;
            }
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=' . $class) . '">' . NEW_LINE;
        }
        ?>
                <td class="dataTableContent"><?php 
        echo $module->title;
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        if (is_object($mInfo) && $class == $mInfo->code) {
            echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif');
        } else {
            echo HTML_A_START . olc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=' . $class) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
        }
        ?>
&nbsp;</td>
              </tr>
                <td class="dataTableContent" onclick="javascript:<?php 
        olc_onclick_link(FILENAME_BACKUP, $onclick_link);
        ?>
"><?php 
        echo HTML_A_START . olc_href_link(FILENAME_BACKUP, 'action=download&file=' . $entry) . '">' . olc_image(DIR_WS_ICONS . 'file_download.gif', ICON_FILE_DOWNLOAD) . '</a>&nbsp;' . $entry;
        ?>
</td>
                <td class="dataTableContent" align="center" onclick="javascript:<?php 
        echo olc_onclick_link(FILENAME_BACKUP, $onclick_link);
        ?>
"><?php 
        echo date(PHP_DATE_TIME_FORMAT, filemtime(DIR_FS_BACKUP . $entry));
        ?>
</td>
                <td class="dataTableContent" align="right" onclick="javascript:<?php 
        echo olc_onclick_link(FILENAME_BACKUP, $onclick_link);
        ?>
"><?php 
        echo number_format(filesize(DIR_FS_BACKUP . $entry));
        ?>
 bytes</td>
                <td class="dataTableContent" align="right"><?php 
        if (is_object($buInfo) && $entry == $buInfo->file) {
            echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', '');
        } else {
            echo HTML_A_START . olc_href_link(FILENAME_BACKUP, 'file=' . $entry) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
        }
        ?>
&nbsp;</td>
              </tr>
<?php 
echo TABLE_HEADING_ACTION;
?>
&nbsp;</td>
              </tr>
<?php 
$products_vpe_query_raw = "select products_vpe_id, products_vpe_name from " . TABLE_PRODUCTS_VPE . " where language_id = '" . SESSION_LANGUAGE_ID . "' order by products_vpe_id";
$products_vpe_split = new splitPageResults($_GET['page'], '20', $products_vpe_query_raw, $products_vpe_query_numrows);
$products_vpe_query = olc_db_query($products_vpe_query_raw);
while ($products_vpe = olc_db_fetch_array($products_vpe_query)) {
    if ((!$oID || $oID == $products_vpe['products_vpe_id']) && !$oInfo && substr($action, 0, 3) != 'new') {
        $oInfo = new objectInfo($products_vpe);
    }
    if (is_object($oInfo) && $products_vpe['products_vpe_id'] == $oInfo->products_vpe_id) {
        echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_PRODUCTS_VPE, 'page=' . $_GET['page'] . '&oID=' . $oInfo->products_vpe_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_PRODUCTS_VPE, 'page=' . $_GET['page'] . '&oID=' . $products_vpe['products_vpe_id']) . '">' . NEW_LINE;
    }
    if ($default_products_vpe_id == $products_vpe['products_vpe_id']) {
        echo '                <td class="dataTableContent"><b>' . $products_vpe['products_vpe_name'] . LPAREN . TEXT_DEFAULT . ')</b></td>' . NEW_LINE;
    } else {
        echo '                <td class="dataTableContent">' . $products_vpe['products_vpe_name'] . '</td>' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent" align="right"><?php 
    if (is_object($oInfo) && $products_vpe['products_vpe_id'] == $oInfo->products_vpe_id) {
        echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', EMPTY_STRING);
    } else {
        echo HTML_A_START . olc_href_link(FILENAME_PRODUCTS_VPE, 'page=' . $_GET['page'] . '&oID=' . $products_vpe['products_vpe_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
    }
    ?>
&nbsp;</td>
              </tr>
<?php 
    $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . SESSION_LANGUAGE_ID . "' and p.products_id = s.products_id order by pd.products_name";
    $specials_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $specials_query_raw, $specials_query_numrows);
    $specials_query = olc_db_query($specials_query_raw);
    while ($specials = olc_db_fetch_array($specials_query)) {
        if ((!$sID || $sID == $specials['specials_id']) && !$sInfo) {
            $products_query = olc_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $specials['products_id'] . APOS);
            $products = olc_db_fetch_array($products_query);
            $sInfo_array = olc_array_merge($specials, $products);
            $sInfo = new objectInfo($sInfo_array);
        }
        if (is_object($sInfo) && $specials['specials_id'] == $sInfo->specials_id) {
            echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_SPECIALS, 'page=' . $page . '&sID=' . $sInfo->specials_id . '&action=edit') . '">' . NEW_LINE;
        } else {
            echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_SPECIALS, 'page=' . $page . '&sID=' . $specials['specials_id']) . '">' . NEW_LINE;
        }
        ?>
                <td  class="dataTableContent"><?php 
        echo $specials['products_name'];
        ?>
</td>
                <td  class="dataTableContent" align="right"><span class="oldPrice">
                <?php 
        echo olc_format_price($specials[$products_price_text], 1, 1);
        ?>
</span>
                <span class="specialPrice">
                <?php 
        echo olc_format_price($specials['specials_new_products_price'], 1, 1);
        ?>
            $customer_info = olc_array_merge($country, $info, $reviews);
            $cInfo_array = olc_array_merge($customers, $customer_info);
            $cInfo = new objectInfo($cInfo_array);
        }
        $tr_classname = 'dataTableRow';
        $td_classname = 'dataTableContent';
        if (is_object($cInfo) && $customers['customers_id'] == $cInfo->customers_id) {
            $params = $cInfo->customers_id . '&action=edit';
            $tr_classname .= 'Selected';
            $td_classname .= 'Selected';
            $linktext = olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', EMPTY_STRING);
        } else {
            $params = $customers['customers_id'];
            $linktext = HTML_A_START . olc_href_link(FILENAME_CUSTOMERS, olc_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
        }
        $display_text = '<tr class="' . $tr_classname . '" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_CUSTOMERS, olc_get_all_get_params(array('cID', 'action')) . 'cID=' . $params) . '">' . NEW_LINE;
        $COL_START = '<td class="' . $td_classname . '">';
        $COL_END = '</td>';
        $display_text = $display_text . $COL_START;
        if ($customers['account_type'] == 1) {
            $display_text .= TEXT_GUEST;
        } else {
            $display_text .= TEXT_ACCOUNT;
        }
        $display_text .= $COL_START . $customers['customers_lastname'] . $COL_END . $COL_START . $customers['customers_firstname'] . $COL_END . $COL_START . $customers_statuses_array[$customers['customers_status']]['text'] . LPAREN . $customers['customers_status'] . RPAREN . $COL_END . $COL_START . olc_date_short($info['date_account_created']) . $COL_END . '<td class="' . $td_classname . '" align="right">' . $linktext . '&nbsp;</td>';
        echo $display_text;
        ?>
		</tr>
		<?php 
    }
    ?>
    }
    $orders_query_raw = str_replace(HASH, $orders_query_raw, $orders_query_raw0);
    $page = $_GET['page'];
    $orders_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows);
    $orders_query = olc_db_query($orders_query_raw);
    while ($orders = olc_db_fetch_array($orders_query)) {
        if ((!$oID || $oID == $orders['orders_id']) && !$oInfo) {
            $oInfo = new objectInfo($orders);
        }
        if (is_object($oInfo) && $orders['orders_id'] == $oInfo->orders_id) {
            echo '              	<tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_ORDERS, olc_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . NEW_LINE;
            $selected = 'Selected"';
        } else {
            echo '              	<tr class="dataTableRow"
									onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'"
									onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_ORDERS, olc_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . NEW_LINE;
            $selected = '"';
        }
        if (is_object($oInfo) && $orders['orders_id'] == $oInfo->orders_id) {
            $link = olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', EMPTY_STRING);
        } else {
            $link = HTML_A_START . olc_href_link(FILENAME_ORDERS, olc_get_all_get_params(array('oID')) . 'oID=' . $orders['orders_id']) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
        }
        $selected_right = $selected . ' align="right">';
        $selected_center = $selected . ' align="center">';
        $col_end = '</td>';
        echo '
			<td class="dataTableContent' . $selected . '><a href="' . olc_href_link(FILENAME_ORDERS, olc_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['orders_id'] . '&action=edit') . '">' . olc_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $orders['customers_name'] . '</td>
            <td class="dataTableContent' . $selected_right . $orders['orders_id'] . $col_end . '
            <td class="dataTableContent' . $selected_right . strip_tags($orders['order_total']) . $col_end . '
            <td class="dataTableContent' . $selected . $selected_center . olc_datetime_short($orders['date_purchased']) . $col_end . '
    $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from " . TABLE_BANNERS . " order by banners_title, banners_group";
    $banners_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
    $banners_query = olc_db_query($banners_query_raw);
    while ($banners = olc_db_fetch_array($banners_query)) {
        $info_query = olc_db_query("select sum(banners_shown) as banners_shown, sum(banners_clicked) as banners_clicked from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banners['banners_id'] . APOS);
        $info = olc_db_fetch_array($info_query);
        if ((!$bID || $bID == $banners['banners_id']) && !$bInfo && substr($action, 0, 3) != 'new') {
            $bInfo_array = olc_array_merge($banners, $info);
            $bInfo = new objectInfo($bInfo_array);
        }
        $banners_shown = $info['banners_shown'] != EMPTY_STRING ? $info['banners_shown'] : '0';
        $banners_clicked = $info['banners_clicked'] != EMPTY_STRING ? $info['banners_clicked'] : '0';
        if (is_object($bInfo) && $banners['banners_id'] == $bInfo->banners_id) {
            echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_BANNER_STATISTICS, $page_parameter . '&bID=' . $bInfo->banners_id) . '">' . NEW_LINE;
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_BANNER_MANAGER, $page_parameter . '&bID=' . $banners['banners_id']) . '">' . NEW_LINE;
        }
        ?>
		<td class="dataTableContent"><?php 
        echo '<a href="javascript:popupImageWindow(\'' . FILENAME_POPUP_IMAGE . '?banner=' . $banners['banners_id'] . '\')">' . olc_image(DIR_WS_IMAGES . 'icon_popup.gif', 'View Banner') . '</a>&nbsp;' . $banners['banners_title'];
        ?>
</td>
		<td class="dataTableContent" align="right"><?php 
        echo $banners['banners_group'];
        ?>
</td>
		<td class="dataTableContent" align="right"><?php 
        echo $banners_shown . ' / ' . $banners_clicked;
        ?>
</td>
		<td class="dataTableContent" align="right">
echo TABLE_HEADING_ACTION;
?>
&nbsp;</td>
              </tr>
<?php 
$shipping_status_query_raw = "select shipping_status_id, shipping_status_name,shipping_status_image from " . TABLE_SHIPPING_STATUS . " where language_id = '" . SESSION_LANGUAGE_ID . "' order by shipping_status_id";
$shipping_status_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $shipping_status_query_raw, $shipping_status_query_numrows);
$shipping_status_query = olc_db_query($shipping_status_query_raw);
while ($shipping_status = olc_db_fetch_array($shipping_status_query)) {
    if ((!$_GET['oID'] || $_GET['oID'] == $shipping_status['shipping_status_id']) && !$oInfo && substr($_GET['action'], 0, 3) != 'new') {
        $oInfo = new objectInfo($shipping_status);
    }
    if (is_object($oInfo) && $shipping_status['shipping_status_id'] == $oInfo->shipping_status_id) {
        echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_SHIPPING_STATUS, 'page=' . $_GET['page'] . '&oID=' . $oInfo->shipping_status_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_SHIPPING_STATUS, 'page=' . $_GET['page'] . '&oID=' . $shipping_status['shipping_status_id']) . '">' . NEW_LINE;
    }
    if (DEFAULT_SHIPPING_STATUS_ID == $shipping_status['shipping_status_id']) {
        echo '<td class="dataTableContent" align="left">';
        if ($shipping_status['shipping_status_image'] != '') {
            echo olc_image(DIR_WS_ICONS . $shipping_status['shipping_status_image'], IMAGE_ICON_INFO);
        }
        echo '</td>';
        echo '                <td class="dataTableContent"><b>' . $shipping_status['shipping_status_name'] . LPAREN . TEXT_DEFAULT . ')</b></td>' . NEW_LINE;
    } else {
        echo '<td class="dataTableContent" align="left">';
        if ($shipping_status['shipping_status_image'] != '') {
            echo olc_image(DIR_WS_ICONS . $shipping_status['shipping_status_image'], IMAGE_ICON_INFO);
        }
        echo '</td>';
        echo '                <td class="dataTableContent">' . $shipping_status['shipping_status_name'] . '</td>' . NEW_LINE;
$manufacturers_query_raw = "select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from " . TABLE_MANUFACTURERS . " order by manufacturers_name";
$manufacturers_split = new splitPageResults($page, MAX_DISPLAY_SEARCH_RESULTS, $manufacturers_query_raw, $manufacturers_query_numrows);
$manufacturers_query = olc_db_query($manufacturers_query_raw);
$not_is_new = substr($action, 0, 3) != 'new';
while ($manufacturers = olc_db_fetch_array($manufacturers_query)) {
    $manufacturers_id = $manufacturers['manufacturers_id'];
    if ((!$mID || $mID == $manufacturers_id) && !$mInfo && $not_is_new) {
        $manufacturer_products_query = olc_db_query("select count(*) as products_count from " . TABLE_PRODUCTS . " where manufacturers_id = '" . $manufacturers_id . APOS);
        $manufacturer_products = olc_db_fetch_array($manufacturer_products_query);
        $mInfo_array = olc_array_merge($manufacturers, $manufacturer_products);
        $mInfo = new objectInfo($mInfo_array);
    }
    if (is_object($mInfo) && $manufacturers_id == $mInfo->manufacturers_id) {
        echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_MANUFACTURERS, $page_parameter . '&mID=' . $manufacturers_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_MANUFACTURERS, $page_parameter . '&mID=' . $manufacturers_id) . '">' . NEW_LINE;
    }
    ?>
                <td class="dataTableContent"><?php 
    echo $manufacturers['manufacturers_name'];
    ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    if (is_object($mInfo) && $manufacturers_id == $mInfo->manufacturers_id) {
        echo olc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif');
    } else {
        echo HTML_A_START . olc_href_link(FILENAME_MANUFACTURERS, $page_parameter . '&mID=' . $manufacturers_id) . '">' . olc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . HTML_A_END;
    }
    ?>
&nbsp;</td>
              </tr>
        $cPath = $products['categories_id'];
    }
    if ((!$pID && !$cID || @$pID == $products['products_id']) && !$pInfo && !$cInfo && $not_is_new) {
        // find out the rating average from customer reviews
        $reviews_query = olc_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = " . $products['products_id']);
        $reviews = olc_db_fetch_array($reviews_query);
        $pInfo_array = olc_array_merge($products, $reviews);
        $pInfo = new objectInfo($pInfo_array);
    }
    $is_selected = is_object($pInfo) && $products['products_id'] == $pInfo->products_id;
    $params = 'cPath=' . $cPath . '&pID=' . $products['products_id'];
    if ($is_selected) {
        $selected = 'Selected';
        //echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" >' . NEW_LINE;
        echo '
              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_CATEGORIES, $params . '&action=new_product') . '">' . NEW_LINE;
    } else {
        $selected = EMPTY_STRING;
        echo '
              <tr class="dataTableRow"
              	onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'"
								onmouseout="this.className=\'dataTableRow\'" >' . NEW_LINE;
    }
    $td_start = '<td class="dataTableContent' . $selected . '" ';
    $products_name = stripslashes($products['products_name']);
    $products_name = str_replace('\\', EMPTY_STRING, $products_name);
    echo $td_start . 'width="1">' . $products['products_sort'] . '</td>' . $td_start . '><a href="' . olc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id']) . '">' . olc_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '&nbsp;</a><a href="' . olc_href_link(FILENAME_CATEGORIES, $params) . '">' . $products_name . '</a>
	</td>';
    // check Produkt and attributes stock
    if ($cPath != EMPTY_STRING) {
        echo check_stock($products['products_id']);
                <table border="0" cellspacing="1" cellpadding="2" bgcolor="#999999">
                  <tr class="dataTableHeadingRow">
                    <td class="dataTableHeadingContent" width="75">Product id</td>
                    <td class="dataTableHeadingContent">Quickfind code</td>
                    <td class="dataTableHeadingContent">Product Name</td>
                    <td class="dataTableHeadingContent" nowrap="nowrap">Current Cross-Sells</td>
                    <td class="dataTableHeadingContent" colspan=2 nowrap="nowrap" align=center>Update
                      cross-sells</td>
                  </tr>
<?php 
    $num_of_products = sizeof($PRODUCTS_id);
    for ($i = 0; $i < $num_of_products; $i++) {
        /* now we will query the DB for existing related items */
        $query = "select b.products_name, a.xsell_id, c.products_model from " . TABLE_PRODUCTS_XSELL . " a," . TABLE_PRODUCTS_DESCRIPTION . " b," . TABLE_PRODUCTS . " c WHERE b.products_id = a.xsell_id and a.products_id ='" . $PRODUCTS_id[$i] . "' and b.products_id = c.products_id ORDER BY sort_order";
        list($related_items, $xsell_ids, $product_models) = general_db_conct($query);
        echo "\n\t<tr onmouseover=\"cOn(this); this.style.cursor='pointer'; this.style.cursor='hand';\" onmouseout=\"cOut(this);\" onclick=\"javascript:" . olc_onclick_link(FILENAME_XSELL_PRODUCTS, 'add_related_product_ID=' . $PRODUCTS_id[$i] . '&categories_id=' . $CATEGORIES_id . '&manufacturers_id=' . $MANUFACTURES_id, NONSSL) . "\">";
        $td = "<td class=\"dataTableContent\" valign=\"top\">&nbsp;";
        $td_end = "&nbsp;</td>\n";
        echo $td . $PRODUCTS_id[$i] . $td_end;
        echo $td . $PRODUCTS_model[$i] . $td_end;
        echo $td . $PRODUCTS_name[$i] . $td_end;
        if ($related_items) {
            echo "<td class=\"dataTableContent\"><ol>";
            for ($j = 0; $j < count($related_items); $j++) {
                echo '<li><strong>' . $product_models[$j] . '</strong> ' . $related_items[$j] . '</li>';
            }
            echo "</ol></td>\n";
        } else {
            echo "<td class=\"dataTableContent\">--</td>\n";
        }
        echo '<td class="dataTableContent" valign="top">&nbsp;<a href="' . olc_href_link(FILENAME_XSELL_PRODUCTS, 'add_related_product_ID=' . $PRODUCTS_id[$i] . '&categories_id=' . $CATEGORIES_id . '&manufacturers_id=' . $MANUFACTURES_id, NONSSL) . '">Edit</a>&nbsp;</td>';
    if ((!$lID || @$lID == $languages_id) && !$lInfo && $not_is_new) {
        $lInfo = new objectInfo($languages);
    }
    $lang_name = $languages['name'];
    $is_delete = true;
    $is_default_language = DEFAULT_LANGUAGE == $languages['code'];
    if (is_object($lInfo) && $languages_id == $lInfo->languages_id) {
        $content = '                  <tr class="dataTableRowSelected"
												onmouseover="this.style.cursor=\'hand\'"
												onclick="javascript:' . olc_onclick_link(FILENAME_LANGUAGES, $l_params . '&action=edit');
        $params = $l_params;
    } else {
        $content = '                  <tr class="dataTableRow"
													onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'"
													onmouseout="this.className=\'dataTableRow\'"
													onclick="javascript:' . olc_onclick_link(FILENAME_LANGUAGES, $l_params);
    }
    $content .= '">' . NEW_LINE;
    if ($is_default_language) {
        $content .= '                			<td class="dataTableContent"><b>' . $lang_name . LPAREN . TEXT_DEFAULT . RPAREN . HTML_B_END;
    } else {
        $content .= '			                <td class="dataTableContent">' . $lang_name;
    }
    echo $content . '</td>' . NEW_LINE;
    ?>
	              <td class="dataTableContent"><?php 
    echo $languages['code'];
    ?>
</td>
	              <td class="dataTableContent" align="right">
                	<?php 
$customers_status_show_price_tax_array = array(array('id' => '0', 'text' => ENTRY_NO), array('id' => '1', 'text' => ENTRY_YES));
$customers_status_discount_attributes_array = array(array('id' => '0', 'text' => ENTRY_NO), array('id' => '1', 'text' => ENTRY_YES));
$customers_status_add_tax_ot_array = array(array('id' => '0', 'text' => ENTRY_NO), array('id' => '1', 'text' => ENTRY_YES));
$customers_fsk18_array = array(array('id' => '0', 'text' => ENTRY_NO), array('id' => '1', 'text' => ENTRY_YES));
$customers_fsk18_display_array = array(array('id' => '0', 'text' => ENTRY_NO), array('id' => '1', 'text' => ENTRY_YES));
$customers_status_query_raw = "select *  from " . TABLE_CUSTOMERS_STATUS . " where language_id = '" . SESSION_LANGUAGE_ID . "' order by customers_status_id";
$customers_status_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_status_query_raw, $customers_status_query_numrows);
$customers_status_query = olc_db_query($customers_status_query_raw);
while ($customers_status = olc_db_fetch_array($customers_status_query)) {
    if ((!$_GET['cID'] || $_GET['cID'] == $customers_status['customers_status_id']) && !$cInfo && substr($_GET['action'], 0, 3) != 'new') {
        $cInfo = new objectInfo($customers_status);
    }
    if (is_object($cInfo) && $customers_status['customers_status_id'] == $cInfo->customers_status_id) {
        echo '<tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_CUSTOMERS_STATUS, 'page=' . $_GET['page'] . '&cID=' . $cInfo->customers_status_id . '&action=edit') . '">' . NEW_LINE;
    } else {
        echo '<tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_CUSTOMERS_STATUS, 'page=' . $_GET['page'] . '&cID=' . $customers_status['customers_status_id']) . '">' . NEW_LINE;
    }
    echo '<td class="dataTableContent" align="left">';
    if ($customers_status['customers_status_image'] != '') {
        echo olc_image(DIR_WS_ICONS . $customers_status['customers_status_image'], IMAGE_ICON_INFO);
    }
    echo '</td>';
    echo '<td class="dataTableContent" align="left">';
    echo olc_get_status_users($customers_status['customers_status_id']);
    echo '</td>';
    if ($customers_status['customers_status_id'] == DEFAULT_CUSTOMERS_STATUS_ID) {
        echo '<td class="dataTableContent" align="left"><b>' . $customers_status['customers_status_name'];
        echo LPAREN . TEXT_DEFAULT . RPAREN;
    } else {
        echo '<td class="dataTableContent" align="left">' . $customers_status['customers_status_name'];
    }
             $Pos1 = strpos($RequestURI, AMP, $Pos + strlen(PRODUCTS_MODEL));
             //Find parameter terminator
             if ($Pos1 == false) {
                 $Pos1 = strlen($RequestURI);
             }
             $ProductsModelString = substr($RequestURI, $Pos, $Pos1 - $Pos);
             $_Server['REQUEST_URI'] = str_replace($ProductsModelString, PRODUCTS_ID . EQUAL . $products_id, $RequestURI);
         }
         $chCounter_visible = 0;
         $chCounter_page_title = PRODUCTS_PAGE . $products_name;
         include FILENAME_CHCOUNTER;
     }
     //}
 }
 //	W. Kaiser	chCounter inclusion
 $pdf_link = olc_onclick_link(FILENAME_PRINT_PRODUCT_INFO, 'pop_up=true&' . $par_prod_id);
 if (INCLUDE_PDF_INVOICE) {
     $pdf_link = str_replace(strtolower(HTTPS), strtolower(HTTP), $pdf_link);
 }
 $products_print_link = 'javascript:ShowInfo(\'' . $pdf_link . '\', \'\')"';
 $products_print = olc_image(DIR_WS_ICONS . 'print.gif', PRINT_DATASHEET, 16, 16, $style . $products_print_link);
 $info_smarty->assign('PRODUCTS_PRINT', $products_print);
 $info_smarty->assign('PRODUCTS_PRINT_LINK', $products_print_link);
 $info_smarty->assign('PRODUCTS_PRINT_PDF', $pdf_print);
 /*
 $info_smarty->assign('PRODUCTS_CHEAPLY', HTML_A_START.
 olc_href_link(FILENAME_CHEAPLY_SEE, 'pID='.$products_id).'">'.TEXT_PRODUCTS_CHEAPLY.HTML_A_END);
 
 // $info_smarty->assign('ASK_PRODUCT_QUESTION', '<img src="templates/'.CURRENT_TEMPLATE.'/buttons/'.$_SESSION['language'].'/ask_a_question.gif" style="cursor:hand" onclick="javascript:window.open(\''.olc_href_link('ask_a_question.php?products_id='.$product->data['products_id']).'\', \'popup\', \'toolbar=0, width=630, height=550\')" alt="" />');
 		$info_smarty->assign('ASK_PRODUCT_QUESTION_LINK', '"#" onclick="javascript:window.open(\''.olc_href_link(FILENAME_ASK_PRODUCT_QUESTION, 'products_id='.$product->data['products_id']).'\', \'popup\', \'toolbar=0, width=630, height=550\'); return false";');
 */
            $reviews_text_query = olc_db_query("select r.reviews_read, r.customers_name, length(rd.reviews_text) as reviews_text_size from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . $reviews['reviews_id'] . "' and r.reviews_id = rd.reviews_id");
            $reviews_text = olc_db_fetch_array($reviews_text_query);
            $products_image_query = olc_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $reviews['products_id'] . APOS);
            $products_image = olc_db_fetch_array($products_image_query);
            $products_name_query = olc_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $reviews['products_id'] . "' and language_id = '" . SESSION_LANGUAGE_ID . APOS);
            $products_name = olc_db_fetch_array($products_name_query);
            $reviews_average_query = olc_db_query("select (avg(reviews_rating) / 5 * 100) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . $reviews['products_id'] . APOS);
            $reviews_average = olc_db_fetch_array($reviews_average_query);
            $review_info = olc_array_merge($reviews_text, $reviews_average, $products_name);
            $rInfo_array = olc_array_merge($reviews, $review_info, $products_image);
            $rInfo = new objectInfo($rInfo_array);
        }
        if (is_object($rInfo) && $reviews['reviews_id'] == $rInfo->reviews_id) {
            echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=preview') . '">' . NEW_LINE;
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews['reviews_id']) . '">' . NEW_LINE;
        }
        ?>
                <td class="dataTableContent"><?php 
        echo HTML_A_START . olc_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews['reviews_id'] . '&action=preview') . '">' . olc_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . olc_get_products_name($reviews['products_id']);
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo olc_image(DIR_WS_CATALOG_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif');
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
        echo olc_date_short($reviews['date_added']);
        ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    define('PRODUCTS_MODEL', 'products_model');
    $cPath = 'cPath';
    $equal = '=';
    // save current session data
    $old_session = $_SESSION;
    $index_php = 'index.php';
    $get_info = $_GET['info'];
    $date_format = 'H:i:s';
    $SQLSelect_Category = SELECT . "categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '#' and language_id='" . SESSION_LANGUAGE_ID . APOS;
    $SQLWhere = " where categories_id = '#' and language_id='" . SESSION_LANGUAGE_ID . APOS;
    $sessions_in_db = STORE_SESSIONS == 'mysql';
    $session_path = olc_session_save_path() . '/sess_';
    $whos_online_row0 = '
														onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'"
														onmouseout="this.className=\'dataTableRow\'"
														onclick="javascript:' . olc_onclick_link(FILENAME_WHOS_ONLINE, olc_get_all_get_params(array('info', 'action')) . 'info=#', NONSSL);
    $whos_online_row1 = '
					              <tr id="#" style="display:inline;" class="dataTableRow"';
    $selected = false;
    $new_visitors = EMPTY_STRING;
    $cart_total = 0;
    while ($whos_online = olc_db_fetch_array($whos_online_query)) {
        $session_id = $whos_online['session_id'];
        $time_online = $current_time - $whos_online['time_entry'];
        if ($is_periodic) {
            $info = $session_id;
        } else {
            if (!$get_info || !$info && $get_info == $session_id) {
                $info = $session_id;
            }
            $selected = $session_id == $info;
    $affiliate_banners_query_raw = "select * from " . TABLE_AFFILIATE_BANNERS . " order by affiliate_banners_title, affiliate_banners_group";
    $affiliate_banners_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $affiliate_banners_query_raw, $affiliate_banners_query_numrows);
    $affiliate_banners_query = olc_db_query($affiliate_banners_query_raw);
    while ($affiliate_banners = olc_db_fetch_array($affiliate_banners_query)) {
        $info_query = olc_db_query("select sum(affiliate_banners_shown) as affiliate_banners_shown, sum(affiliate_banners_clicks) as affiliate_banners_clicks from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banners['affiliate_banners_id'] . APOS);
        $info = olc_db_fetch_array($info_query);
        if ((!$_GET['abID'] || $_GET['abID'] == $affiliate_banners['affiliate_banners_id']) && !$abInfo && substr($_GET['action'], 0, 3) != 'new') {
            $abInfo_array = array_merge($affiliate_banners, $info);
            $abInfo = new objectInfo($abInfo_array);
        }
        $affiliate_banners_shown = $info['affiliate_banners_shown'] != '' ? $info['affiliate_banners_shown'] : '0';
        $affiliate_banners_clicked = $info['affiliate_banners_clicks'] != '' ? $info['affiliate_banners_clicks'] : '0';
        if (is_object($abInfo) && $affiliate_banners['affiliate_banners_id'] == $abInfo->affiliate_banners_id) {
            echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="javascript:' . olc_onclick_link(FILENAME_AFFILIATE_BANNERS, 'abID=' . $abInfo->affiliate_banners_id . '&action=new') . '">' . NEW_LINE;
        } else {
            echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="javascript:' . olc_onclick_link(FILENAME_AFFILIATE_BANNERS, 'abID=' . $affiliate_banners['affiliate_banners_id']) . '">' . NEW_LINE;
        }
        ?>
		<td class="dataTableContent"><?php 
        echo '<a href="javascript:popupImageWindow(\'' . FILENAME_AFFILIATE_POPUP_IMAGE . '?banner=' . $affiliate_banners['affiliate_banners_id'] . '\')">' . olc_image(DIR_WS_IMAGES . 'icon_popup.gif', ICON_PREVIEW) . '</a>&nbsp;' . $affiliate_banners['affiliate_banners_title'];
        ?>
</td>
		<td class="dataTableContent" align="right"><?php 
        if ($affiliate_banners['affiliate_products_id'] > 0) {
            echo $affiliate_banners['affiliate_products_id'];
        } else {
            echo HTML_NBSP;
        }
        ?>
</td>
		<td class="dataTableContent" align="right"><?php 
}
$customers_query_raw = "select c.customers_firstname, c.customers_lastname, sum(op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";
$customers_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);
// fix counted customers
$customers_query_numrows = olc_db_query("select customers_id from " . TABLE_ORDERS . " group by customers_id");
$customers_query_numrows = olc_db_num_rows($customers_query_numrows);
$customers_query = olc_db_query($customers_query_raw);
while ($customers = olc_db_fetch_array($customers_query)) {
    $rows++;
    if (strlen($rows) < 2) {
        $rows = '0' . $rows;
    }
    ?>
              <tr class="dataTableRow" onmouseover="this.className='dataTableRowOver';this.style.cursor='hand'"
									onmouseout="this.className='dataTableRow'" onclick="javascript:<?php 
    echo olc_onclick_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], NONSSL);
    ?>
">
                <td class="dataTableContent"><?php 
    echo $rows;
    ?>
.</td>
                <td class="dataTableContent"><?php 
    echo HTML_A_START . olc_href_link(FILENAME_CUSTOMERS, 'search=' . $customers['customers_lastname'], NONSSL) . '">' . $customers['customers_firstname'] . BLANK . $customers['customers_lastname'] . HTML_A_END;
    ?>
</td>
                <td class="dataTableContent" align="right"><?php 
    echo $currencies->format($customers['ordersum']);
    ?>
&nbsp;</td>
              </tr>