<?php
/**
* tpl_page_2_default.php
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license
http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_page_2_default.php 3464 2006-04-19 00:07:26Z ajeh $
*/
?>
<div class="centerColumn" id="pageTwo">
<h1 id="pageTwoHeading"><?php echo HEADING_TITLE; ?></h1>
<div id="pageTwoMainContent" class="content">
<?php
/**
* load the html_define for the page_2 default
*/
require($define_page);
?>
<?php
$best_id = '8';
$best_sellers_category = "select categories_name from ". TABLE_CATEGORIES_DESCRIPTION ." where categories_id = '" . $best_id . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'";
$best_category = $db->Execute($best_sellers_category);
$best_category_id = $best_category->fields['categories_name'];
echo '<BR /><BR /><b>' . $best_category_id . '</b><br /><br />';
$best_sellers_query2 = "select distinct p.products_id, pd.products_name, p.products_ordered
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c
where p.products_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and p2c.categories_id = c.categories_id
and '". $best_id ."' in (c.categories_id, c.parent_id)
order by p.products_ordered desc, pd.products_name
limit 10";
$best_sellers2 = $db->Execute($best_sellers_query2);
$rows = 0;
while (!$best_sellers2->EOF) {
$rows++;
$bestsellers_list2[$rows]['id'] = $best_sellers2->fields['products_id'];
$bestsellers_list2[$rows]['name'] = $best_sellers2->fields['products_name'];
$best_sellers2->MoveNext();
}
for ($i=1; $i<=sizeof($bestsellers_list2); $i++) {
echo $content2 = $i . '. <a href="' . zen_href_link(zen_get_info_page($bestsellers_list2[$i]['id']), 'products_id=' . $bestsellers_list2[$i]['id']) . '">' . zen_trunc_string($bestsellers_list2[$i]['name'], '200', '...') . '</a><br />';
}
?>
<br /><br />
</div>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_BACK, BUTTON_BACK_ALT) . '</a>'; ?></div>
</div>