help needed with basic search

4 posts by 3 authors in: Forums > CMS Builder
Last Post: October 23, 2018   (RSS)

Hi all,

I am trying to create a list from a page link, ie stock-listings.php?willows=1 AND stock_type=New

I can get the link to work if searching against just one record but cannot get it to work when trying to search against two values, I have tried using &, AND, and and even , between the values but nothing works for me I am obviously missing something in respect of correct syntax but cannot see what.

Both searches work on their own but not when I try to combine them.

The search needs to be carried out from values within the link not the display page, I am sure the solution is simple but all google searches seem to relate to doing the filtering within the code on the listing page not the link which is what I need.

Can this be done? if so any help to achieve this would be appreciated.

Thanks in advance.

By Deborah - October 17, 2018

Hi, willydoit.

This page in the online documentation might be of help:
https://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

The example given for multiple search conditions is:
listViewer.php?color=blue&size=XXL

The above works for me, but the instructions also state, "Note that if 'where' clause is specified in the list options then any form field keywords will be ignored."

~ Deborah

By daniel - October 18, 2018 - edited: October 18, 2018

Hi willydoit,

Yes, this should be possible. As Deborah mentioned above, the general syntax for this should be something like "stock-listings.php?willows=1&stock_type=New" - though it sounds like you may have tried this already. Could you describe what happens when you use that link? Do you get no results, incorrect results, or some sort of error?

If no/incorrect results, the first thing I'd want to do is double check the data. With this URL we're expecting to see records with both "willows=1" and "stock_type=New", so I find it useful to manually verify in the admin that the records we want to see on this page meet these criteria, just to rule it out. If the data looks good, could you copy/paste what your getRecords() array looks like for this page?

Thanks,

Daniel
Technical Lead
interactivetools.com