Result ordering questions

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29131
    dviolante
    dviolante
    Participant

    Hello, good day.
    Im contacting you because i need your help / advice about Result ordering for my Woocommerce Products in my https://hannainst.com.mx/ website.

    Let me explain:

    In this website my client have many products with “similar” SKUs, for example:

    HI9829 (MAIN product)
    HI9829-10 (sub product of HI9829 main product)
    HI9829-12/13 (sub product of HI9829 main product)
    HI9829-15 (sub product of HI9829 main product)
    HI9829-18 (sub product of HI9829 main product)

    Each one are separated products.

    My client asked me to achieve that when an user searches with AJAX Search Pro plugin for HI9829, in both Results (popup and page results), the MAIN product (HI9829) be shown first, then sub products be shown.
    After thinking some time, i realized that using at General Options / Ordering / Primary ordering use a Custom Field asending, and with the help of Advanced Custom Fields plugin i created a new NUMERIC field in ACF for Products, and in
    the product page, i assign a different number (in the order i want they appear), so this numbers will be used for the Ordering Results.

    For this specific SKU is working my “solution”.

    But, if i try to search SKUs that are similar that contains first letters/numbers, but with extra characters, but they are DIFFERENT products my Ordering Results are not as expected.

    For example my client have many SKUs like this

    HI709 (MAIN product) [assigned number 1 in my custom field]
    HI709-11 (sub product of HI709 main product) [assigned number 2 in my custom field]
    HI709-25 (sub product of HI709 main product) [assigned number 3 in my custom field]
    HI7090M (completely different product) [no number assigned yet]
    HI7090L (completely different product) [no number assigned yet]
    HI7091L (completely different product) [no number assigned yet]
    HI7092M (completely different product) [no number assigned yet]
    HI7092L (completely different product) [no number assigned yet]
    HI70960 (completely different product) [no number assigned yet]

    In this example, if i search HI709 im not getting the order i need, the first results are the products that have no number in the ACF custom field and only the HI709 products.

    So, my questions are:

    1 – Does my “solution” with ACF plugin is the “best” way?
    3 – Is there a better native solution for my need of Result Ordering?
    2 – Is any way that in a “near” future does AJAX search Pro plugin have some native feature like this in Posts to assign a Relevance order?
    3 – Is any way that in a “near” future does AJAX search Pro plugin have a 3rd, 4th Ordering options? So i can have for example: Primary ordering (custom field), Secondary ordering (Relevance), Third ordering (Title descending/ascending), 4th ordering (Date descending/ascending)

    With this long explanation (i hope i explained myself correctly) what advice could you give me for this Result ordering?

    Thank you.

    #29132
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you for all the details, it helps us a lot.

    The general issue with the custom field ordering in this case is, that if the field for a particular product does not exist (not set), then it defaults to “0”. And 0 is lower than 1, 2, 3… etc.. so the items with the unset field value are put to the first place. Using a custom field based ordering is rather useful when all the items can have a field value, or perhaps using a descending ordering instead of ascending may also help.

    What about ordering by the _sku field? Looking at the list of the required ordering, it is basically ordered by SKU ascending. Wouldn’t that be a better way?

    If that is not the case, then instead of this, I recommend the results priorities feature. It lets you set numeric priorities to each result, which sort of fixates their position when they match. It is not exactly the same as the ordering, but in your case it may actually work.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.