Uname: Linux webm016.cluster127.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 7.4.33 [ PHP INFO ] PHP os: Linux
Server Ip: 54.36.31.145
Your Ip: 216.73.216.182
User: homesquasz (91404) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : class-relevanssi-compatibility.php
<?php

if( !class_exists('Agni_Relevanssi') ){

    class Agni_Relevanssi{
        public function __construct(){

            add_filter( 'woocommerce_redirect_single_search_result', '__return_false' );
            add_filter( 'relevanssi_orderby', array( $this, 'orderby' ) );
            add_filter( 'relevanssi_order', array( $this, 'order' ) );

        }

        public function orderby( $orderby ) {
            if ( in_array( $orderby, array( 'price', 'price-desc' ), true ) ) {
                global $wp_query;
                $orderby = 'meta_value_num';
                $wp_query->query_vars['meta_key'] = '_regular_price';
            }
            if ( 'date ID' === $orderby ) {
                global $wp_query;
                $orderby = 'post_date';
            }
            if ( 'popularity' === $orderby ) {
                global $wp_query, $rlv_wc_order;
                $orderby = 'meta_value_num';
                $rlv_wc_order = 'desc';
                $wp_query->query_vars['meta_key'] = 'total_sales';
            }
            return $orderby;
        }

        public function order( $order ) {
            global $rlv_wc_order;
            if ( $rlv_wc_order ) {
                $order = $rlv_wc_order;
            }
            return $order;
        }

    }

    $agni_relevanssi = new Agni_Relevanssi();

}
© 2026 GrazzMean