Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_count_products_in_category, optimization?


tagin

Recommended Posts

Hello,

 

I am optimizing my store and thanks to this board I went down from 1.5s-2s page load time to 0.100-0.120.

 

I still see the following though:

 

[18] => select categories_id from categories where parent_id = '2'

[19] => select categories_id from categories where parent_id = '18'

[20] => select categories_id from categories where parent_id = '19'

[21] => select categories_id from categories where parent_id = '20'

 

Since I got the get-path optimization I believe that it comes from general.php

function tep_count_products_in_category

 

Are there any optimizations for this function readily available? The OSC cache feature doesn't caches the results .

 

thank you!

Link to comment
Share on other sites

Hello,

 

I am optimizing my store and thanks to this board I went down from 1.5s-2s page load time to 0.100-0.120.

 

I still see the following though:

 

[18] => select categories_id from categories where parent_id = '2'

[19] => select categories_id from categories where parent_id = '18'

[20] => select categories_id from categories where parent_id = '19'

[21] => select categories_id from categories where parent_id = '20'

 

Since I got the get-path optimization I believe that it comes from general.php

function tep_count_products_in_category

 

Are there any optimizations for this function readily available? The OSC cache feature doesn't caches the results .

 

thank you!

In your admin->configuration set 'Show Category Counts' to false

Link to comment
Share on other sites

  • 5 months later...

A quick optimization I did, and it seems to work is:

 

  $products_query = tep_db_query("select count(*) as total from (" . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ON p.products_id = p2c.products_id and p.products_status = '1'), " . TABLE_CATEGORIES . " c WHERE c.categories_id = p2c.categories_id and c.parent_id = '" . (int)$category_id . "'");

 

I know this is an old thread, but anyhow, there you have it.

 

I have about 9 thousand products and 300 categories in my shop, so it took a while the old way :P

Insert clever remark here

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...