Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Tips, Tricks & Tutorials
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 3rd, 2011, 03:19 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default 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:

Sunglasses
-- Brand
---- Frogskins
---- Oakley
---- Ray Ban

Sunglasses
-- Price Range
---- $50 - $75
---- $75 - $100
---- $100 - $200

Sunglasses
-- Merchant
---- REI
---- Sunglass Hut
---- Zappos

Sunglasses
-- Color
---- Black
---- Green
---- Blue


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:

Sunglasses
-- Mens
---- Antix
---- Conduct
---- Crosshair
---- Dispatch
---- Fives
---- Flak Jacket
---- Frogskins
---- Flak Jacket XLJ
---- Fuel Cell
---- Gascan
---- Half Jacket
---- Half Wire
---- Hijinx
---- Holbrook
---- Ice Pick
---- Inmate
---- Jawbone
---- Juliet
---- Jupiter
---- M Frame
---- Minute
---- Monster Dog
---- Nanowire
---- O Rokr Pro
---- Oil Drum
---- Oil Rig
---- Pit Boss
---- Probation
---- Radar
---- Scalpel
---- Sideways
---- Splinter
---- Split Jacket
---- Straight Jacket
---- Thump
---- Tightrope
---- Water Jacket
---- Whisker
---- X-Squared
-- Ladies
---- Commit
---- Abandon
---- Compulsive
---- Correspondent
---- Cover Story
---- Dangerous
---- Deception
---- Discreet
---- Embrace
---- Encounter
---- Enduring
---- Forsake
---- Hinder
---- Impatient
---- Liv
---- Radar
---- Ravishing
---- Restless
---- Taken
---- Trouble


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:

Sunglasses
-- Men's
-- Women's


That's it! Let me show you how to do this.

Step 1

Create the 3 categories and add products to the Men's and Women's categories.





Step 2

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:



Step 3

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:

HTML Code:
<ul>
<?php if (@$_GET['brand']) { ?>

  <li><a href="[server.url type='fullpage' query='-brand']">[X] Remove brand filter</a></li>

<?php } else { ?>

  <li><a href="[server.url type='fullpage' query='brand=Airlock']">Airlock</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Arnette']">Arnette</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Bolle']">Bolle</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Calvin Klein']">Calvin Klein</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Carrera']">Carrera</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Diesel']">Diesel</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Emporio Armani']">Emporio Armani</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Fatheadz']">Fatheadz</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Giorgio Armani']">Giorgio Armani</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Guess']">Guess</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Gunnar']">Gunnar</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Harley Davidson']">Harley Davidson</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Hugo Boss']">Hugo Boss</a></li>
  <li><a href="[server.url type='fullpage' query='brand=IronMan']">IronMan</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Liberty Sport']">Liberty Sport</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Nautica']">Nautica</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Nike']">Nike</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Oakley']">Oakley</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Prada']">Prada</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Ray-Ban']">Ray-Ban</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Silhouette']">Silhouette</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Skechers']">Skechers</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Smith']">Smith</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Spy']">Spy</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Tag Heuer']">Tag Heuer</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Versace']">Versace</a></li>

<?php } ?>
</ul>
What's the PHP for? Basically, the PHP allows us to see if a brand has already been selected and gives the user an option to "unselect" the brand. Otherwise, once the brand is selected, it's hard to unselect it.

Step 4

Now let's set up the Women's brand filter like this:



Step 5

And paste in the brands for women:

HTML Code:
<ul>
<?php if (@$_GET['brand']) { ?>

  <li><a href="[server.url type='fullpage' query='-brand']">[X] Remove brand filter</a></li>

<?php } else { ?>

  <li><a href="[server.url type='fullpage' query='brand=Anne Klein']">Anne Klein</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Baby Phat']">Baby Phat</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Banana Republic']">Banana Republic</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Benetton']">Benetton</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Bulgari']">Bulgari</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Calvin Klein']">Calvin Klein</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Carrera']">Carrera</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Christian Dior']">Christian Dior</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Dior']">Dior</a></li>
  <li><a href="[server.url type='fullpage' query='brand=DKNY']">DKNY</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Dolce %26 Gabbana']">Dolce &amp; Gabbana</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Fossil']">Fossil</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Hugo Boss']">Hugo Boss</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Modo']">Modo</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Phat Farm']">Phat Farm</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Rodeo']">Rodeo</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Tom Ford']">Tom Ford</a></li>
  <li><a href="[server.url type='fullpage' query='brand=Yves Saint Laurent']">Yves Saint Laurent</a></li>

<?php } ?>
</ul>
One thing to notice here is the Dolce & Gabbana brand. Here we have a special character in the name so we need to escape it by using query='brand=Dolce %26 Gabbana'. That will prevent the ampersand from acting as a parameter separator.

Step 6

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:











Step 7

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.

Step 8

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:
  • Categories
  • Feature Filter
  • Price Filter
  • Merchant Filter
  • Color Filter
  • Men Sunglasses Brand Filter
  • Women Sunglasses Brand Filter

Step 9

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



Step 10

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:

HTML Code:
<title>
  [store.if word="on"][store.get param="word"] | [/store.if]
  [store.if tags="on"][store.get param="tags"] | [/store.if]
  [store.if price="on"]Price is [store.get param="price"] | [/store.if]
  [store.if brand="on"][store.get param="brand"] | [/store.if]
  [store.if merchant="on"][store.get param="merchant"] | [/store.if]
  [category.name] |
</title>
<meta name="description" content="[category.description]" />
<meta name="keywords" content="[category.keywords]" />
Step 11

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:

HTML Code:
<h2>  
  [category.name]
  [store.if brand="on"] by [store.get param="brand"][/store.if]
  [store.if merchant="on"] sold by [store.get param="merchant"][/store.if]
  [store.if price="on"] priced [store.get param="price"][/store.if]
</h2>
Step 12

Now that we've modified a view, update your store and let's check it out!

STORE HOMEPAGE



PARENT CATEGORY PAGE



MEN'S CATEGORY



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!

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk edit subscriptions/filters for categories feri Feature Requests 1 February 19th, 2011 10:41 AM


All times are GMT -5. The time now is 12:59 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.