Totally Zenned
- Join Date:
- Aug 2007
- Location:
- Gijón, Asturias, Spain
- Posts:
- 2,875
- Plugin Contributions:
- 7
Product Finder: multiple category drop-downs
Ok, so I didn't get around to uploading a new version as life got in the way/ I have a business to run...
Meanwhile recently I started to get mysql out of memory errors due to this mod...so I have had to understand more how it works.
I found that when the page first loads it checks through all the the categories and subcategories to see if there are enabled products in there before generating the initial drop down list. For me this is unecessary so after stopping this I reduced the average queries on pageload from 3800 to 200!!!
While I have done other minor things to improve this mod, I still want to improve the code and the documentation to enable people to customise it easier so pm me for the current version if you want to be a guinea pig.
Meanwhile you can try this simple change to reduce the queries (enable the page parse time first to see the difference), and see if it still works for you in your implementation.
In the functions/product_finder.php, find this bit:
while (!$categories->EOF) {
if (zen_products_in_category_count($categories->fields['categories_id'], true, true) >= 1) {
$category_tree_array[] = array('id' => $categories->fields['categories_id'], 'text' => $categories->fields['categories_name']);
}
$categories->MoveNext();
and comment out the if clause to stop it running the function zen_products_in_category_count:
while (!$categories->EOF) {
// if (zen_products_in_category_count($categories->fields['categories_id'], true, true) >= 1) {
$category_tree_array[] = array('id' => $categories->fields['categories_id'], 'text' => $categories->fields['categories_name']);
//}
$categories->MoveNext();
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...