Add additional categories per item
The following FAQ is only applicable to version 2.72. As of version 2.8, you can assign up to 15 categories per item.
The Site Builder system allows only five categories to be assigned to any one item. If you'd like to change this, you will need to modify the system. The following gives you an additional four categories, but you can continue to adjust as needed:
-
In phpMyAdmin, select the opc_items table and choose the SQL tab. Enter the code:
ALTER TABLE `opc_items` ADD `Category6` SMALLINT NOT NULL, ADD `Category7` SMALLINT NOT NULL, ADD `Category8` SMALLINT NOT NULL, ADD `Category9` SMALLINT NOT NULL;
-
In the /enc/openinfo.php file, change the line:
$ctsearchquery = " AND (Category1='$category' OR Category2='$category' OR Category3='$category' OR Category4='$category' OR Category5='$category')";
to:
$ctsearchquery = " AND (Category1='$category' OR Category2='$category' OR Category3='$category' OR Category4='$category' OR Category5='$category' OR Category6='$category' OR Category7='$category' OR Category8='$category' OR Category9='$category')";
-
In the /storeadmin/categories.php file, change the line:
$getcatquery = "SELECT ID, Item, Catalog FROM " .SB_DB_PREFIX ."_items WHERE Category1 = '$catid' OR Category2 = '$catid' OR Category3 = '$catid' OR Category4 = '$catid' OR Category5 = '$catid' ORDER BY Item, Catalog"
to:
$getcatquery = "SELECT ID, Item, Catalog FROM " .SB_DB_PREFIX ."_items WHERE Category1 = '$catid' OR Category2 = '$catid' OR Category3 = '$catid' OR Category4 = '$catid' OR Category5 = '$catid' OR Category6 = '$catid' OR Category7 = '$catid' OR Category8 = '$catid' OR Category9 = '$catid' ORDER BY Item, Catalog";
-
In the /storeadmin/global.php file, change the line:
$delquery .= " AND (Category1='$catid' OR Category2='$catid' OR Category3='$catid'"; $delquery .= " OR Category4='$catid' OR Category5='$catid')";
to:
$delquery .= " AND (Category1='$catid' OR Category2='$catid' OR Category3='$catid' OR Category4='$catid' OR Category5='$catid' OR Category6='$catid' OR Category7='$catid' OR Category8='$catid' OR Category9='$catid')";
and change:
$catquer = "Category1='$category' OR Category2='$category' OR Category3='$category' "; $catquer .= "OR Category4='$category' OR Category5='$category'";
to:
$catquer = "Category1='$category' OR Category2='$category' OR Category3='$category' OR Category4='$category' OR Category5='$category' OR Category6='$category' OR Category7='$category' OR Category8='$category' OR Category9='$category'";
and change:
$itemsquery .= " AND (Category1='$catid' OR Category2='$catid' OR Category3='$catid'"; $itemsquery .= " OR Category4='$catid' OR Category5='$catid')";
to:
$itemsquery .= " AND (Category1='$catid' OR Category2='$catid' OR Category3='$catid' OR Category4='$catid' OR Category5='$catid' OR Category6='$catid' OR Category7='$catid' OR Category8='$catid' OR Category9='$catid')";
-
In the /storeadmin/itemlist.php file, change the lines:
$itemquery .= " AND (Category1='$catsearch' OR Category2='$catsearch'"; $itemquery .= " OR Category3='$catsearch' OR Category4='$catsearch'"; $itemquery .= " OR Category5='$catsearch'";
to:
$itemquery .= " AND (Category1='$catsearch' OR Category2='$catsearch' OR Category3='$catsearch' OR Category4='$catsearch' OR Category5='$catsearch' OR Category6='$catsearch' OR Category7='$catsearch' OR Category8='$catsearch' OR Category9='$catsearch'";
and change:
$itemquery .= " OR Category1='$subrow[1]' OR Category2='$subrow[1]' OR Category3='$subrow[1]'"; $itemquery .= "OR Category4='$subrow[1]' OR Category5='$subrow[1]'";
to:
$itemquery .= " OR Category1='$subrow[1]' OR Category2='$subrow[1]' OR Category3='$subrow[1]' OR Category4='$subrow[1]' OR Category5='$subrow[1]' OR Category6='$subrow[1]' OR Category7='$subrow[1]' OR Category8='$subrow[1]' OR Category9='$subrow[1]'";
and change:
$itemquery .= " OR Category1='$endrow[1]' OR Category2='$endrow[1]' OR Category3='$endrow[1]'"; $itemquery .= "OR Category4='$endrow[1]' OR Category5='$endrow[1]'";
to:
$itemquery .= " OR Category1='$endrow[1]' OR Category2='$endrow[1]' OR Category3='$endrow[1]' OR Category4='$endrow[1]' OR Category5='$endrow[1]' OR Category6='$endrow[1]' OR Category7='$endrow[1]' OR Category8='$endrow[1]' OR Category9='$endrow[1]'";
-
In the /storeadmin/items.php file, add the lines (in two places):
$cat6 = $getitemrow[Category6]; $cat7 = $getitemrow[Category7]; $cat8 = $getitemrow[Category8]; $cat9 = $getitemrow[Category9];
after the line:
$cat5 = $getitemrow[Category5];
and change:
Assign up to 5 categories to this item.
to:
Assign up to 9 categories to this item.
and change:
for ($ci=1; $ci <= 5; ++$ci)
to:
for ($ci=1; $ci <= 9; ++$ci)
-
In the /storeadmin/options.php file, change the line:
$insitemquery .= "Category3, Category4, Category5, Keywords, DiscountPr, Wholesale, MetaTitle, ";
to:
$insitemquery .= "Category3, Category4, Category5, Category6, Category7, Category8, Category9, Keywords, DiscountPr, Wholesale, MetaTitle, ";
and change the line:
$insitemquery .= "'$category1', '$category2', '$category3', '$category4', '$category5', ";
to:
$insitemquery .= "'$category1', '$category2', '$category3', '$category4', '$category5', '$category6', '$category7', '$category8', '$category9', ";
and change the line:
$upditemquery .= "Category3='$category3', Category4='$category4', Category5='$category5', ";
to:
$upditemquery .= "Category3='$category3', Category4='$category4', Category5='$category5', Category6='$category6', Category7='$category7', Category8='$category8', Category9='$category9', ";
-
In the /storeadmin/wholesale.php file, change the line:
$catquery = "(Category1='$appwscat' OR Category2='$appwscat' OR Category3='$appwscat' OR Category4='$appwscat' OR Category5='$appwscat')";
to:
$catquery = "(Category1='$appwscat' OR Category2='$appwscat' OR Category3='$appwscat' OR Category4='$appwscat' OR Category5='$appwscat' OR Category6='$appwscat' OR Category7='$appwscat' OR Category8='$appwscat' OR Category9='$appwscat')";