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.
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.
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
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.
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.
for link, you can just add this to the controller to call for the category once again.
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
$this->data['reload'] = $this->url->link('product/category', 'path=' . $this->request->get['path']);
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');"
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.
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.
1. Open file "catalog/view/theme/default/template/extension/module/filter.twig"
2. Replace:
Code: Select all
<div class="panel-heading">{{ heading_title }}</div>
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>
Code: Select all
<script type="text/javascript">
$(document).ready(function() {
$('input[name^=\'filter\']:checked').each(function(element) {
$(".reset_filters").show();
});
});
</script>
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;
}
6. Open file "catalog/language/en-gb/extension/module/filter.php" and add this line:
Code: Select all
$_['clear_filters'] = 'Reset All';
Attachments
red_x.png (1.75 KiB) Viewed 4998 times
Who is online
Users browsing this forum: No registered users and 40 guests