Problem with filters when redirect to result page.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Problem with filters when redirect to result page.

This topic contains 14 replies, has 2 voices, and was last updated by awaistufail02 awaistufail02 4 years, 4 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #24752
    awaistufail02
    awaistufail02
    Participant

    Hi There!
    I have used range slider for selecting a range of product price and a button (with name Let’s Go) to redirect to a custom results page on my homepage. But when I click on Let’s Go button the products displayed on the result page are not between the selected price range. The same problem with other search filters too.
    I also want to tell you that I’m using the same result page for my main menu search and when I type anything in the search field of main menu search and press enter it takes me to result page and shows the correct results. So result page should not be the problem. Please help me fix this problem.
    If you need access to my admin panel or ftp server to solve this problem please let me now. Thanks

    Attachments:
    You must be logged in to view attached files.
    #24768
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I think the issuse is, that the results override is not working properly. I see the plugin does send the search results to the results page, but those are not the correct ones displayed. This could happen, if:
    – There is another search plugin active, that will override the results sent by ajax search pro
    – ..or there is a custom built-in search query within the theme functions or template files

    First I recommend checking if there are any custom search solutions active, and turning them off. If that does nothing, well in that case I can take a look at the theme source files directly, to see if there is any custom query running – and deactivate it programatically if possible. For that, please add temporary FTP and back-end details, as I will have to edit the files.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24777
    awaistufail02
    awaistufail02
    Participant
    You cannot access this content.
    #24794
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I may have found solutions to both issues. The search override was a bit complicated. In both cases I had to make direct changes to the search plugin itself – please do not re-install it for now.
    I will make sure to include these changes in the upcoming release.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24809
    awaistufail02
    awaistufail02
    Participant

    Thanks a lot Sir!
    I really appreciate your work.
    I have one more issue which is little different. Should I tell you here or should I open a new ticket?

    #24810
    awaistufail02
    awaistufail02
    Participant
    You cannot access this content.
    #24812
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24815
    awaistufail02
    awaistufail02
    Participant
    You cannot access this content.
    #24817
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you!

    The issue must have been something else, because it works completely fine on my end at the moment. I also made the change to fix the search, and it still works without issues:
    – Search page: https://i.imgur.com/g2n6Rx1.png
    – Product pages: https://i.imgur.com/KjTTAGe.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24818
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you!

    The issue must have been something else, because it works completely fine on my end at the moment. I also made the change to fix the search, and it still works without issues:
    – Search page: https://i.imgur.com/g2n6Rx1.png
    – Product pages: https://i.imgur.com/KjTTAGe.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24823
    awaistufail02
    awaistufail02
    Participant

    Thank You!
    It’s working fine on my end too but in case if it went wrong again then I’ll let you know.

    #24824
    awaistufail02
    awaistufail02
    Participant

    I know the support will be offline for Saturday and Sunday so can you please guide me little bit about what to do if something went wrong again?
    Thank You!

    #24825
    awaistufail02
    awaistufail02
    Participant

    And also I want to ask that on the following page:
    https://pkmobilereviews.com/best-samsung-phones/
    I have displayed product’s name, price and rating
    how can I display some main features of my product like Camera, RAM, Battery too?
    I know I can display these things by custom fields but I am not able to find custom fields for these things. I’ll be very thankful if you help me out.

    Attachments:
    You must be logged in to view attached files.
    #24846
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I honestly don’t know what exactly went wrong there. I suppose it was caching or something?

    The product features seems to be stored within the ‘aps-product-features’ custom field. I am not sure about how it is stored, but I am guessing it stores all the features as an array(?).
    For that, you will need a custom code to print to the results list.

    I have constructed a custom code, that may help you start with it.
    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_filter( 'asp_results', 'asp_custom_field_to_results', 10, 1 ); 
    function asp_custom_field_to_results( $results ) {
      $custom_field = 'aps-product-features'; // Enter the custom field name
      $field = 'content';               // 'title' or 'content'
      $position = 'after';           // 'before' or 'after'
      $delimiter = ' ';               // character between the field value and the field
    
      foreach ($results as $k=>&$r) {
        if ($r->content_type != 'pagepost') continue;
        if ( function_exists('get_field') )
            $meta_value = get_field( $r->id, $custom_field, true ); // ACF support
        else
            $meta_value = get_post_meta( $r->id, $custom_field, true );
                
        // Modify the post title to add the meta value
        if ( !empty($meta_value) ) {
          if ( is_array($meta_value) ) {
            $s = '';
            foreach ( $meta_value as $v ) {
              if ( is_array($v) && isset($v['name'], $v['value']) ) {
                 $s .= "<p>".$v['name'].": ".$v['value']."</p>";
              }
            }
            $meta_value = $s;
          }
        
          if ( $field == 'title' ) {
            if ( $position == 'before' )
              $r->title  = $meta_value . $delimiter . $r->title;
            else
              $r->title  .= $delimiter . $meta_value;
          } else {
            if ( $position == 'before' )
              $r->content  = $meta_value . $delimiter . $r->content;
            else
              $r->content  .= $delimiter . $meta_value;
          }
        }
      }
     
      return $results;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #24884
    awaistufail02
    awaistufail02
    Participant

    Thanks a lot…!

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.