Support Forum

You need to log-in to create request (topic) to the support

Approximation in filter

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see green button on the right side) and press Save button.
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi Team,

I am creating a filter for cartons(Packaging boxes), I have used product meta options to store the values of Length, breadth and height. Now using range filter from using meta values it is working fine.

Is there a possibility that I can add approximation i.e. 10% additional value to the range slider min & max values.

Hello

Unfortunately, the plugin does not have such a feature. You need customization of the code.

Read  this - https://products-filter.com/hook/woof_get_meta_query/ - you can find a search query for the slider and change the minimum and maximum

Thanks, Pablo for quick response, Is it possible if we can use min & max input by the text input field.

Is there is any reference code available for a filter that would be similar like the link provided in private data or similar layout possible with step filter?

Cheers
Ankur Tyagi

Hello Ankur

to change the template you need customization of CSS code. Unfortunately we have no example.

Hi Pablo,

I would like to create a text input option for my range slider filters, where I can create a custom template for the same.

Hello

Read  this  please - https://products-filter.com/can-i-override-any-extension-view-file-for-my-site-needs/

Hi Pablo,

I have created the filter using HTML form input & javascript to create URL & using a filter of woof.

URL added in example private data.

I would like to use 3 meta input(L, B, H) or 1 meta input(Volume) i.e. Use only one input set at once.

Currently, in the shared URL, I am automatically calculating the volume but the user can use volume input instead L, B, H.

Is that feasible?

Hello

I  think yes! But this does not depend on my plugin, this is your customization.  You should customize JS  to also have an inverse relationship with (L, B, H)  "automatically calculating"  Or  use  a tag "readonly"  for  meta input(Volume)

Thanks again, will update the same in JS file.

/**
* Adds WooCommerce catalog sorting options using postmeta, such as custom fields
**/
function nimm3_add_postmeta_ordering_args( $sort_args ) {
global $product;
$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
switch( $orderby_value ) {

// Name your sortby key whatever you'd like; must correspond to the $sortby in the next function
case 'pa_laenge-in-mm':
$sort_args['orderby'] = 'meta_value_num meta_value';
// Sort by meta_value because we're using alphabetic sorting
$sort_args['order'] = 'desc';
$sort_args['meta_key'] = 'pa_laenge-in-mm';
// use the meta key you've set for your custom field, i.e., something like "location" or "_wholesale_price"
break;

}

return $sort_args;
}
add_filter( 'woocommerce_get_catalog_ordering_args', 'nimm3_add_postmeta_ordering_args' );

// Add these new sorting arguments to the sortby options on the frontend
function nimm3_add_new_postmeta_orderby( $sortby ) {

// Adjust the text as desired
$sortby['pa_laenge-in-mm'] = __( 'Sortieren nach länge', 'woocommerce' );
//$sortby['breite_in_mm'] = __( 'Sortieren nach breite', 'woocommerce' );

return $sortby;
}
add_filter( 'woocommerce_default_catalog_orderby_options', 'nimm3_add_new_postmeta_orderby' );
add_filter( 'woocommerce_catalog_orderby', 'nimm3_add_new_postmeta_orderby' );

Cannot get it worked, is there anything in woof we have for custom sorting of products?

Like I would like to set "length" as my default  desc sorting.

Thanks in advance.

 

 

Hello

Add  your  custom sorting here - https://products-filter.com/hook/woof_order_catalog/

Thanks for sharing, do i have to add the case or just meta_key.

If I add meta_key, it's not working.

I have set the default sorting based on meta_key but that is not working with WOOF.

Awaiting for your guidance.

Hello

Use this  hook  to  add  custom  sorting

Example:

add_filter('woof_order_catalog', function($sort_args){

$sort_args['orderby'] = 'meta_value_num meta_value';
// Sort by meta_value because we're using alphabetic sorting
$sort_args['order'] = 'desc';
$sort_args['meta_key'] = 'pa_laenge-in-mm';

return $sort_args;

});

Thanks Pablo, that was smooth. It works like charm. 

I would like to know is the standard multi-metadata keys would be valid for sorting. i.e.

$q = new WP_Query( array(
    'meta_query' => array(
        'relation' => 'AND',
        'length_clause' => array(
            'key' => 'state',
            'value' => 'pa_laenge-in-mm',
        ),
        'bredth_clause' => array(
            'key' => 'pa_breite-in-mm',
            'compare' => 'EXISTS',
        ), 
    ),
    'orderby' => array( 
        'length_clause' => 'ASC',
        'bredth_clause' => 'ASC',
    ),
) );

Shall I add it to plugin functions.php?

Any existing reference available where sorting is done by multiple post meta fields.

Thanks

Hello

unfortunately I did not understand your question

Everything is described here  - https://wordpress.stackexchange.com/questions/246355/order-by-multiple-meta-key-and-meta-value

unfortunately this sorting cannot be used for this hook

Hello Pablo,

I am exactly looking for: order-by-multiple-meta-key-and-meta-value

My meta keys are num, but sorting is not working. All links are the same as before,

So far couldn't make it work.

Thanks

Hello

In this case, you need to redo the WP query

Use  hooks - woof_products_query  AND  woocommerce_product_query