Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Questions (http://www.datafeedr.com/forums/forumdisplay.php?f=67)
-   -   Remove ALL Filters (http://www.datafeedr.com/forums/showthread.php?t=4053)

feri March 5th, 2011 12:49 PM

Remove ALL Filters
 
I was working with the Filter Tutorial, it's awesome. I want to implement a feature called Remove ALL Filters set.

I've found this in the Documentation to remove all filters set.
Code:

<ul>
        <li><a href="[server.url type='fullpage' query='-brand&-price&-merchant']">[X] Remove ALL Filters</a></li>
</ul>

The question is how to modify the Filtering Widgets to display BOTH
- remove ALL filters
- remove price filter (if it's a price filter)

Code:

<ul>
<?php if (@$_GET['price']) { ?>

  <li><a href="[server.url type='fullpage' query='-price']">[X] Remove price filter</a></li>
<?php } else { ?>
  <li><a href="[server.url type='fullpage' query='price=-150']">Less than 150</a></li>
  <li><a href="[server.url type='fullpage' query='price=150-300']">150 ~ 300</a></li>
  <li><a href="[server.url type='fullpage' query='price=300-550']">300 ~ 550</a></li>
  <li><a href="[server.url type='fullpage' query='price=550-']">More than 550</a></li>
<?php } ?>
</ul>

2. Question: could it be possible to make a separate Widget with Remove All functionality? I think yes, just the question remains how to hide this widget when there are no filters set.

Eric March 5th, 2011 12:59 PM

Hi

You can combine the links above to create 2 removal links like this:

<a href="[server.url type='fullpage' query='-brand&-price&-merchant']">[X] Remove ALL Filters</a>
<a href="[server.url type='fullpage' query='-price']">[X] Remove Price Filter</a>

Yes, you can make another widget to handle this functionality. You can create as many widgets as you want.

Eric

feri March 5th, 2011 06:09 PM

Thanks, I figured this out myself too :) Maybe I was not clear enough.

I would like to make a global remove all filter in a separate widget. (I would make this widget without a title, so it will only be 'seen' when the remove all link gets displayed)

I need a code for removing Price, Word, Brand filters together in one step with one click. I want this to be in a separate widget. Of course, this Remove all link should be displayed every time if any of those filters are set, or any combination of those filters are set, and it should NOT be displayed when they are no filters set.

Eric March 5th, 2011 07:48 PM

Hmm.... I'm still not 100% sure I understand exactly what you need but here's an attempt:

The following code will display a "Remove all filters" link only when a price, word and/or brand filter is present:

HTML Code:

<?php if (@$_GET['price'] || @$_GET['word'] || @$_GET['brand']) { ?>
        <a href="[server.url type='fullpage' query='-price&-word&-brand']">[X] Remove ALL Filters</a>
<?php } ?>


feri March 6th, 2011 02:50 AM

Thank you very much! It's 100% what I needed!


All times are GMT -5. The time now is 08:21 AM.

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