View Single Post
  #45  
Old 12-02-2005, 10:32 AM
  More-Japan's Avatar 
More-Japan More-Japan is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 107
 

Default Hidden Categories for 4.0.17

Here is the code that I have been able to successfully use on my fresh install of 4.0.17. Some of the code and file locations are different on 4.0.17, but it seems to be stable-- search is functioning properly, as well as HTML catalog, etc.

I'm not a programmer, but understand the logic.. so if there is anything left out, best left to the pros.

This is a great mod that should have been integrated into the cart from the beginning.


Change include/categories.php
There are two instances of code that need to be changed:
This makes the newly added 'Hidden' option get translated as an 'Available' item


Instance 1:

Change:
Code:
$search_condition[] = "$sql_tbl[categories].avail='Y'";
To:
Code:
$search_condition[] = "$sql_tbl[categories].avail='Y' OR $sql_tbl[categories].avail='H'";

Instance 2:

Change:
Code:
$search_condition = "AND avail='Y' AND (membership='".addslashes($user_account["membership"])."' OR membership='')";

To:
Code:
$search_condition = "AND avail='Y' OR $sql_tbl[categories].avail='H' AND (membership='".addslashes($user_account["membership"])."' OR membership='')";



Change skin1/admin/main/category_modify.tpl
This adds the option to the backend admin


Find this code:
Code:
<SELECT name="avail"> <OPTION value='Y' {if ($current_category.avail eq 'Y')} selected {/if}>{$lng.lbl_enabled}</OPTION> <OPTION value='N' {if ($current_category.avail eq 'N')} selected {/if}>{$lng.lbl_disabled}</OPTION>

And add this to the bottom:
Code:
<OPTION value='H' {if ($current_category.avail eq 'H')} selected {/if}>{$lng.lbl_hidden}</OPTION>



Change /skin1/customer/categories.tpl
This tells the cart to hide the 'Hidden' categories from the lefthand category nav.


Change:
Code:
<FONT class="CategoriesList">{$categories[cat_num].category}</FONT>

To:
Code:
{if $categories[cat_num].avail ne "H"}<FONT class="CategoriesList">{$categories[cat_num].category}</FONT> {/if}


There is a second instance of this code 2 lines down that looks similar, but not sure if it is necessary, since it is for the subcategories.
__________________
Version 5.2.13

http://www.more-japan.com/
Reply With Quote