can the search read woocommerce variations?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support can the search read woocommerce variations?

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

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9409
    ekuk
    ekuk
    Participant

    Hi, can the search read woocommerce variations? One of the variations this site uses is a part number so for instance:

    http://www.lawtontools.co.uk/en/product/insulated-hammers-sledge/

    has a variation network rail reference 0039/030046

    The customer needs to be able to search for 0039/030046 to find the product. It currently isn’t doing this. I went into the setting and just told it to look at everything and reindexed but no joy.

    http://www.lawtontools.co.uk/en/?s=0039%2F030046&post_type=product

    Please tell me it can do this or I’ve got a massive job putting all those codes into content or tags or something..

    #9414
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thanks for the proper description and details, it helped me a lot.

    I was actually able to find a solution. By default this should work if the proper custom field is selected. First, I have fixed your configuration as the product variation custom post type and the attribute custom field was not selected: https://i.imgur.com/NdaUBGS.png

    This alone should have solved the issue, however there were no results for some reason. I’ve logged in via FTP and did a few tests, which revealed, that the reference number is not actually stored with the backslash character in the database, so instead of “0039/030046” they are stored as “0039030046”. Weird enough, but there is a solution.

    I’ve put the following code to the functions.php file in your active theme directory:

    This code removes the backslash character before the search phrase is passed. This is the best possible solution I could come up with, and it’s transparent to the user.

    Because no plugin files were modified, the solution will work after a plugin update as well.

    Best,
    Ernest Marcinko

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


    #9415
    ekuk
    ekuk
    Participant

    many thanks your help is much appreciated, I will definitely use your plugin again in the future

    #9416
    ekuk
    ekuk
    Participant

    sorry, one more glitch. Same thing really on some products they have two codes the network rail reference and also a part code. Again they will want it to be able to search part code. I added those attributes on and reindexed but they don’t appear in the search.

    eg

    a search for LT/SB/640/LID

    which should find this page http://www.lawtontools.co.uk/en/product/aluminium-storage-boxes/

    Am I missing something?

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

    Hi!

    Well, the problem was, that those reference numbers were stored with the backslash for some reason.

    I’ve modified the code to this:

    It should probably work correctly now. This snippet will duplicate the phrase if finds a backslash “/” chacarcter, and use the duplicate keyword without them as well.

    Best,
    Ernest Marcinko

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


    #9424
    ekuk
    ekuk
    Participant

    super thanks, all working now 🙂

    #9447
    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 :)


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

The topic ‘can the search read woocommerce variations?’ is closed to new replies.