Post by labeshops » Tue May 27, 2014 7:50 pm

The built in filters module works great once you get it all configured, but one major thing it lacks is a "clear filters" button or link to reset them all to off when you want to see all items again.

Haven't found any mods to do this yet.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by MarketInSG » Wed May 28, 2014 10:56 pm

You can pretty easily add in a small link button to uncheck the checkboxes (jquery, search for the checkboxes and uncheck them) or to reload the category page without the filter attributes :)


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by labeshops » Wed May 28, 2014 11:01 pm

I really don't know jquery at all, so sounds good, but not a clue how to do it.

I also tried the link thing, but couldn't get the link to auto grab correctly for the category.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by MarketInSG » Thu May 29, 2014 9:34 am

for link, you can just add this to the controller to call for the category once again.

Code: Select all

$this->data['reload'] = $this->url->link('product/category', 'path=' . $this->request->get['path']);
then add <?php echo $reload; ?> as a link for your button.

As for jQuery solution, you can add a class to the checkboxes, perhaps class="filter_checkboxes", then add a button into the template

Code: Select all

onclick="$('.filter_checkboxes').attr('checked', 'false');"


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by labeshops » Thu May 29, 2014 7:55 pm

Thanks @marketinsg. I used the link method and it works perfectly!

I still think this should be a standard part of the features module, but it solves the issue.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by stefg » Sun Nov 24, 2019 6:53 pm

How can we clear all filters at once in opencart 3?

New member

Posts

Joined
Fri Oct 18, 2019 7:25 pm

Post by upotrebitel » Thu Jun 18, 2020 6:06 am

stefg wrote:
Sun Nov 24, 2019 6:53 pm
How can we clear all filters at once in opencart 3?
1. Open file "catalog/view/theme/default/template/extension/module/filter.twig"

2. Replace:

Code: Select all

<div class="panel-heading">{{ heading_title }}</div>
with

Code: Select all

<div class="panel-heading">{{ heading_title }}
  <span class="reset_filters"><a href='{{ action }}'><i class="reset_filters_icon"></i>{{ clear_filters }}</a></span>
</div>
3. Add to the bottom of the file code:

Code: Select all

<script type="text/javascript">
$(document).ready(function() {
  $('input[name^=\'filter\']:checked').each(function(element) {
    $(".reset_filters").show();
  });
});
</script>
4. Open file "catalog/view/theme/default/stylesheet/filter.twig" and add to the bottom:

Code: Select all

.reset_filters {
  display: none;
  float: right;
}

.reset_filters a {
  color: #23a1d1;  /* or text color, that respond to your shop */
}

.reset_filters_icon {
  background: url(../image/red_x.png) no-repeat;
  display: inline-block;
  width: 11px;
  height: 12px;
  margin-right: 3px;
  margin-top: 2px;
}
5. Download attached file "red_x.png" and save it to folder ""catalog/view/theme/default/image"

6. Open file "catalog/language/en-gb/extension/module/filter.php" and add this line:

Code: Select all

$_['clear_filters'] = 'Reset All';
If you using different language, do this step with corresponding file.

Attachments

red_x.png

red_x.png (1.75 KiB) Viewed 4909 times


Newbie

Posts

Joined
Sun Jun 07, 2020 11:02 am

Post by upotrebitel » Thu Jun 18, 2020 6:13 am

Excuse me, in step 4 I mean file: "catalog/view/theme/default/stylesheet/stylesheet.css"

Newbie

Posts

Joined
Sun Jun 07, 2020 11:02 am
Who is online

Users browsing this forum: No registered users and 11 guests