Follow

How do I import categories?

Contents

  1. Importing with separate fields per category and subcategory
  2. Importing with the same field for category and subcategory
  3. Removing all existing categories from a product.

Overview

Our import tools provide several methods of importing Categories to your OpenCart store. Categories are imported by name, not by category ID.

If a category from your CSV or XML file does not already exist in your OpenCart store, it will be created.

If it already exists, and the name of the category in your store matches exactly the name in your CSV or XML file, then the existing category will be used.

If you find your categories are being duplicated, check to see that there are no extra spaces in the category column of your product file. 

Total Import PRO and CSV Import PRO both allow you to import unlimited top level categories. Top-level categories are main, or overall categories; e.g. "accessories".

Each top level category can also have unlimited sub categories. An example of a sub category from "accessories" would be "wristwatches".

Categories and sub categories can be mapped in one of two ways.

1. Importing with separate fields per category and subcategory

You would use this method if your categories each have their own separate field. You can see in the example below, the field that contains 'cat1' is the top level category (i.e. "Office").  'Cat2' is a subcategory (i.e. "Hardware"), and 'cat3' is a subcategory again (i.e. "Laptops"). 

cat1.jpg

To import these as a chain in the correct order (Office > Hardware > Laptops), you would use the mapping below.

This image is taken from the CSV Import PRO, but the take-home point is that subcategories are mapped horizontally. This is the same for the Total Import PRO.

cat_map1.jpg

In the next example, these fields marked 'cat1', 'cat2' and 'cat3' are each separate "equal" top-level categories (that is, cat2 is not a subcategory of cat1). They would all be applicable to the same product.

cat2.jpg

In this case, we want to keep these as three separate top level categories. This would be mapped as follows.

cat_map2.jpg

Multiple top level categories are mapped vertically.

If we had multiple top level and subcategories, it is possible to map these using a combination of the vertical and horizontal mappings.

2. Importing with the same field for category and subcategory

You would use this method if your category and subcategory structure is contained in a single column and separated by a consistent delimiter (in this case, you will see we have used the character ">" as a delimiter).

You can import this structure as category and subcategories using the Category Delimiter field.

This field is supported by all of our product import tools, including XML Import PRO.

Here is an example of a CSV file which uses a category delimiter to separate its categories and subcategories.

cat3.jpg

Here, the import tools will use the delimiter to separate each category and subcategory into separate entities for import.

Note: Be careful of spaces between words! These can cause your categories to appear as duplicates. If there are spaces either side of your delimiter, you will need to express this in your Category Delimiter selection.

For example, if your category field looks like:

Office > Hardware > Laptops

as opposed to

Office>Hardware>Laptops

Then you need to set your delimiter to ' > ' rather than just '>'.

You can only use vertical expansions if you input a category delimiter. The use of a category delimiter then renders any horizontal subcategory "mappings" in other separate fields redundant. The import tools will therefore ignore all horizontal expansions.

Removing all existing categories from a product.

Categories can be removed from a product by mapping an empty "category" field in our module.

If you map the category "cat1", and "cat1" has no data in it, the import tool will remove the product's existing categories.

If you map "cat1" and "cat1" does have a category in it, then the import tool will replace all existing categories with the ones that you have mapped.

You can do this with most fields, and it works the same way. Mapping a field as empty or blank in the module, will cause it to be removed.

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Wbm

    Very useful explanation and will help me resolve the issue I have with duplicated categories.

  • Avatar
    Claude Latour

    Hi, what happens if subcategories have the same name but under different main categories?

  • Avatar
    Office

    Hi, can i import and update categories and products in a specific main category ?

    I want to create a main category and put all categories from feed in it. But when i update categories are created again from the feed and new products apear there. Not in my main category wich i created, where are all others products.

  • Avatar
    Mhsthomas

    not helpful!!  this instruction needs a link to the opencart store front where it shows categories and the relationship in what is said above and ow it link with the store front.

    WARNING IF YOU HAVE BUILD CATEGORIES DO NOT FOLLOWING THE ABOVE YOU WILL LOSE the data

    this explanations needs to demonstrate what happens when you have categories in place in open cart and the subsequent import

Powered by Zendesk