Modular Merchant
QuickCode™ Glossary
{IF-CATEGORY-IS-ROOT-BEGIN}
QuickCode Tag Glossary Home
See also:
Knowledge Base
Articles in this category:


{CATEGORIES-BULLETED-LIST}

{CATEGORY-ACTIVE}

{CATEGORY-ATTRIBUTE-DESCRIPTION}

{CATEGORY-ATTRIBUTE-TITLE}

{CATEGORY-ATTRIBUTE-VALUE}

{CATEGORY-BLOCK-BEGIN}

{CATEGORY-BLOCK-END}

{CATEGORY-BREADCRUMB-LINKS}

{CATEGORY-DESCRIPTION}

{CATEGORY-DISPLAY-ORDER}

{CATEGORY-HOMEPAGE}

{CATEGORY-IMAGE-TAG}

{CATEGORY-IMAGE-URL}

{CATEGORY-NAME}

{CATEGORY-NUMBER-OF-PRODUCTS}

{CATEGORY-NUMBER-OF-SUBCATEGORIES}

{CATEGORY-PARENT-CATEGORY-NAME}

{CATEGORY-PARENT-CATEGORY-SID}

{CATEGORY-RESULTS-BLOCK-BEGIN}

{CATEGORY-RESULTS-BLOCK-END}

{CATEGORY-SID}

{CATEGORY-TEMPLATE}

{CATEGORY-URL}

{IF-CATEGORY-ATTRIBUTE-BEGIN}

{IF-CATEGORY-ATTRIBUTE-END}

{IF-CATEGORY-IMAGE-BEGIN}

{IF-CATEGORY-IMAGE-END}

{IF-CATEGORY-IS-ROOT-BEGIN}

{IF-CATEGORY-IS-ROOT-END}

{PAGINATION}

{SHIPPING-OPTION-NAME}

{SUBCATEGORY-BEGIN}

{SUBCATEGORY-BLOCK-BEGIN}

{SUBCATEGORY-BLOCK-END}

{SUBCATEGORY-END}

Categories > {IF-CATEGORY-IS-ROOT-BEGIN}
<< {IF-CATEGORY-IMAGE-END} {IF-CATEGORY-IS-ROOT-END} >>
{IF-CATEGORY-IS-ROOT-BEGIN} Updated: 02/13/2013

The {IF-CATEGORY-IS-ROOT-BEGIN} QuickCode Tag may be used in conjunction with the {IF-CATEGORY-IS-ROOT-END} QuickCode Tag to show or hide content selectively, depending on whether a category is a "root" category (meaning it is not a subcategory of any other category).

Requirements / Prerequisites

The {IF-CATEGORY-IS-ROOT-BEGIN} QuickCode Tag must be used in conjunction with the {IF-CATEGORY-IS-ROOT-END} QuickCode Tag.

The {IF-CATEGORY-IS-ROOT-BEGIN} {IF-CATEGORY-IS-ROOT-END} QuickCode Tag pair may be used in category.template.php, and may also be used between the {CATEGORY-BLOCK-BEGIN} and {CATEGORY-BLOCK-END} QuickCode Tags, in any templates that are compatible with {CATEGORY-BLOCK-BEGIN} and {CATEGORY-BLOCK-END}.

The {ELSE} and {NULL} QuickCode Tags are also compatible with the {IF-CATEGORY-IS-ROOT-BEGIN} {IF-CATEGORY-IS-ROOT-END} QuickCode Tag pair.

Example of Use

 For instance, to display a list of category names, with root categories in bold and subcategories in italics, the following code might be used:

{CATEGORY-BLOCK-BEGIN}
{IF-CATEGORY-IS-ROOT-BEGIN}{CATEGORY-NAME}{ELSE}{CATEGORY-NAME}{IF-CATEGORY-IS-ROOT-END}
{CATEGORY-BLOCK-END}

The result would look like: 

Category 1
Subcategory 1-A
Subcategory 1-B
Category 2
Subcategory 2-A
Category 3
Subcategory 3-A
Subcategory 3-B

 


Alternatively, to create a category block that only displays the "root" categories in underlined text, and skips all subcategories, the following code might be used:

{CATEGORY-BLOCK-BEGIN} 
{IF-CATEGORY-IS-ROOT-BEGIN}{CATEGORY-NAME}{ELSE}{NULL}{IF-CATEGORY-IS-ROOT-END} 
{CATEGORY-BLOCK-END}

The result would look like:

Category 1
Category 2
Category 3

 

Source Code Source Code Updated:
When a web page using a template that contains this QuickCode Tag is viewed in the storefront, the {IF-CATEGORY-IS-ROOT-BEGIN} QuickCode Tag is changed into the source code below prior to the web page being displayed.
LOG IN TO ADD COMMENTS
  Copyright © 2001 - 2024 Modular Merchant™. All rights reserved.
Modular Merchant | Privacy Policy | Legal Statement | Terms of Service | Contact Us | Site Map