Kes Posted July 11, 2005 Share Posted July 11, 2005 I have a lot of categories in my shop and it is taking a very long time to load 7+ s or it is just hanging. I have turned off category coung in admin and have added the bebug module. These are some of the results i am getting [0] => select configuration_key as cfgKey, configuration_value as cfgValue from configuration [1] => select value from sessions where sesskey = 'b5eb82c91dc5f48e42ca0fc98413a837' and expiry > '1121118902' [2] => select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currencies [3] => select languages_id, name, code, image, directory from languages order by sort_order [4] => delete from whos_online where time_last_click < '1121118002' [5] => select count(*) as count from whos_online where session_id = 'b5eb82c91dc5f48e42ca0fc98413a837' [6] => insert into whos_online (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('0', 'Guest', 'b5eb82c91dc5f48e42ca0fc98413a837', '220.253.89.243', '1121118902', '1121118902', '/~suzispor/suziShop/') [7] => select banners_id, date_scheduled from banners where date_scheduled != '' [8] => select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from banners b, banners_history bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id [9] => select specials_id from specials where status = '1' and now() >= expires_date and expires_date > 0 [10] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [11] => select count(*) as count from categories where parent_id = '4287' [12] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '4287' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [13] => select count(*) as count from categories where parent_id = '4288' [14] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '4288' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [15] => select count(*) as count from categories where parent_id = '4289' [16] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '4289' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [17] => select count(*) as count from categories where parent_id = '4290' [18] => select count(*) as count from categories where parent_id = '4291' [19] => select count(*) as count from categories where parent_id = '4292' [20] => select count(*) as count from categories where parent_id = '4293' [21] => select count(*) as count from categories where parent_id = '4294' [22] => select count(*) as count from categories where parent_id = '4295' [23] => select count(*) as count from categories where parent_id = '4296' [24] => select count(*) as count from categories where parent_id = '4297' [25] => select count(*) as count from categories where parent_id = '4298' [26] => select count(*) as count from categories where parent_id = '4299' [27] => select count(*) as count from categories where parent_id = '4300' [28] => select count(*) as count from categories where parent_id = '4301' [29] => select count(*) as count from categories where parent_id = '4302' [30] => select count(*) as count from categories where parent_id = '4303' [31] => select count(*) as count from categories where parent_id = '4304' [32] => select count(*) as count from categories where parent_id = '4305' [33] => select count(*) as count from categories where parent_id = '4306' [34] => select count(*) as count from categories where parent_id = '4307' [35] => select count(*) as count from categories where parent_id = '4308' [36] => select count(*) as count from categories where parent_id = '4309' [37] => select count(*) as count from categories where parent_id = '4310' [38] => select count(*) as count from categories where parent_id = '4311' [39] => select count(*) as count from categories where parent_id = '4312' [40] => select count(*) as count from categories where parent_id = '4313' [41] => select count(*) as count from categories where parent_id = '4314' [42] => select count(*) as count from categories where parent_id = '4315' [43] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '4315' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name [44] => select count(*) as count from categories where parent_id = '4316' [45] => select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where c.parent_id = '4316' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name All together it is running over 4000 queries. Does anybody know where how??? i remove the code that is "select count(*) as count from categories where parent_id =" or is it need. I appreciate any suggestions/ advice. thanks Kes Link to comment Share on other sites More sharing options...
Guest Posted July 11, 2005 Share Posted July 11, 2005 most likely your server, how about posting a link there? Link to comment Share on other sites More sharing options...
Kes Posted July 11, 2005 Author Share Posted July 11, 2005 most likely your server, how about posting a link there? <{POST_SNAPBACK}> Thanks for looking at it. http://202.60.67.177/~suzispor/suziShop/ Link to comment Share on other sites More sharing options...
dburchm1 Posted July 11, 2005 Share Posted July 11, 2005 Wow, you are right about the store hanging. I don't know is that is what is causing it. I guess you can play with it and see. I think what you are looking for is in includes/boxes/categories.php tep_count_products_in_category and includes/functions/general.php around line 300 ////// Return the number of products in a category // TABLES: products, products_to_categories, categories function tep_count_products_in_category($category_id, $include_inactive = false) { $products_count = 0; if ($include_inactive == true) { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$category_id . "'"); } else { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'"); } $products = tep_db_fetch_array($products_query); $products_count += $products['total']; $child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'"); if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { $products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive); } } return $products_count; } Good luck!! Link to comment Share on other sites More sharing options...
Kes Posted July 12, 2005 Author Share Posted July 12, 2005 Wow, you are right about the store hanging. I don't know is that is what is causing it. I guess you can play with it and see. I think what you are looking for is in includes/boxes/categories.php and includes/functions/general.php around line 300 Good luck!! <{POST_SNAPBACK}> Solved probem! i had added the cat tree module. All is working quickly now but unfortunately my client really wanted the cat tree look and feel. thanks to those that helped. cheers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.