Are you trying to get rid of the Advanced Search that you would get if you said to search for:
abc123
If so, why would you want to do that?
If I was searching for Apple but wrote in:
Appel
I would get nothing and think you had no Apple ...![]()
Are you trying to get rid of the Advanced Search that you would get if you said to search for:
abc123
If so, why would you want to do that?
If I was searching for Apple but wrote in:
Appel
I would get nothing and think you had no Apple ...![]()
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
That would be a real problem with the Advanced Search ...
It would be better to figure out what is really causing the issue on the Advanced Search on the Category dropdown ...
Is there anything to disable the Hidden Categories just to test it without that?
NOTE: I would really turn off the SEO/rewrites while trying to debug everything ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Just to amuse me ... can you turn off your templates and overrides for the file:
/includes/templates/your_template_dir/templates/tpl_advanced_search_default.php
by renaming it:
/includes/templates/your_template_dir/templates/tpl_advanced_search_default.php_TURNED_OFF
and see what happens on the Advanced Search ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
And you are sure that the original file:
/includes/templates/template_default/templates/tpl_advanced_search_default.php
is the original file for v1.3.9h without any changes?
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
More information.. As was pointed out previously by gazag, if one is using the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, the categories dropdown on the Advanced Search page will default to the last category on the dropdown list instead of "All Categories". Once I restore to the Zen Cart default for the includes/templates/custom_template/sideboxes/tpl_categories.php file, the dropdown defaults to "All Categories" as it should.. If I use the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, and then use the code posted by moosesoom, then all is right with the world..
Here is the relevant categories sidebox code if anyone is interested..
I just need to know if moosesoom's code is okay to use. It appears to fix the issue reported.. I just don't know what other "damage" it might do, and just need some feedback..Code:// Begin hideCategories code list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']); $mycid = split('_', $mycpath); $categories_id = array_pop($mycid); $hide_status = $db->Execute("select visibility_status FROM " . TABLE_HIDE_CATEGORIES . " WHERE categories_id = " . $categories_id . " LIMIT 1"); if ($hide_status->fields['visibility_status'] < 1) { // End hideCategories code switch(true) { // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday // uncomment the select below and set the cPath=3 to the cPath= your_categories_id // many variations of this can be done // case ($box_categories_array[$i]['path'] == 'cPath=3'): // $new_style = 'category-holiday'; // break; case ($box_categories_array[$i]['top'] == 'true'): $new_style = 'category-top'; break; case ($box_categories_array[$i]['has_sub_cat']): $new_style = 'category-subs'; break; default: $new_style = 'category-products'; } if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) { // skip if this is for the document box (==3) } else { $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">'; if ($box_categories_array[$i]['current']) { if ($box_categories_array[$i]['has_sub_cat']) { $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>'; } else { $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>'; } } else { $content .= $box_categories_array[$i]['name']; } if ($box_categories_array[$i]['has_sub_cat']) { $content .= CATEGORIES_SEPARATOR; } $content .= '</a>'; if (SHOW_COUNTS == 'true') { if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) { $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX; } } $content .= '<br />' . "\n"; } } } // hideCategories code
My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.
You asked if this code is safe to use, so I'm reviewing it from a coding perspective, not from whether it "works" or is the "best" way to do it. You said it works, so I won't concern myself with the functionality.
1. But the code *is* using the deprecated split() function, so the code will not work on PHP 5.3.0 or newer.
Those references to split() should be replaced with explode(). See more detail here: http://www.zen-cart.com/entry.php?2-...use-on-PHP-5-3
2. If there is no valid result returned from the query (again, only in the part of the code you had highlighted), you're triggering PHP Notices needlessly.
So, changing this line, by adding the part in bold, would be suggested:If you've got a lot of categories, then it would be smarter to rewrite your whole "read the hide-categories status from the db for each category one-by-one in real time" into "read all the hide-categories-table data into an array once and just do the lookup on that array" in order to minimize the amount of database queries you're triggering.Code:if (!$hide_status->EOF && $hide_status->fields['visibility_status'] < 1) {
But that's getting into optimization, instead of merely "will it work".
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Last edited by DivaVocals; 7 May 2013 at 05:42 PM.
My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.