This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

terms filter on custom page

Home Forums Product Support Forums Ajax Search Pro for WordPress Support terms filter on custom page

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #52518
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure!

    You could create a hidden filter, with this exact configuration, as well as make sure this option is turned off. That will make sure that the plugin returns only items where the expiration_date field exists and is greated than 0.

    #52569
    gavriel_wtTjgavriel_wtTj
    Participant

    do you think this is possible?

    #52573
    gavriel_wtTjgavriel_wtTj
    Participant

    sorry, didnt see you replied as it was on page 2 😉

    i just tried your set but it’s not working 🙁 Could it be because my field is a timestamp and it’s checking against the value 0?

    #52576
    Ernest MarcinkoErnest Marcinko
    Keymaster

    If the operator (6) is set to “MORE THEN”, then it should be okay, as it checks if the value is above 0 – so make sure that is set correctly, it’s very important.

    #52578
    gavriel_wtTjgavriel_wtTj
    Participant

    yes i have set it as you mentioned . see attached image

    could it have anything to do with the fact that this is a jetengine metafield?

    #52584
    Ernest MarcinkoErnest Marcinko
    Keymaster

    It shouldn’t make a difference. If the field value is indeed a timestamp (number), then it should be just fine. What exactly happens, you get no results after adding the filter?

    #52587
    gavriel_wtTjgavriel_wtTj
    Participant

    dosnt seem like it does anything. I still get the results of old products that have the expiration_date in the past (see screenshot)

    #52593
    Ernest MarcinkoErnest Marcinko
    Keymaster

    My mistake – I completely missunderstood your query here. I thought that the field was something different, I’m very sorry.

    In this case it is possible, but instead of the hidden filter, you will need to use a datepicker filter, so this configuration: https://i.imgur.com/VDLd5pB.png

    Don’t worry, the filter does not have to be visible, it will still work. This should do the trick, if the field is indeed a timestamp.

    #52594
    gavriel_wtTjgavriel_wtTj
    Participant

    Good morning
    see attached screenshot. I just tried with this custom field setup and this works. But i would have to show the settings and one has to click on it to make it work.

    So i tried with adding 1737621233 in the hidden value (when using the hidden field setup) and this works.. which makes sense as 0 is the 1970 🙂 and i want to show events with expiration more or equal that TODAY. Do you have any macro that I can add to the value field for today/current datetime?

    #52596
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure! You can try this:

    add_filter('asp_query_args', function ( $args, $search_id, $options ) {
    	$args['post_meta_filter'][] = array(
    		'key'           => 'expiration_date',
    		'value'         => time(),
    		'operator'      => '>',
    		'allow_missing' => true,
    	);
    	return $args;
    }, 10, 3);

    You can set the ‘allow_missing’ to false if you want to exclude items where the expiration_date field does not exist 🙂

    #52605
    gavriel_wtTjgavriel_wtTj
    Participant

    beautiful! that seems to have done the trick

    this will work on any filter now . .right?

    #52606
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Yes, this should work with any filter now.

    #52607
    gavriel_wtTjgavriel_wtTj
    Participant

    great. Ernest, i really want to thank you for the top support!!

    #52608
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 14 posts - 16 through 29 (of 29 total)
  • You must be logged in to reply to this topic.