<?php
/**
 * @package Genesis
 * @copyright Copyright 2012 - 2015 Sammycorp
 * @author Sammycorp
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */

$limit = " LIMIT " . (int)3;
$display_limit = zen_get_new_date_range();
$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
                                            p.master_categories_id
                         from (" . TABLE_PRODUCTS . " p
                         left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                         where p.products_id = pd.products_id
                         and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                         and p.products_status = 1 " . $display_limit;
$random_whats_new_sidebox_product_query .= $limit;
//  $random_whats_new_sidebox_product = zen_random_select($random_whats_new_sidebox_product_query);
$random_whats_new_sidebox_product = $db->ExecuteRandomMulti($random_whats_new_sidebox_product_query, MAX_RANDOM_SELECT_NEW);

if ($random_whats_new_sidebox_product->RecordCount() > 0 ) {
  $title =  BOX_HEADING_WHATS_NEW;
  require($template->get_template_dir('tpl_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'footer'). '/tpl_whats_new.php');
}
