Add dimensions to your product catalog by taking advantage of core WordPress features for custom taxonomies.

Categorizing Product Brands

abcofbrands

Categorizing Product Brands

A fledgeling romance

At the dawn of Shopp, our catalog was built entirely outside of the “post”. Shopp predates WordPress custom post-types and custom taxonomies, and we really didn’t like the idea, at the time, of polluting the WordPress posts table with “products”, or taking liberties with suppressing “hidden categories” for use with the catalog (disable the plugin, get a bunch os very strange new content on your blog). So, at the time, we built quite a sophisticated system bolted onto the WordPress database, that would store our product catalog in a very powerful, yet someone distant way (WordPress was like, “don’t be that way, baby”). The real bottom line for us was that the more hacking we had to do to “break out” of the WordPress way of doing things with the post, the worse things were going to be as WordPress changed over time.

Taking the product outside the post at the time offered us the greatest ability to deliver very powerful capabilities, such as very efficient loading of large listings of products, dynamic sorting on sales data and pricing, as well as the ability to offer a system of custom “loops” (with our own Template API) for developers to load and display many characteristics of a “product”.

In the WordPress admin, Shopp has always had a look and feel of managing your product catalog in a “WordPress-like way”, but has always been bolt-on.

Shopp has in the past created a set of WordPress pages, and took over the content area of those pages to inject Shopp products through the use of Shortcodes, such as the very important page with the [catalog] short-code.

We’ve been cohabitating with WordPress for awhile, but it’s always been mostly a his stuff, her stuff type of home life. I won’t say who’s the dude in this relationship, but I will say Shopp’s been the one concerned with “doing business”. :-) WordPress has been dolling up professionally, with custom taxonomies and post-types, and it’s been making us think about tying the knot ever since.

Now comes WordPress 3.0

With WordPress 3.0 came a series of features that astounded WordPress developers. WordPress 3.0 brought to the table a more fully realized content management system. No longer just blog posts, now you could develop plugins that would have WordPress contain your defined custom post types (custom “objects” or “data types” if you like), and you could collect them into new taxonomical groups with your own custom taxonomies. Now you could have a “Directory” taxonomy that groups “People”, a “Channel” taxonomy that groups “Videos” and “Podcasts”, and, at least in theory, a “Catalog” of “Products”.

The problem

In previous versions of Shopp, because we too were using our own limited set of taxonomies, and managing them without the help of WordPress, you were limited in the way you could group a collection of products to just Shopp product categories and product tags.

This was great and fine when all you needed in your site’s menu was a flat product category, or specific term, but left you with little option if you wanted to do something like group products by product category and group by, say the “product brand name”. Doing something like this forced you to misuse one or both of the only taxonomies you had, such as using tags exclusively for the brand, or make your category hierarchy very complicated with brands and product types intermingled. The former lacks specificity to make organization tasks clear for the merchant end-user, and the latter is probably confusing for the customer end-user.

Wouldn’t it be nice if your merchant end-user could have a nice menu labeled “Brands”, could easily add a new brand, and just as easily assign a product to that brand. Wouldn’t it be nice if your developer could both easily create a list of product categories, a tag cloud, and a list of brands that could easily group products. This way, the merchant can do something that just “feels right”, the developer clearly understand what they need to do, without hacking something ugly, and the customer gets another set of road signs leading to shopping bliss.

Shopp custom taxonomies

[“In Shopp 1.2, we’ve redesigned our products as custom post-types, and our categories/tags as custom taxonomies.”] Indeed, as a developer, if you so desired to use the WordPress method of register_taxonomy(), you certainly could, however all the work of creating a management interface for your taxonomy would still need to be done, as well as the work of getting your taxonomy to show up on your store-front.

If you want to avoid all that, we’ve added a function to our developer api, register_shopp_taxonomy(), to do all the heavy lifting for you of not-only registering the taxonomy with WordPress, but also adding to the Shopp admin interfaces and product editor, all your merchant end-user will need to add terms to the taxonomy, to associate products in the catalog with those taxonomies, to handle the presentation of those product groupings on your storefront, automatically, and to add those taxonomies to your WordPress custom menu system.

Let’s see how this would work for our “Brand” problem above:

Brand as a Shopp product taxonomy

First, we need to register our new taxonomy with Shopp and WordPress, using the register_shopp_taxonomy() function:

add_action('shopp_init','register_shopp_taxonomies');

function register_shopp_taxonomies () {
    shopp_register_taxonomy('brand', array(
        'hierarchical' => true,
        'labels' => array(
        'name' => __('Brands','Shopp'),
        'singular_name' => __('Brand','Shopp'),
        'search_items' => __('Search Brands','Shopp'),
        'popular_items' => __('Popular','Shopp'),
        'all_items' => __('Show All','Shopp'),
        'parent_item' => __('Parent Brand','Shopp'),
        'parent_item_colon' => __('Parent Brand:','Shopp'),
        'edit_item' => __('Edit Brand','Shopp'),
        'update_item' => __('Update Brand','Shopp'),
        'add_new_item' => __('New Brand','Shopp'),
        'new_item_name' => __('New Brand Name','Shopp'),
        'separate_items_with_commas' => __('Separate brands with commas','Shopp'),
        'add_or_remove_items' => __('Add or remove brands','Shopp'),
        'choose_from_most_used' => __('Choose from the most used brands','Shopp')
    ),
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'brands' ),
    ));
}

You can add the above code to a plugin, or to your theme’s functions.php file. If you want everything to work correctly, make sure you at least wait for the shopp_init action before calling shopp_register_taxonomy.

Now that we have registered our taxonomy, we should now have a Shopp sub-menu called “Brands”, with a familiar interface for adding new brands.

Brands in the Shopp Menu

There should be a new “Brands” menu appearing in the Shopp menu in your WordPress admin.

The new Brands menu option.

Brands menu appears in Shopp menu group.

Click that and begin adding terms.

The Shopp taxonomy editor.

Create and manage terms for your new taxonomy

Brands in the Product Editor

Your new brands should now show up in a meta-box in the product editor, so you can add brands to the product.

New brand taxonomy terms can be selected in the product edtior.

New brand taxonomy terms can be selected in the product edtior.

Brands in the WordPress Custom Menu

Now that you have brands associated with your products, you can use WordPress custom menus to display these brands on the storefront.  Start by creating a custom menu, in your WordPress Admin → Appearance → Menus, by dragging your new product branding terms to a new or existing menu. You may need to enable Shopp catalog items in the Custom menu Screen Options.

Custom Menu with Shopp Brand terms

Brands menu is added to your Shopp admin menus

Brands on the Store Front

Shopp automatically has added a new product collection that can be viewed in the store front. So, if the merchant has created a brand named “Honda”, with slug honda, I can view this on my site at http://my.domain.com/shop/brands/honda.

Brand collection view on storefront.

Brand collections automatically visible on the storefront.

You must be logged in to post a comment.

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

Skip to toolbar