Catalog Tags

From Shopp Documentation

Jump to: navigation, search

The catalog tags provide access to information relating to the main catalog. They are primarily useful in displaying a specific category or built-in smart category of products. For the most part, the catalog tags are used in the catalog.php theme template and the category.php theme template files.

Catalog tags are called using a syntax similar to: <?php shopp('catalog','property','option1=value1&option2=value2…'); ?>

They may be called in any WordPress template file.

Contents

Global Tags

url

Overview

<?php shopp('catalog','url'); ?>

Displays the main catalog page permalink for use in href attribute of links or the action attribute of a <form> tag.

Options

  • None

is-landing

Overview

<?php if (shopp('catalog','is-landing')) {} ?>

Used to determine when the customer is on the main store catalog page, known as the store landing page.

Options

  • None

Examples

<?php if (shopp('catalog','is-landing')) {
	// Show something specific to the main store catalog page
} 
?>

is-category

Overview

<?php if (shopp('catalog','is-category')) {} ?>

Used to determine when the shopper is viewing a category page.

Options

  • None

Examples

<?php if (shopp('catalog','is-category')) {
	// Show something specific to any category page display
} 
?>

is-product

Overview

<?php if (shopp('catalog','is-product')) {} ?>

Used to determine when the shopper is viewing a product page.

Options

  • None

Examples

<?php if (shopp('catalog','is-product')) {
	// Show something specific to a product page display
} 
?>

tagcloud

Overview

<?php shopp('catalog','tagcloud'); ?>

Displays a list of product tags weighted by popularity.

Options

  • levels: Default is 7. Sets the range of levels used to determine numbered CSS classes that include level-specific styling (font-size in particular). Each tag is assigned a class of level-X where X is the number of the level from 1 to the number specified for the levels option.

breadcrumb

Overview

<?php shopp('catalog','breadcrumb'); ?>

Shows a row of a history of navigation links related to your current location within the hierarchy of the product catalog.

It is important to realize that a category breadcrumb can only appear when arriving on a product page from a category. As products can be assigned to multiple categories, a navigation history must exist to know which category should be displayed in the breadcrumb.

Options

  • separator: Default is ». Allows you to specify a custom separation character, string of characters or custom HTML between each category entry of the heirarchy.

views

Overview

<?php shopp('catalog','views'); ?>

Displays buttons to allow the shopper to change the current category view style to grid or list. Changes to the view setting are stored in a cookie so that the view is used for displaying all categories across the entire site until changed again. Clicking a view button toggles the grid or list class on the catalog container element and can have custom styles applied to it in the shopp.css template file.

Options

  • label: Default is empty. Allows you to specify a custom label for the button controls.

search

Overview

<?php shopp('catalog','search'); ?>

Use by including this tag in the active WordPress theme's search <form> element, you can force the WordPress search to search the store's catalog instead of blog posts. Optionally, you can provide options to allow the customer to select where to search.

Options

  • type: Default is hidden. Can be set to radio to display a radio-button option. Use the option option to set the type of radio option.
  • option: Default is shopp. Accepts values of blog or shopp. An invalid value will automatically use shopp. This option requires the type option set to radio to specify the kind of radio button to display.

orderby-list

Overview

<?php shopp('catalog','orderby-list'); ?>

Displays a list of product listing sort order options for the products displayed in a category. This tag does not display sort order options for smart categories.

Options

  • default: Allows custom override of the global default set by the Product Order setting available under ShoppSettingsPresentation. Accepts values of: bestselling, highprice, lowprice, newest, oldest, random, title. If an invalid option is specified, the title option is used.
  • dropdown: Default is off. Specifies whether to display the list as a set of unordered list items <li> (the default) or as a set of drop-down menu options <select><option></select> Example: <?php shopp('catalog','orderby-list','dropdown=on'); ?>
  • title: Default is (empty). Allows you to specify a title that is displayed before the menu of options.

category-list

Overview

<?php shopp('catalog','category-list'); ?>

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

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.
  • 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: <?php shopp('catalog','category-list','dropdown=on'); ?>
  • 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.
  • products: Default is off. Displays the number of products in the category in parentheses after the category name when enabled.
  • orderby: Default is name. Sort categories by category name, category id, category slug or the total count of products in the category.
  • order: Default is ASC. Sets the sort order for categories to ASC for ascending or DESC for descending.
  • 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 (not set). 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.

Examples

Category Navigation as a Drop-Down Menu
<?php shopp('catalog','category-list','dropdown=on'); ?>
Category Navigation as a Drop-Down Menu with Hierarchy
<?php shopp('catalog','category-list','dropdown=on&hierarchy=on'); ?>
Category List with Hierarchy & Product Counts
<?php shopp('catalog','category-list','hierarchy=on&products=on'); ?>
Category List of Top-Level Categories Only in Reverse Order
<?php shopp('catalog','category-list','depth=1&order=DESC'); ?>

has-categories

Overview

<?php if(shopp('catalog','has-categories')) {} ?>

Tests whether the catalog has any categories.

Options

  • None

Examples

<?php if(shopp('catalog','has-categories')): ?>
	…content shown when the catalog has categories available…
<?php else: ?>
	…content shown if no categories are available…
<?php endif; ?>

categories

Overview

<?php while(shopp('catalog','categories')) {} ?>

Loops through the categories so that a custom layout can be specified for displaying each category within the looping block. This is similar to "The Loop" structure in WordPress for displaying a custom layout for WordPress posts. Use Category Tags inside the loop to display category information specific to the current category of the loop.

Options

  • None

Examples

<?php while(shopp('catalog','categories')): ?>
	…content shown for a specific category…
<?php endwhile; ?>

category

Overview

<?php shopp('catalog','category'); ?>

For accessing a single, specified category from the catalog. By default, displays the category using the format described in the category.php template file.

Options

  • name: Specifies the category to be displayed by the category name. An exact match is necessary (including uppercase/lowercase letters).
  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • id: Specifies the category to be displayed by matching the category ID number. This is an alternative and is a faster database lookup then using the name.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.
  • order: Default is title. Possible settings include: bestselling, highprice, lowprice, newest, oldest, random, and title
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in). Without a specified limit, a built-in hard limit of 1000 products is used to prevent the server's resources from being totally consumed.

Examples

Display A Custom Category By ID
<?php shopp('catalog','category','id=1'); ?>

This will display the category on a given page just as if it was directly requested by its permalink using the category.php template file for its layout.

Load A Custom Category By Slug
<?php shopp('catalog','category','slug=paperback-books&load=true'); ?>

This example loads a custom category making it ready to use shopp('category') tags against. It does not display anything itself. This technique allows you to define your own inline layout for the category in place of the category.php template file. For more information, see the tutorial on creating a Custom Category Layout.

product

Overview

<?php shopp('catalog','product'); ?>

For accessing a single, specified product from the catalog. By default, displays the product using the format described in the product.php template file.

Options

  • name: Specifies the product to be displayed by the product name. An exact match is necessary (including uppercase/lowercase letters).
  • slug: Specifies the product to be displayed by the product slug, the product identifier at the end of a product permalink.
  • id: Specifies the product to be displayed by matching the product ID number. This is an alternative and is a faster database lookup then using the name.
  • load: Default is false. Loads the product into memory, making it available for using Product Tags rather than displaying the product using the product.php template file.


Smart Categories

catalog-products

Overview

<?php shopp('catalog','catalog-products'); ?>

Displays the Catalog Products "smart" category which displays all of the products in the catalog.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is off. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a specified limit, a built-in hard limit of 1000 products is used to keep the server's resources from being totally consumed.
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.
  • order: Default is title. Possible settings include: bestselling, highprice, lowprice, newest, oldest, random, and title

new-products

Overview

<?php shopp('catalog','new-products'); ?>

Displays the 'New Products' smart category which displays the products most recently added to the catalog.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.

featured-products

Overview

<?php shopp('catalog','featured-products'); ?>

Displays the 'Featured Products' smart category which displays the products that have the "Featured Product" setting toggled on in the product editor.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.

onsale-products

Overview

<?php shopp('catalog','onsale-products'); ?>

Displays the 'On Sale Products' smart category which displays the products that have a Sale Price enabled in the product editor or a promotion that applies to the product. Promotions applied by coupon codes do not show up in this category as the promotion is applied in the cart when the coupon is entered, not on the catalog product. Note that if your MySQL server version is less than 5, promotions do not get applied in the category listing and effectively disable this smart category. If you want to use this dynamic category, you will need to upgrade your MySQL server (or get your web hosting provider to upgrade it) to version 5 or higher.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.

bestseller-products

Overview

<?php shopp('catalog','bestseller-products'); ?>

Displays the 'Best Seller Products' smart category which displays the products that have the most purchases based on your store's order logs. Products are listed with the most purchased product first. Deleteing orders in the order management interface will affect product purchase counts and reorder the products list accordingly.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.

random-products

Overview

<?php shopp('catalog','random-products'); ?>

Displays the 'Random Products' smart category which displays a random assortment of products published to the catalog.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.

tag-products

Overview

<?php shopp('catalog','tag-products'); ?>

Displays the 'Tag Products' smart category which displays products with specified tag(s).

Options

  • tag: Specifies the tag (or tags) used to find products. Multiple tags can be specified using commas (,) to separate each tag: tag,second tag,last tag
  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.
  • order: Default is bestselling. Possible settings include: bestselling, highprice, lowprice, newest, oldest, random, and title

related-products

Overview

<?php shopp('catalog','related-products'); ?>

Displays the 'Related Products' smart category which displays products related to the current product being viewed, or a specified product.

Options

  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is off. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in). Without a specified limit, a built-in hard limit of 1000 products is used to prevent the server's resources from being totally consumed.
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.
  • order: Default is bestselling. Possible settings include: bestselling, highprice, lowprice, newest, oldest, random, and title

search-products

Overview

<?php shopp('catalog','search-products'); ?>

Displays the 'Search Products' smart category which displays products matching a keyword search.

Options

  • search: Specifies the search terms (keywords) to find products.
  • title: Specifies the title to be shown for the category layout overriding the default category title.
  • controls: Default is on. Overrides the display of "control" elements in the category.php template that would otherwise be shown. Used to highlight a selection of products in a category without all of the extra category controls.
  • show: No default value. Limits the number of products to show in the category display. Without a limit, this category will show all the products in your catalog (no matter what category they are in).
  • load: Default is false. Loads the category into memory, making it available for using Category Tags rather than displaying the category using the category.php template file.
  • pagination: Default is numeric. Set to alpha this option will use alphabetic pagination, otherwise it will default to numeric.
  • order: Default is bestselling. Possible settings include: bestselling, highprice, lowprice, newest, oldest, random, and title