Minimal Character and Default Result

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Minimal Character and Default Result

This topic contains 23 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #17083
    div
    div
    Participant

    Hi,
    Thanks for answering all my pre-sales questions. I was excited to purchase based on the information provided. I however need some help – see below:

    1) The Minimal Character count to trigger works on PCs but not on mobile versions. Please check. See attached for the section I’m referring to.
    2) I’m trying to use the tool to search for Agents. Is there a way i can set a default Agent to be displayed if no result is found? For instance, if there is no agent for the particular location, display a specified Agent.

    Many thanks
    Femi

    #17092
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Femi,

    Thank you for the proper details, it helps me a lot 🙂

    1. On the General Options -> Mobile behavior panel the Trigger for mobile devices option was turned off. I have enabled it, now it should work after clearing your front-end cache.

    2. Well, there is not really an option for that, but it might be possible with a custom code. I have constructed a script, which will execute after the search process is completed, and if there are no results, it will execute another query to get the items as defined.

    Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Change the $ids array to the item ID (or comma separated post IDs if more), and it should do the trick. Let me know if you need help with this.

    Best,
    Ernest Marcinko

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


    #17234
    div
    div
    Participant
    You cannot access this content.
    #17239
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I think the $ids variable has to be an array of IDs, not a single id. So instead of this line:

    $ids = 247;

    it should be this:

    $ids = array(247);
    Best,
    Ernest Marcinko

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


    #17290
    div
    div
    Participant

    Hi Ernest,
    That’s what i tried at the onset but still not working.
    $ids = array(247); // Ids of posts/pages/cpt

    Do i need to make any adjustments in the settings section?

    Thanks
    Femi

    #17298
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Femi,

    Does it give any error messages, or just simply displays no results? Strangely this works on my test environment, so it might be related to a specific configuration, but I’m not sure.

    If you want, you can add temporary FTP details, and I can try to debug it on your server directly.

    Best,
    Ernest Marcinko

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


    #17306
    div
    div
    Participant

    Hi Ernest,
    It just does not come up with anything if the post code entered is not in the available list.

    The test site is hosted on a multi-site C-panel so i will need to arrange a temporary ftp account with the site owner.

    I however think the issue will be within the context of the WordPress administration i.e. the plugin and how i have set it up. If its working for you, it may be the configuration i have used. Do you want to have a look at that? The log in details provided earlier is still functional.

    thanks
    Femi

    #17308
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I managed to resolve it via the theme functions editor. It is not the safest method, but I was careful.

    Adding an additional argument to the code solved the problem. For future reference, this is the final code:

    Best,
    Ernest Marcinko

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


    #17309
    div
    div
    Participant

    Hi Ernest
    Excellent!!! Many thanks for that.

    I noticed though that it sometimes come up with an agent in addition to the default one. For instance, if you search for “wa7 3tu”, you get “Allan Melvin” and the default agent. It should work in such a way that you only get the valid agent or the default.

    Thanks for your tenacity on this. You’ve made the installation of a key tool stress-free

    Femi

    #17310
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    The code does not affect succesful searches, it only executes if there are no results.

    The search for ‘wa7 3tu’ shows the default agent as well, because it matches the ‘wa7’ keyword.

    Best,
    Ernest Marcinko

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


    #17312
    div
    div
    Participant

    Hi Ernest,
    Yes you are right. But if i take ‘wa7’ out of the default, it is no longer working when the post code is not valid.
    Sorry to be a bother but quite keen to get this to work.
    Thanks
    Femi

    #17313
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Femi,

    Yes, indeed. It happened, because my previous fix relied on searching that field, and I just picked a random string that matched it. But since it was changed, it no longer matches.

    I resolved it, by editing the custom code to look for a special string ‘_TEMPCODE_’, and I also added this string to the zip codes section of that agent, please don’t remove it: https://i.imgur.com/QdRQxm2.png

    Best,
    Ernest Marcinko

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


    #17316
    div
    div
    Participant

    Hi Ernest,
    Perfect! I’ll test as soon as i can and let you know. I’m sure it will be ok (lol).
    Thanks for your great help
    Femi

    #17853
    div
    div
    Participant

    Hi Earnest,
    I’ve come across another problem while testing. For instance if Agent A has a post code of M16 and Agent B has a post code of RM16, when i do a search using keyword “M16 xyz”, it retrieves the two Agents (I’m using Logic “OR”)

    What i want is for the tool to start the search from the beginning of the string “M….” such that only Agent A with post code of M16 is retrieved. Agent B with post code “RM16” should not be returned.

    Many thanks for the help so far

    Regards
    Femi

    #17864
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Femi,

    In that case, I suggest trying the ‘OR with exact word matches’ logic, it will probably do the trick: https://i.imgur.com/pSfQJtP.png

    Best,
    Ernest Marcinko

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


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

The topic ‘Minimal Character and Default Result’ is closed to new replies.