Okay
  Public Ticket #2029455
Search Field with Custom Database Table
Closed

Comments

  • Krista started the conversation

    I have a client who is announcing a recall of one of its products. They are looking to have a single-field search box on the front end of their site, where doctors can insert in the part number to see if it was affected by the recall. Once they enter the number, it will either tell them the part was recalled or it’s not.

    Here’s what I need:

    1- On the back end, I need to create a database to house the lot/part numbers that have been recalled. The only data we need to be stored is the lot/part code. So far, we have identified 4500 different lot/part numbers that could fit the bill. The lot numbers are currently in a CSV format.

    Ex. Lot Code: 102020T10

    2- On the front end, I need to have a search box with only one field (i.e. lot code) to put on a page that I want to devote to a "Recalled Product Search" page. On this page, the doctors (who aren’t WordPress users, so no login is needed to access the search page) would be able to see if a product they use is recalled based on the lot number they insert into the search text field. Once they insert the lot number and click ‘Search’, the results will show (ie. Yes, if your product was recalled, contact XXXX - No, your product is not recalled). It can either redirect them to a new page to display the results or ideally use ajax to fetch and output the results on the same “Recalled Product Search Page”.

    It seems as if this plugin could potentially help, but I wanted to reach out and confirm if this is something the plugin can accomplish before purchasing. Any insight is much appreciated. Thanks!

  •  2,514
    Aleksandar replied

    Hello Krista.

    Thank you for your interest in our plugin.

    Your request seems to be fairly simple.

    You can create a table that pulls the lot/part code, and the YES, NO options. For instance - your database has this info already inserted, so to pull it from the database, you can create a table linked to an existing data source (SQL), and generate a table like this:

    SELECT part_code,
           recall
    FROM products-table 

    That will create a table with two columns - Part Code and Recall.

    I guess you would want to hide the table before the search is done. To do this, you would need the Powerful Filters add-on. So, the only thing left for you to do is to assign a filter to the Part Code column, and put it in a form above the table. When doctors search for the part, the table will display only the row where that part no. is, and the Recall option will show whether it is recalled or not.

    You can, of course, add a link to that but it would have to be changed in each individual cell.

    For example, table displays this:

    4569601229.png

    To use the LINK as a real link that takes you to another page, the content of that cell has to look like this:

    YES, if your product was recalled contact <a href="url-to-the-other-page">LINK</a>

    I hope this helps.

    If you have any further questions, please feel free to ask, and I'll gladly explain everything.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables