Sku isn't searchable for new products

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Sku isn't searchable for new products

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

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #46301
    Webshop.Partners
    Webshop.Partners
    Participant

    Hi Ernest.

    It’s the solution with the 4.5 million records 🙂

    I have a problem with newly created products.

    It’s possible to search for the product itself; but not the SKU.

    The SKU is included in the index table; but it doesn’t seem to work.

    What am I doing wrong ?

    Best regards

    Webshop-Partners ApS
    Henrik Leth

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

    Hi,

    Are the products with the SKU issue imported in any way or form, or perhaps the SKU is added in later programmatically/3rd party plugin somehow?

    Best,
    Ernest Marcinko

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


    #46308
    Webshop.Partners
    Webshop.Partners
    Participant
    You cannot access this content.
    #46309
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, that very likely explains it.

    The products are probably created, saved and then the custom fields are added afterwards programmatically. However after adding a custom field
    will not trigger the index, as it is bound to the post creation/modification hooks.
    I strongly recommend triggering the save_post hook, as it will automatically execute any maintenance related tasks for wordpress after the custom fields were added as well – this is basically a way to tell the system that a post/cpt had been modified.
    Alternatively you can enable this option to trigger an index during programmatical custom field changes, however that can be very CPU intensive as it triggers a lot, so definitely monitor the server during imports to make sure it does not time out.

    Unfortunately the missing custom fields can only be added either by:
    – triggering the save_post hook for each of the newly imported posts – probably the easiest solution
    – manually removing the newer posts data from the index via IDs from the wp_asp_index table and then “continue index” to refresh the data – this can be also very simple by running an SQL command on the table
    – or deleting and recreating the whole index
    ..as it is not possible to determine which of the posts have missing SKU data from the index.

    Best,
    Ernest Marcinko

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


    #46313
    Webshop.Partners
    Webshop.Partners
    Participant
    You cannot access this content.
    #46315
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You are welcome Henrik.

    Most definitely. Some import/export solutions do that automatically, but it’s not very well documented and not mandatory at all when adding custom fields. I first met with this issue about 8 years ago, and still often times see this – hence I added an option to trigger the index when custom fields are added to the post. But that is not a very clean solution unfortunately.

    Best,
    Ernest Marcinko

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


    #46322
    Webshop.Partners
    Webshop.Partners
    Participant
    You cannot access this content.
    #46323
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you very much 🙂 Agreed, they will resolve this in no time for sure.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.