Link to home
Start Free TrialLog in
Avatar of M A
M AFlag for United States of America

asked on

Automate filter in Opencart.

Automate filter in Opencart default template.
<script type="text/javascript">
$(document).ready(function() {
    // hide the "submit" button
    $('#button-filter').hide();

    // bind onChange event to the checkboxes
    $('.click_checkbox_manufacturers-filter').live('change', function() {
        filter = [];

        $('.box-filter input[type=\'checkbox\']:checked').each(function(element) {
            filter.push(this.value);
        });

        window.location = '<?php echo $action; ?>&filter=' + filter.join(',');
    });
});
//--></script>

Open in new window


I replaced with this code but it hide the refine search button but it is not giving the right result.
Now the refine button is hidden but not getting the right result. I want to update the filter when I tick the tickbox.
User generated image
Is there anyone who can guide me to get the filter on check box event.
Avatar of Leonidas Dosas
Leonidas Dosas
Flag of Greece image

$(document).ready(function() {
    // hide the "submit" button
    
    var filter = [];
    // I suggest you to change the live() method to on
    $('.click_checkbox_manufacturers-filter').on('change', function() {
         filter=[];
         $('#button-filter').hide();
        $('.box-filter input[type=\'checkbox\']:checked').each(function(element) {
            filter.push(this.value);
        });

        window.location = '<?php echo $action; ?>&filter=' + filter.join(',');
    });
});

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of M A
M A
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial