Wholesale-Only Categories
Version 2.81 and higher allows you to specify items or categories as 'wholesale only'. In versions 2.8x, add a keyword to the SB_WSONLY_VAL constant in the config.php file in the /sbconf/ folder, then use that word in the Keyword field of any item or category that you want to show as wholesale only. In versions 2.9x, set the category 'Display' field to 'WS Only'.
In versions 2.81 through 2.83, the main category display that appears when you select 'Category List' in the 'Show Products' field of the index or catalog page will show all categories, regardless of whether they are wholesale only or not. To disable wholesale only categories in this area, open the products_maincat.php file in the /enc/ folder, and add:
// RETAIL ONLY
if (defined('SB_WSONLY_VAL') AND SB_WSONLY_VAL != '' AND (!$wspass OR !$wsemail OR $wsnum != 1))
$maincatquery .= " AND Keywords NOT LIKE '%" .SB_WSONLY_VAL ."%'";
just above the line:
$maincatquery .= "AND Active='Yes' ORDER BY CatOrder, Category";
In earlier versions, if you want to make a category wholesale only, you can modify the code as follows:
-
Open the catalog.php page in the /enc/ folder, and find the line:
$offset = (($LimitOfItems * $page)-$LimitOfItems);
-
Just *below* that line, type:
// RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $searchquery .= " AND Keywords NOT LIKE '%wholesale%'";
-
VERSION 2.55 ONLY:
-
Open the navbar_bar.php, navbar_horizontal.php, navbar_table.php, navbar_tabs.php and navbar_vertical.php pages in the /enc/ folder, and:
-
Change the line:
$categoryquery = "SELECT Category, Image, ID FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active = 'Yes' ORDER BY CatOrder, Category";
to:
$categoryquery = "SELECT Category, Image, ID FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active = 'Yes' "; // RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $categoryquery .= "AND Keywords NOT LIKE '%wholesale%' "; $categoryquery .= "ORDER BY CatOrder, Category";
-
Open the products_maincat.php file in the /enc/ folder, and add:
// RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $maincatquery .= " AND Keywords NOT LIKE '%wholesale%'";
just above the line:
$maincatquery .= "AND Active='Yes' ORDER BY CatOrder, Category";
VERSION 2.62 ONLY:
-
Open the navbar_bar.php, navbar_horizontal.php, navbar_table.php, navbar_tabs.php and navbar_vertical.php pages in the /enc/ folder
-
Change the line:
$categoryquery = "SELECT Category, Image, ID, Keywords FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active = 'Yes' ORDER BY CatOrder, Category";
to:
$categoryquery = "SELECT Category, Image, ID, Keywords FROM " .$DB_Prefix ."_categories WHERE Parent = '' AND Active = 'Yes' "; // RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $categoryquery .= "AND Keywords NOT LIKE '%wholesale%' "; $categoryquery .= "ORDER BY CatOrder, Category";
-
Open the products_maincat.php file in the /enc/ folder, and add:
// RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $maincatquery .= " AND Keywords NOT LIKE '%wholesale%'";
just above the line:
$maincatquery .= "AND Active='Yes' ORDER BY CatOrder, Category";
VERSION 2.7 ONLY:
-
Open the openinfo.php page in the /enc/ folder and just above the lines:
// Check Wholesale if ($wspass AND $wsemail) {add:
$wsnum = 0;
If it does not already exist. (Note: This particular line - setting the initial wsnum variable to zero - will be included in the final 2.7 files.)
-
Open the stconfig.php page and just above the lines:
echo $set_dispval;
add:
global $wsnum, $curdr; if (str_replace("wholesale", "", $catrow[Keywords]) == $catrow[Keywords] OR $wsnum == 1 OR $curdr == SB_ADM_DIR) -
Open the products_maincat.php page in the /enc/ folder, and just above the line:
$maincatquery .= "AND Active='Yes' ORDER BY CatOrder, Category";
add the lines:
// RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $maincatquery .= "AND Keywords NOT LIKE '%wholesale%' ";
-
Open the products_maincat.php file in the /enc/ folder, and add:
// RETAIL ONLY if (!$wspass OR !$wsemail OR $wsnum != 1) $maincatquery .= " AND Keywords NOT LIKE '%wholesale%'";
just above the line:
$maincatquery .= "AND Active='Yes' ORDER BY CatOrder, Category";
-
-
Save all of these modified files. Then, in your store administration area, add the word:
wholesale
into the Keywords box for every item and category that is to be displayed only to wholesalers.