Fix archive filter

This commit is contained in:
Hoang Huu
2020-01-30 10:20:37 +07:00
parent 0b5550d8aa
commit 630f0dd573
3 changed files with 22 additions and 9 deletions

View File

@@ -1544,15 +1544,19 @@
// // Sortable Change // //
$( 'body' ).delegate( '#opalestate-sortable-form select', 'change', function () {
var ps = '';
if ( $( 'form.opalestate-search-form' ).length > 0 ) {
var $form = $( 'form.opalestate-search-form' );
var ps = $form.serialize() + '&opalsortable=' + $( this ).val() + '&display=' +
$( '.display-mode a.active' ).data( 'mode' );
if ( $('body').hasClass( 'archive' ) ) {
ps = 'opalsortable=' + $( this ).val() + '&display=' +
$( '.display-mode a.active' ).data( 'mode' );
} else {
ps = $form.serialize() + '&opalsortable=' + $( this ).val() + '&display=' +
$( '.display-mode a.active' ).data( 'mode' );
}
}
if ( $( '.opalesate-properties-results' ) && ps ) {
if ( $( '.opalesate-properties-results' ).length > 0 && ps ) {
if ( history.pushState ) {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname +
'?' + ps;
@@ -1560,9 +1564,16 @@
updatePropertiesByParseringHtml( newurl );
}
} else {
if ( history.pushState && $('body').hasClass( 'archive' ) ) {
var newurl = window.location.protocol + '//' + window.location.host + window.location.pathname +
'?' + ps;
window.history.pushState( { path: newurl }, '', newurl );
}
$( '#opalestate-sortable-form' ).submit();
}
} );
// display mode
$( 'body' ).delegate( '.display-mode a', 'click', function () {
if ( $( '.opalesate-properties-results' ).length > 0 ) {