shopp('storefront.category-list')

Displays a linked list of Shopp categories to be used for shop category navigation.

shopp('storefront', 'category-list', 'options')

@param string $object the object or object.tag combination, if object.tag is used, the tag parameter can be omitted
@param string $tag the tag, can be hyphenated or not. Prefix with 'get' as shorthand for the return=true option
@param mixed $options associative array, or url-style name=value pairs separated by ampersands (&). Each pair is passed to the theme api tag as an option.
@returns string Markup for the list of Shopp catalog categories

Outputs a markup for a list of categories in the Shopp catalog.

This tag has two primary rendering modes. By default it will generate markup for an HTML unordered list. It can also be set to display an HTML <select> drop-down menu of the categories.

Depending on the structure of the categories it can render the list in a “flat” listing, or a hierarchical (indented) listing to show the parent-child relationships between the categories.

Options

  • after: default is (empty). Adds content or markup to display after the category list markup.
  • before: default is (empty). Adds content or markup to display before the category list markup.
  • childof: Default is 0. Parent category ID to display sub categories of.
  • class: default is (empty). Used to specify CSS classes for the outer category list <ul> element. Has no effect when the wraplist option is disabled. The container <ul> element always includes the shopp_categories class in addition to any class names specified with this option.
  • depth: Default is 0. Limits the number of levels of categories displayed in the category list.
  • dropdown: Default is off. Specifies whether to display the list as a set of unordered list items <li> surrounded by a unordered list tag <ul> or as a set of drop-down menu options <select><option></select> Example:
  • exclude: Default is (empty). Allows you to specify one (or more) category ids to skip in the category list display.
  • hierarchy: Default is off. Displays the category list showing sub-categories indented (provided the WordPress theme’s CSS doesn’t override)
  • linkall: Default is off. When enabled, forces the category listing to be linked regardless of if there are no products assigned or no products with available inventory.
  • linkcount: Default is off. When enabled, forces the display for the number of products in the category to be included in the link rather than outside of the link.
  • order: Default is ASC. Sets the sort order for categories to ASC for ascending or DESC for descending.
  • orderby: Default is name. Sort categories by category name, category id, category slug or the total count of products in the category.
  • products: Default is off. Displays the number of products in the category in parentheses after the category name when enabled.
  • showall: Default is off. When set to on, forces the display of categories in the list regardless of if they have no products assigned or no products with available inventory.
  • showsmart: Default is off. This option is used to include Smart Categories into the listing of product categories. It can be set to before to include the smart categories before the custom categories, or use after to include them after the custom categories.
  • title: Default is (empty). Allows you to specify a title that is displayed before the menu
  • wraplist: Default is on. Automatically wraps the category list items in a <ul> element when set to on. No outer <ul> is used when set to off.
  • section: Default is off.  Determines whether to show all categories or a specific segment.  Required by sectionterm. Used for Facet navigations.
  • sectionterm: The parent category ID to start the list from.  section must be set to on to use this functionality. Used for Facet navigations.

Examples

Category Navigation as a Drop-Down Menu

<?php shopp('storefront','category-list','dropdown=on'); ?>

Category Navigation as a Drop-Down Menu with Hierarchy

<?php shopp('storefront','category-list','dropdown=on&#038;hierarchy=on'); ?>

Category List with Hierarchy & Product Counts

<?php shopp('storefront','category-list','hierarchy=on&#038;products=on'); ?>

Category List of Top-Level Categories Only in Reverse Order

<?php shopp('storefront','category-list','depth=1&#038;order=DESC'); ?>

Category List of Subcategories of Parent Category with ID of 9

<?php shopp('storefront','category-list','childof=9'); ?>

See Also

  1. Avatar of sierrab123

    To change the name from Select Categories

    <?php shopp('storefront','category-list','exclude=27,28&hierarchy=on&dropdown=on&default=Whatever'); ?>
    
    June 3rd   #

  2. Avatar of Ben Hutchings

    There is a ‘taxonomy’ option too, so that linked Taxonomy Lists can also be shown, either built-in ones like ‘shopp_tag’ or custom ones that have been registered with shopp_register_taxonomy().

    e.g I have a custom Shopp Taxonomy called ‘manufacturer’, and a linked Manufacturer’s can be displayed thus:

    <?php shopp('storefront','category-list','dropdown=0&taxonomy=shopp_manufacturer'); ?>
    

    Note: make sure to add the ‘shopp_’ before the taxonomy name.

    June 18th   #

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar