Creating filters that do the work of categories
I've noticed a lot of members creating categories that do the work of filters. Below is an example of what I mean where each line is its own category:
---- Ray Ban
-- Price Range
---- $50 - $75
---- $75 - $100
---- $100 - $200
---- Sunglass Hut
In this example Brand, Price, Merchant and Color are all categories but are being used as category filters for the parent category Sunglasses.
So what's the big deal? It's only 20 categories... But consider this real example borrowed with permission from a Datafeedr member:
---- Flak Jacket
---- Flak Jacket XLJ
---- Fuel Cell
---- Half Jacket
---- Half Wire
---- Ice Pick
---- M Frame
---- Monster Dog
---- O Rokr Pro
---- Oil Drum
---- Oil Rig
---- Pit Boss
---- Split Jacket
---- Straight Jacket
---- Water Jacket
---- Cover Story
That's 59 categories more than actually needed to be created.
So why is it not a good idea to use categories as filters?
1. It involves lots of duplicate work, creating hundreds of categories and performing just as many searches. Not to mention inputting category titles, descriptions and meta info.
2. But maybe more importantly, it's very hard to maintain. If a merchant modifies their product information just a little, you might end up with too many products you don't want in your categories or with no products at all. If you've created a category for every filter, you would have to edit every single saved search. Ugh!
My proposed solution is to use filters instead of categories. Let's take the 62 category example I mentioned above. In that case, I would have 3 categories and handle the rest of the organization in filters.
Here's how my categories would be structured:
That's it! Let me show you how to do this.
Create the 3 categories and add products to the Men's and Women's categories.
Next we are going to create 2 different brand filter widgets. I'm creating 2 different brand filters because I'm guessing that some brands are only for women and some brands are only for men. Plus, it's a useful thing to learn for building other filters.
Go to The Factory > Your Store > VIEWS > WIDGETS > Add a new view
In the new view pop-up box, fill it in like this:
Once you've created the new view, you will add a Text module to the view and fill it in with your brands. Here's what my Men's sunglasses brands might be:
Now let's set up the Women's brand filter like this:
And paste in the brands for women:
Just for fun, I'm going to add a few more filters to really make the navigation powerful. In the following steps, I will add a price filter, merchant filter, keyword (in this case color) filter and a tags (in this case feature) filter.
A picture is worth a 1,000 words and with that... here are some screenshots to show you how I've set up those filters:
Now, the last step we need to take is hide the new filters on all pages except on category pages. Additionally, we need to only show men's brands in the Men's category and women's brands in the Women's category. To do all of this hiding and showing, I will use the Widget Context plugin: http://wordpress.org/extend/plugins/widget-context/ You should install this plugin.
Once you've updated your store on your blog so that the new views information is available and you've installed and activated Widget Context, you'll need to go to Appearance > Widgets and add the following Datafeedr widgets to your sidebar:
Now you need to configure the widget contexts.
Categories - Display on all pages.
Feature Filter, Price Filter, Merchant Filter & Color Filter - "Show on selected" and paste the appropriate URLs into the textarea. Here's an example of the merchant filter:
Men Sunglasses Brand Filter - "Show on selected" and only the men's category URL
Women Sunglasses Brand Filter - "Show on selected" and only the women's category URL
Now we need to take care of our <head> info. In this example, I'm going to tweak the <title> tags based on the query string.
In the <head> area I will do something like this for the title:
Basically, it says if a filter has been chosen, display its information in the title. Here's the code for that:
Now, let's fix the title of the category that appears on the page:
In the template area, I will do something like this:
It's just a modification of what I used in the <title> tags above. Here's the code I used:
Now that we've modified a view, update your store and let's check it out!
PARENT CATEGORY PAGE
WITH BRAND SELECTED
WITH BRAND & COLOR SELECTED
WITH BRAND, COLOR & PRICE SELECTED
WITH BRAND, COLOR, PRICE & MERCHANT SELECTED
WOMEN'S CATEGORY WITH FEATURE & PRICE SELECTED
Hope this helps speed up your store creation!
Here are the code snippets I used in my views:
Price Filter Widget:
This is a massive time saver - thank you sooo much for writing this up....
I have just converted my 115 sub-categories to a filter... 30 mins work instead of 5 hours of brainlessly clicking 'New Category' - brilliant :-)
A couple of questions:
I prefer to have category pages still for the main categories... this allows me show descriptions for each brand, which helps with SEO... However all my sub-categories will be converted to filters...
1. In my store I will end up with around 100 filters, which are brand specific. Do you recommend that I create one filter widget per brand and add 100 widgets to the side bar or would it make better sense to have a huge chunk of code in one master brand filter widget, which populates a drop down box depending on which category is active?
2. I think there is an issue with filter keys of less than 4 characters, so your Sky brand filter will not work unless you can tweak the MySQL .ini file - which you can't on shared hosting... Do you have any ideas on how to get around this?
3. Is it possible to use AND and OR on the word filter? For instance for one filter I have two possible ways of spelling the keyword, but I would like both keywords to be in the same filter. This would also allow you potentially to build out your example above with a second level 'Model' filter, so you could first select 'Ray Ban' then afterwards 'Wayfarer' to narrow down the model within the brand.
In case anyone is interested this is the code I use to create a drop down box instead of a list:
thanks for the guide Eric, very useful.
Have a question re the filters though. Would it be possible to return the filter options on the search results page? I ticked the search option in the plugin but nothing appeared so I assume that's only for the default WP search
Sure, why not? Just add the path to your search page (store/search*) in the Widget Context section:
Hi Eric - thanks for this tutorial. Are the tags, brand and other parameters already recognized by the system? What if I wanted to filter by style? Sending 'style=boot' for example did nothing.
Can we make two filters independently of each other that use query=word (searching the product description)?
Thanks. Is this something that can be possibly added as a future feature?
I am not a programmer, but I think that if we can append price, or tag to the word query, we could possibly add another word query too.
Thanks. I read the page a few times already but I think I did not find the answer I was looking for :) I will ask again, maybe we do not understand each other. :)
I have a category of products and I want to filter it by:
A) color (blue, green, etc)
B) shape (cross, flower, etc)
C) material (white gold, yellow gold, etc)
each of these things are in the products description.
Is this possible to filter A+B+C together, thus narrowing the search results step-by-step?
If your setup does not work at it should when you want to display widgets on specific categories try this - thanks Eric:
Edit the Widget Context Plugin's php file:
1) change this
There is NO dash at the end...
Good luck! and thanks to Eric!
How can I get these widget filters to appear in a left-hand column instead of the right-hand sidebars you show above?
I am making a site selling phone and tablet cases and accessories. I just started it and want to get this right before I go too far. As of right now I have it structured with all categories and sub categories.
--Motorola Xoom Cases
--Motorola Xoom Covers
--Motorola Xoom Skins
I am going to continue to do this for any new devices that come out. Is there a downside to doing this besides the time factor? Because eventually I would like to rank for the keywords that are my sub categories and build links to the pages. I won't be able to do that using the filter method right?
Also is there a way to not display products for a category that only has sub categories in it any no products?
For example if you click on motorola it shows products before you pick a sub category.
|All times are GMT -5. The time now is 04:04 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.