Hi ! h_title
Support
Home
Developers
Feed
Feed

For the Tweakwise feed, you need to pay attention to the categories. Since the categories get added as a separate section in the eventual feed this requires some tricks to get it to work with channable. In this article, we elaborate a little on what each field (see figure 1) requires and what the eventual effect is on the feed. But first a little introduction on the categories.

Categories

In Tweakwise, a category consists of 1: An ID, 2: A name, and 3.: A parent category id. Since one product can be in multiple categories and the category tree can go quite deep, this can get quite tricky. It might help to visualize the categories into a category tree (see figure 2). The Root node of the category tree is just an imaginary node that every category has as a base. Then you get the true categories at the bottom of the tree. For the rest of this article, we will refer to this example and to the fields in figure 1 for the description of the requirements.

Root_category

As the node of all nodes, the ultimate base node, the root_category field has to be filled with 1 id representing the root node in your Tweakwise environment. This has to be the same for each item. If this is not included with the product, the custom categories will not be extracted from that item. The easiest way to implement this is to include a rule in Channable that sets a custom field `root_category` where you set it to the root id value for all items.

Category_id_path & Category_path

In combination with category_path these two make up the fields to create the custom categories. Per item, this should list the ID’s of the categories in the same order the categories are in a category_path. That means that the first category (for example ‘Shoes’) in  category_path gets assigned the first ID, the second gets the second ID, etc. For example:

Category_id 1 112 112315

Category_name

Root Shoes Sneakers

 

Figure 2 - Example Category Tree

 

How should you send in your data?

To dive a little more into the more technical side, the actual data, we’d like to start with the root_category. As described in the section above, the root_category should be identical in all the items and filled with the ID of your root category at Tweakwise. If you successfully did this we can continue with sending in the category ID’s and labels of the other categories. For the sake of the explanation we will use the categories defined in figure 2 combined with the following imaginary ID’s:

Category_name

Category_id

Root

1

Shoes

11

Clothing

12

Unisex

13

Sneakers

111

Dress shoes

112

Dresses

121

Shirts

122

These categories all should have 1 category name and 1 category ID reference to the one category. Since Channable works with items you will have to make sure that all items have the same combination of category name and id. To do this you have 2 fields, category_id_path and category_path. Both of these fields accept data in 1 of the following 3 ways, each with its own behavior.

1. Send categories in a list

Within channable you can work with lists of values, here is the example represented with a table:

List

11

111

Behind the scenes this will be interpreted as 11 > 111, or visually as follows:

The system expects the categories to be sent in hierarchically from left to right, where the left one is the highest category. The limitation here is that you cannot send multiple category branches, so this tree could not be enriched with the Unisex category.

2. Send categories in a path

The categories can also be sent as a path represented by a string. What this looks like is:

Which once again represents the category tree you see here. This gets interpreted the same way as the way of 1. and they are interchangeable. You could send them through as 1 for the ID’s and this way for the names.

The categories will then get directly mapped. So, to show 1 example of how it should go and 1 how it shouldn’t we’d hope you understand.

Example 1: Expected behavior

Category_id_path:

List

11

111

 

Category_path: “Shoes > Sneakers”

Combined this would be:

Category_id

11

111

Category_name

Shoes

Sneakers

 

Example 2: Faulty data

Category_id_path:

List

111

11

Category_path: “Shoes > Sneakers”

Combined this would be:

Category_id

111

11

Category_name

Shoes

Sneakers


Since the list and the string are in different order, they get combined differently.

3. Send categories in a list of paths

Some products need to be mapped to multiple category branches, therefore we allow the combination of the above methods for both the category_id_path field and the category_path field. If the following tree wishes to be achieved for a product, the data should be sent as follows:

Category_id_path:

List

11 > 111

13

Category_path:

List

Shoes

Sneakers

Unisex

Or as follows:

Category_id_path:

List

11 > 111

13

Category_path:

List

Shoes > Sneakers

Unisex

 

Pitfalls

There are a couple of things that could go wrong and result in either faulty categories or a rejected feed. Below we list the most adamant errors and direct pitfalls that we foresee.

Wrongly ordered

As also quickly described above, the data should be correctly ordered. Since Channable zips them together, from left to right, like a zipper. For example in the hypothetical scenario that this is the value of the fields:
Category_id_path:

List

1

2

3

4

5

6

Category_path:

List

A

B

C

D

E

F

The process will go as follows:

Category_id

1

2

3

4

5

6

Category_name

A

 

 

 

 

 

 

Category_id

1

2

3

4

5

6

Category_name

A

B

 

 

 

 

— etc. —

Category_id

1

2

3

4

5

6

Category_name

A

B

C

D

E

F

 

However, this means that if one of the two lists is ordered right to left instead, as in the example below, you would get the wrong combination of ID’s and names.

Category_id_path:

List

1

2

3

4

5

6

Category_path:

List

F

E

D

C

B

A

 

The process will go as follows:

Category_id

1

2

3

4

5

6

Category_name

F

 

 

 

 

 

 

Category_id

1

2

3

4

5

6

Category_name

F

E

 

 

 

 

— etc. —

Category_id

1

2

3

4

5

6

Category_name

F

E

D

C

B

A

 

Therefore make sure that both fields are always ordered Left to Right in terms of higher hierarchy to lower.

More Names or IDs

For the same reason as above, having an unequal amount of values for both will result in faulty combinations. For example:

 Category_id_path:

List

1

2

3

4

5

6

Category_path:

List

A

B

C

D

 

 

 

Will result in

Category_id

1

2

3

4

Category_name

A

B

C

D

Since there are no names for 5 and 6 they are cut off.

No Root category

If there is not a root category included, it is not possible to generate categories for that product. This is mostly a safety precaution, however, but for products without a root category, the categories will be skipped.

 


Has reading the relevant articles not helped you?

Share article

Link copied to clipboard

Cookies

We are using cookies.

Want to know more? Take a look at our cookie statement.

The Livechat uses trackingcookies, do you accept these cookies?

Accept