I would add a new function to build the limit to exclude upcoming products such as:
Code:
// build date range for upcoming products
function zen_get_upcoming_date_range_exclude() {
// 120 days; 24 hours; 60 mins; 60secs
$date_range = time();
$zc_new_date = date('Ymd', $date_range);
$new_range = ' and p.products_date_available <=' . $zc_new_date . '235959';
return $new_range;
}
You would need to customize the SQLs for the New Products and could use this:
$upcoming_exclude_display_limit = zen_get_upcoming_date_range_exclude();
and add the $upcoming_exclude_display_limit to the end of the SQL statements for the New Products ...
The reason for the function is to build a component for the WHERE condition that will be fast ...
For example, in the module for the new_products.php for the centerbox you can use:
Code:
$display_limit = zen_get_new_date_range();
// build date range for upcoming products
function zen_get_upcoming_date_range_exclude() {
// 120 days; 24 hours; 60 mins; 60secs
$date_range = time();
$zc_new_date = date('Ymd', $date_range);
// need to check speed on this for larger sites
// $new_range = ' and date_format(p.products_date_available, \'%Y%m%d\') >' . $zc_new_date;
$new_range = ' and p.products_date_available <=' . $zc_new_date . '235959';
return $new_range;
}
$upcoming_exclude_display_limit = zen_get_upcoming_date_range_exclude();
if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 " . $display_limit . $upcoming_exclude_display_limit;
Then change the other part of the IF
Code:
$productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit . $upcoming_exclude_display_limit);
NOTE: I would put the function in a file in the:
/includes/functions/extra_functions
so that you can use it for other things such as adapting it for the New Product Listing and sidebox ...
I have not tested everything on this but it should work ...
Bookmarks