Specific Category Drop Down

To set up a category drop down box that only shows a certain category:

Version 2.72/2.81:

  1. In your page template, make sure that you have the category drop down box selected. This would be %CATEGORY_DROPDOWN% if you're using the Templates area of the admin section, or if you are modifying the template page directly.

  2. Open the categories.php page in the /enc/ folder, and change the line:

    setcategories(0, 0, 0, "  ", "- ", "[%%INDENT%%][%%CATEGORY%%]", "dropcat", 0, 0, "", "yes", "no", "no");

    to:

    setcategories(27, 0, 0, "  ", "- ", "[%%INDENT%%][%%CATEGORY%%]", "dropcat", 0, 0, "", "yes", "no", "no");

    where 27 is the ID number of the main category you want to display in the drop down box. (You can find this by navigating through the catalog until you view that category, then noting the category ID number that appears in the URL box of your browser.)

Note: This modification will only show the subcategories listed under the category ID you set above. It will not show the category itself.

Version 2.55:

  1. In your page template, make sure that you have the category drop down box selected. This would be %CATEGORY_DROPDOWN% if you're using the Templates area of the admin section, orif you are modifying the template page directly.

  2. Open the categories.php page in the /enc/ folder, and find the line

    $getcatquery = "SELECT Category, ID FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active <> 'No' ORDER BY CatOrder, Category";

    and change it to:

    $getcatquery = "SELECT Category, ID FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active <> 'No' AND ID='27' ORDER BY CatOrder, Category";

    where 27 is the ID number of the main category you want to display in the drop down box. (You can find this by navigating through the catalog until you view that category, then noting the category ID number that appears in the URL box of your browser.)

  3. Remove the line:

    echo "Select Category";

    by adding two forward slashes:

    // echo "Select Category";
  4. (Optional) If you do *not* want to show the main category in the drop down box (ie. you only want to display subcategories), add two forward slashes to the line

    echo "$display";

    so you'd have:

    // echo "$display";

    Otherwise, leave it as is.

  5. (Optional) If you want to remove the dashes that come in front of subcategories, find the line

    echo " - $subdisplay";

    and remove the - part, so you'd have:

    echo "$subdisplay"; 

    then find the line:

    echo "     - $enddisplay";

    and again remove the non break tags and dashes, so you'd have:

    echo "$enddisplay"; 

You can also change that to use your own set of characters if you want. The first line is the first level subcategory, while the second line is the second level subcategory that will appear under first level subcategories.