Sorting with pagination not working
-
I have implemented this plugin, now filters are working correctly but sorting has stopped working with pagination, like it only sorts the first 10 products on the page, then i click on the view more, it doesn’t sort that. ideally it should sort all the data from the database and then perform pagination. but it is not working.
- This topic was modified 4 months, 2 weeks ago by riyaseasternts.
The page I need help with: [log in to see the link]
-
Hello,
Plugin do not modify how sorting functionality work.
First of all try to disable our plugin and check is it work correct.
Regards,
OlegBut after disabling your plugin, it has starting refreshing the page with querystring ?orderby otherwise it was not refreshing and loading the data with ajax. Definitely it’s says ajax filters but I am not talking about filters, I am talking about sorting with ajax.
Okay, I have another issue. I am using your filter on custom page called ‘sale’. Where I am displaying the ‘sale’ products. now, the filters should display only related category that the current products are having, but it is listing all the categories.
How can I pass the query in this filter? https://prnt.sc/OGgmSuIJtfoo- This reply was modified 4 months, 1 week ago by riyaseasternts.
Hello,
Check that option “Values count and output” is set to “Filters are applied in recounting attribute values; empty values are removed on the server-side”.
Regards,
Olegbut it is not working on the custom template file. as I told you.
- This reply was modified 4 months, 1 week ago by riyaseasternts.
this is the template file code
<?php
/**
?* Template Name: Sale Page
?*/
$shop = jws_check_layout_shop();
get_header( 'shop' );
echo do_shortcode('[hf_template id="15255"]');
?>
<div class="shop-page">
<div class="<?php echo esc_attr($shop['class_wap']); ?>">
? ? <div class="row">
? ? ? ? ?<?php if($shop['position'] == 'left' || $shop['filter_layout'] == 'sideout') { ?>
? ? ? ? ? ? <div class="<?php echo esc_attr($shop['sidebar_col']); ?>">
? ? ? ? ? ? ? ? <div class="jws_sticky_move">
? ? ? ? ? ? ? ? <div class="jws-filter-modal">
? ? ? ? ? ? ? ? ? ? <div class="modal-overlay"></div>
? ? ? ? ? ? ? ? ? ? <div class="siderbar-inner jws-scrollbar modal-content sidebar left">
? ? ? ? ? ? ? ? ? ? <div class="modal-top">
? ? ? ? ? ? ? ? ? ? ? ? <span class="modal-title"><?php echo esc_html__('FILTERS','auriane'); ?></span>
? ? ? ? ? ? ? ? ? ? ? ? <span class="modal-close"><?php echo esc_html__('Close','auriane'); ?></span>
? ? ? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? ? ? ? ? ? <?php
? ? ? ? ? ? ? ? ? ? ? ? ? ? if ( is_active_sidebar( 'sidebar-shop' ) ) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dynamic_sidebar( 'sidebar-shop' );
? ? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? ?>
? ? ? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? ? ? ? <?php
? ? ? ? ? ? ? ? ? ? ? ? if ( is_active_sidebar( 'sidebar-shop-banner' ) ) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? echo '<div class="shop-banner">';
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dynamic_sidebar( 'sidebar-shop-banner' );
? ? ? ? ? ? ? ? ? ? ? ? ? ? echo '</div>'; ? ?
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ?>
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? ? ? </div>
? ? ? ? ? ? </div>
? ? ? ? <?php } ?>
? ? ? ? <div class="<?php echo esc_attr($shop['content_col']); ??>">
? ? ? ? ? ? <div id="primary" class="content-area">
? ? ? ? ? ? ? ? <main id="main" class="site-main" role="main">
? ? ? ? ? ? ? ? ? ? <?php
? ? ? ? ? ? ? ? ? ? shop_banner_content();
? ? ? ? ? ? ? ? ? ? do_action( 'woocommerce_before_shop_loop' );
? ? ? ? ? ? ? ? ? ?/* ?$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
? ? ? ? ? ? ? ? ? ? $args = array(
? ? ? ? ? ? ? ? ? ? ? ? 'post_type' => 'product',
? ? ? ? ? ? ? ? ? ? ? ? 'posts_per_page' => 18,
? ? ? ? ? ? ? ? ? ? ? ? 'paged' => $paged,
? ? ? ? ? ? ? ? ? ? ? ? 'orderby' => isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : 'menu_order',
? ? ? ? ? ? ? ? ? ? ? ? 'order' => isset($_GET['order']) ? wc_clean($_GET['order']) : 'asc',
? ? ? ? ? ? ? ? ? ? ? ? 'tax_query' => array(
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'relation' => 'OR',
? ? ? ? ? ? ? ? ? ? ? ? ? ? array(
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'taxonomy' => 'product_tag',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'field' ? ?=> 'slug',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'terms' ? ?=> 'sale',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ),
? ? ? ? ? ? ? ? ? ? ? ? ? ? array('wpf_tax' => 1)
? ? ? ? ? ? ? ? ? ? ? ? ),
? ? ? ? ? ? ? ? ? ? ? ? 'wpf_query' => 1
? ? ? ? ? ? ? ? ? ? );
? ? ? ? ? ? ? ? ? ? $custom_query = new WP_Query($args);
? ? ? ? ? ? ? ? ? ? $GLOBALS['wp_query'] = $custom_query; // Override global query so that it will display total number of products */
? ? ? ? ? ? ? ? ? ? $orderby = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : 'menu_order';
? ? ? ? ? ? ? ? ? ? $ordersort = isset($_GET['order']) ? wc_clean($_GET['order']) : 'asc';
? ? ? ? ? ? ? ? ? ? ob_start();
? ? ? ? ? ? ? ? ? ? echo do_shortcode('[products tag="sale" columns="3" limit="18" paginate="true" orderby="'.$orderby.'" order="'.$order.'"]');
? ? ? ? ? ? ? ? ? ? $products_output = ob_get_clean();
? ? ? ? ? ? ? ? ? ? ? ? // Check if the output contains products
? ? ? ? ? ? ? ? ? ? if (strpos($products_output, 'product') !== false) {
? ? ? ? ? ? ? ? ? ? ? ? echo $products_output;
? ? ? ? ? ? ? ? ? ? ? ? do_action( 'woocommerce_after_shop_loop' );
? ? ? ? ? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? ? ? ? ? do_action( 'woocommerce_no_products_found' );
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ?>
? ? ? ? ? ? ? ? </main>
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? </div>
</div>
<?php if($shop['filter_layout'] == 'modal') : ?>
? ? <div class="jws-filter-modal">
? ? ? ? <div class="modal-overlay"></div>
? ? ? ? <div class="modal-content siderbar-inner jws-scrollbar">
? ? ? ? ? ? <div class="modal-top">
? ? ? ? ? ? ? ? <span class="modal-title"><?php echo esc_html__('FILTERS','auriane'); ?></span>
? ? ? ? ? ? ? ? <span class="modal-close"><?php echo esc_html__('Close','auriane'); ?></span>
? ? ? ? ? ? </div>
? ? ? ? ? ? <?php
? ? ? ? ? ? ? if ( is_active_sidebar( 'sidebar-shop-filter-modal' ) ) {
? ? ? ? ? ? ? ? ? ?dynamic_sidebar( 'sidebar-shop-filter-modal' );
? ? ? ? ? ? ? }
? ? ? ? ? ? ?>
? ? ? ? </div>
? ? </div>
<?php endif; ?>
</div>
<?php ?
get_footer( 'shop' ); ?>Also category filter is not showing on basis of current products displaying on custom templates. so what needs to be modified in the query?
Hello,
If you use some custom query, then add also two arguments to it'bapf_apply' = true
'bapf_save_query' = trueThen filters must be applied to it.
Regards,
Oleg
- You must be logged in to reply to this topic.