Just something we noticed from our v2 website,
The catagories pages by default have sorting up the top right for
bestseller
price
alphabetically
popularity
popularity and bestseller send huge mysql queries through the database, and on a busy website will slow the website down, there are huge joins if there is a large quanity or projects, and seems to look up all previous sales in the database
solution, either comment out template file
skins/basic/customer/views/products/components/sorting.tpl
or… edit
core/fn.catalog.php
around line
3809
function fn_get_products_sorting($simple_mode = true)
{
$sorting = array(
‘position’ => array(‘description’ => fn_get_lang_var(‘default’), ‘default_order’ => ‘asc’),
‘product’ => array(‘description’ => fn_get_lang_var(‘name’), ‘default_order’ => ‘asc’)
// COMMENT OUT THE BELOW 2 LINES, and remove the comma from end of above line
// ‘price’ => array(‘description’ => fn_get_lang_var(‘price’), ‘default_order’ => ‘asc’),
// ‘popularity’ => array(‘description’ => fn_get_lang_var(‘popularity’), ‘default_order’ => ‘desc’)
);
fn_set_hook(‘products_sorting’, $sorting);
if ($simple_mode) {
foreach ($sorting as &$sort_item) {
$sort_item = $sort_item[‘description’];
}
}
return $sorting;
}
Hope this helps
Why wouldn't you just use the 'products_sorting' hook to change the sorting to whatever you wanted to rather than modifying the core code? That's the point of the fn_set_hook being there…