Speak to our experts today 0333 004 0333
Speak to one of our experts today
User Guides

EKM Tag: [ekm:categoryid]

This tag is used to output the ID of a category. Using the tag you can find the ID of a category by depth within a category structure or the category ID of the current category or, if on a product page, the ID for the category the product is immediately within.

  • Tag Information
  • Nesting This Tag
Basic Use
In it's basic use this tag will pull back the ID of the current category you are within or the ID of the category the product is immediately within.

[ekm:categoryid][/ekm:categoryid]
                                
This outputs the following.
40
Advanced Use
You can also specify a depth to pull the ID of a category from. This can be either an integer value or 'default'.

[ekm:categoryid]depth='0';[/ekm:categoryid]
                                
This outputs the following.
3
Tag Attributes
Depth

You can specify the depth at which you would like to pull the category ID. This value must be an integer or 'default'

The depth defines how deep into the sub-categories, from the top level category, you want to go.

Home > Electronics > Brands > Apple > iMac

For Example: If you have a category structure like the example above and you wanted the ID of 'Electronics' your depth would need to be set at 0. However if you wanted the ID of 'Apple' you would set the depth to 2

Value
Description
default
Will get the ID of the immediate category to the product or sub-category you are within. For example: If you were within 'Apple' or 'iMac' (a product) you would get the ID of 'Apple'.
0
This will get the ID of the top-level / parent category. For Example: The ID for Electronics would be pulled regardless of depth within sub-categories or products.
{user defined}
You can select an integer value for depth. For Example: You could enter 1 as your depth and this would get the ID of 'Brands', or if you choose 2 the ID for 'Apple' would be pulled.

The EKM system allows for some tags to be nested within other tags.

Nesting This Tag

In most cases you would nest this tag within a showdata tag's 'location' attribute or within the ekm:categorypagename tag's categorypageid attribute.

When nesting this tag you do not need to make any changes to it. It can be inserted into other tags like below.


[ekm:showdata]
    ...
    location='[ekm:categoryid]depth='0';[/ekm:categoryid]';
    ...
[/ekm:showdata]