Items are assigned to a subcategory when that subcategory is added to an existing category (v. 2.72)

In previous SiteBuilder versions, only end level categories could be assigned only to an item. Main level categories could not be set for an item. This meant that when a subcategory was first added to an existing category, that subcategory became the end level category. Therefore, all products under the original category were reassigned to the new subcategory.

To change this behavior, and keep new subcategories from being automatically assigned to the products the main category is associated with, you can make a few quick changes. Note that this has already been added in version 2.81 and higher.

  1. Open the categories.php page in the /storeadmin/ folder.

  2. Find the following code, around line 80:

    // UPDATE ITEMS IF NEEDED
    if (!empty($parent) AND !empty($thiscatid))
  3. Change the line:

    if (!empty($parent) AND !empty($thiscatid))

    to:

    $addtoendlevel = 'no';
    if (!empty($parent) AND !empty($thiscatid) AND $addtoendlevel == 'yes')
  4. Save the file.

Now, when you add a new subcategory to an existing category, that new subcategory will not be assigned to any items.

Note: If you want to go back to the original behavior at some point (in the above mod or in version 2.8+ versions), just change:

$addtoendlevel = 'no';

to:

$addtoendlevel = 'yes';