Contributions
Optimize categories box
It is common knowledge that displaying the numbers of products in the categories box (Configuration -> My Store -> Show Category Counts = true) generates a large numbers of queries.
This small contribution slashes the numbers of queries on the front page of the default installation of osCommerce from 83 to 43 (so about two per category, showing the number of products per category) by querying most of the information needed in two queries (total) and storing/retrieving the results in/from an object. It is also used to cut the number of queries for the categories box needed.
Expand All / Collapse All
The large number of queries you encounter in your shop when you have a lot of categories will also slow down your admin/categories.php page. Version 1.2 of this contribution addresses that (not completely, you would also need to install another contribution to really get to a minimum number, see the package).
Because the query to count the number of products can be resource intensive on a large site (see previous upload by 133t who by the way uses one wrong query in test.php skewing the results to be less favourable for this contribution) I added instructions to add a cache for that. This cache can be toggled and deleted in the admin but be used independently from the regular osC cache feature (so you can cache only this and not the categories, manufacturers and also purchased box).
For the "Hide products from customer groups for SPPC" where the regular osC cache could not be used because it is not specific for customer groups I added support for the customer group specific caching (with the exception of the manufacturers box, that not contains customer group specific queries). Also added are some bugfixes for this contribution (version 2.0.1 and below) that will be added to that contribution later (version 2.0.2).
This script is coded using the TEP API and should not require any modification to use. The intent is to allow a store owner to evaluate whether the contribution will help or hurt performance.
It is common knowledge that displaying the numbers of products in the categories box (Configuration -> My Store -> Show Category Counts = true) generates a large numbers of queries.
This small contribution slashes the numbers of queries on the front page of the default installation of osCommerce from 83 to 43 (so about two per category, showing the number of products per category) by querying most of the information needed in two queries (total) and storing/retrieving the results in/from an object. It is also used to cut the number of queries for the categories box needed.
Note: Contributions are used at own risk.