Re: hideCategories | Hiding Categories in Site Map & Customers who bought... Sections
After installing the mod, I noticed that there were a few places where my hidden categories were still showing (Site Map, Customers who bought this product also purchased...).
I haven't seen any posts for solutions to hiding in Site Map & Customers who bought... sections, so I thought I'd post my ideas. I use Zen-Cart 1.3.7 too, BTW.
Here's how I stopped the categories from showing in Site Map & individual products from w/in a hidden category from being shown in Customers who bought...
Customers who bought...
go to: /includes/classes/db/mysql/define_queries.php
and find the section that starts w/ DEFINE('SQL_ALSO_PURCHASED' and make it look like this:
Code:
DEFINE('SQL_ALSO_PURCHASED', "select p.products_id, p.products_image
from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, "
. TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p LEFT JOIN "
. TABLE_HIDE_CATEGORIES . " h ON (p.master_categories_id = h.categories_id)
where (h.visibility_status < 2 OR h.visibility_status IS NULL)
and opa.products_id = '%s'
and opa.orders_id = opb.orders_id
and opb.products_id != '%s'
and opb.products_id = p.products_id
and opb.orders_id = o.orders_id
and p.products_status = 1
group by p.products_id
order by o.date_purchased desc
limit " . MAX_DISPLAY_ALSO_PURCHASED);
Now for the Site Map
go to: /includes/classes/site_map.php
On or around line 37 (depending if you've edited this file before) & make sure it looks like this:
Code:
$categories_query = "select c.categories_id, cd.categories_name, c.parent_id
from " . TABLE_CATEGORIES . " c LEFT JOIN "
. TABLE_HIDE_CATEGORIES . " h ON (c.categories_id = h.categories_id), "
. TABLE_CATEGORIES_DESCRIPTION . " cd
where (h.visibility_status < 2 OR h.visibility_status IS NULL)
and c.categories_id = cd.categories_id
and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and c.categories_status != '0'
order by c.parent_id, c.sort_order, cd.categories_name";
These changes *should* work. Mileage may vary. Make a copy of these files & backup before editing them in case something looks screwy afterwords.
I hope this is useful to someone out there.
Re: hideCategories | Hiding Prev / Next Buttons in Hidden Categories
I also forgot something. After I made the changes I posted above, I still had an issue.
If you have more than one product in a hidden category, visitors who are able to view one of your 'hidden' products will be able to use the previous/next buttons at the top of the product page to browse to your other hidden products w/in that same category. Depending on your situation, this may be undesirable.
Of course, you could edit the listing template, but this might be destructive if you wanted to show the buttons later on down the road. This is a non-destructive alternative using the CSS stylesheet.
Hide the Previous Next Buttons
A simple CSS rule will fix it. This is useful if you have multiple products in a hidden category that you don't want customers to be able to browse to easily.
NOTE: This will also hide those buttons in every category throughout your site (hidden or not), so use wisely. You might be able to narrow it down to only affect certain pages, but not very easily, I don't think.
Go to: stylesheet.css in includes/templates/css/ and add a rule to your css:
Code:
.navNextPrevWrapper { display: none; }
The rule will hide the whole section from prying eyes, but still allow you to make it visible later if you so desire.
Hope this isn't too off-topic.