Permalink
Browse files

Precount $category_links and $column_list for performance

  • Loading branch information...
acidvertigo committed Aug 14, 2011
1 parent 49bfc28 commit 4d754cf9aa21c4d1ad1c576ad0ee886e53caa841
Showing with 4 additions and 3 deletions.
  1. +4 −3 catalog/index.php
View
@@ -49,7 +49,8 @@
if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
$category_links = array_reverse($cPath_array);
- for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
+ $n=sizeof($category_links);
+ for($i=0;$i<$n; $i++) {
$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
$categories = tep_db_fetch_array($categories_query);
if ($categories['total'] < 1) {
@@ -111,8 +112,8 @@
}
$select_column_list = '';
-
- for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
+ $n=sizeof($column_list);
+ for ($i=0; $i<$n; $i++) {
switch ($column_list[$i]) {
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';

0 comments on commit 4d754cf

Please sign in to comment.