• Resolved allfrom1supply

    (@allfrom1supply)


    Hi again. Final question (for today ;))

    Is there a parameter I can add to my links to perform the ‘clear search’ function? I have not seen this error but one of our employees at another location was on a Teams meeting and he showed us how he did some searches and the values were carried forward – I couldn’t reproduce it but he did it multiple times. It could just be his browser or addons but figured I’d play it safe if I could and on the links I created to go back to the main page for a new search make sure I flushed any values.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Steven

    (@shazahm1hotmailcom)

    The “Clear Search” button is simply a link back to the directory home page. There is not a query var associated with it.

    Could you explain more by the searches were carried over? I’m not quite sure what that would be.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Okay so we have three searches as that is the way I was asked to do it. All link from this page.

    https://help.allfrom1supply.com/help-center/contractor-search/

    Here are the 3 links. I pass the parameter in the url to select the main service category i.e. paint, maintenance or construction

    https://help.allfrom1supply.com/contractor-search/painter-search/?cn-cat-in%5B%5D=3

    https://help.allfrom1supply.com/contractor-search/maintenance-repair-search/?cn-cat-in%5B%5D=4

    https://help.allfrom1supply.com/contractor-search/construction-remodeling/?cn-cat-in%5B%5D=5

    Each of these target pages has code similar to this:

    [connections template=”slim-plus” category=3 order_by=”id|RANDOM” enable_pagination=’TRUE’ enable_keyword=’TRUE’ enable_note=’TRUE’ image_width=100 image_height=100 enable_bio_head=’TRUE’ enable_note_head=’TRUE’ show_title=’TRUE’ show_org=’TRUE’ show_contact_name=’TRUE’ show_phone_numbers=’TRUE’ show_email=’TRUE’ show_social_media=’TRUE’ show_links=’TRUE’ show_addresses=’TRUE’ str_read_more=”Contact Details”]

    Select filters and press SEARCH to return filtered results, or use the keyword or zipcode search options.

    [cn_multi_category_search category=’10|Show All| Search by Service| Showing Contractors by Service: <u>%s</u>|select,3|Show All| Filter by Painting Services| Painting: <u>%s</u>|checklist,90|Show All| Job Size | Job Size: <u>%s</u>|checklist,11|Show All| Filter by State | State: <u>%s</u>|checklist’ show_category_count=true placeholder_zip=’SEARCH BY ZIPCODE’ enable_zipcode=false radius_options=’200:200 Miles’ radius_unit=mi]

    There is also a search results page which has this code:

    [connections template=”slim-plus” order_by=”id|RANDOM” enable_keyword=’TRUE’ image_width=200 image_height=200 enable_note=’FALSE’ show_email=’TRUE’]

    On each of the search pages I simply put a link back to the main contractor search page: https://help.allfrom1supply.com/help-center/contractor-search/ and on the Search Results page I simply named it New Search.

    This works fine for me in my tests. Our remote guy was showing us that when he did a search for Commercial Painters, then selected new search and and went back to search for one of the other categories like Maintenance that the results page showed that it was returning the results which included both the previous and current searches. I myself did not have that occur.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    I suspect this is caused by his browser displaying locally cached pages, ignoring the change in the query parameters. I think this could happen if the browser back button is clicked instead of clicking the new search button.

    You should actually have a single page and not four (including the /search-results/ page).

    Use the [cn-content] shortcode to conditionally show different content based on the current condition. Here’s a link to the shortcode doc page:

    Here’s an example that I think might be close to what you want to achieve (likely requiring tweaking to get it exactly correct). Please do not copy-paste the examples because they may contain “fancy” [these break the WP shortcode parser] quotes instead of straight quotes.

    Important, notice that both the Connections and Advanced Search shortcodes that I added trialing slashes. These are required by the WP Shortcode parser when mixing enclosing and self-enclosing shortcodes on the same page.

    [cn-content condition=is_category parameter=3]Put the Painter's, Maint., and Construction header here with the Painter's section highlighted.[/cn-content]
    
    [cn-content condition=is_category parameter=4]Put the Painter's, Maint., and Construction header here with the Maint. section highlighted.[/cn-content]
    
    [cn-content condition=is_category parameter=5]Put the Painter's, Maint., and Construction header here with the Construction section highlighted.[/cn-content]
    
    [connections template='slim-plus' order_by='id|RANDOM' enable_pagination='TRUE' enable_keyword='TRUE' enable_note='TRUE' image_width=100 image_height=100 enable_bio_head='TRUE’ enable_note_head='TRUE' show_title='TRUE' show_org='TRUE' show_contact_name='TRUE' show_phone_numbers='TRUE' show_email='TRUE' show_social_media='TRUE' show_links=’TRUE’ show_addresses='TRUE' str_read_more='Contact Details'/]
    
    [cn_multi_category_search category='10|Show All| Search by Service| Showing Contractors by Service: <u>%s</u>|select,3|Show All| Filter by Painting Services| Painting: <u>%s</u>|checklist,90|Show All| Job Size | Job Size: <u>%s</u>|checklist,11|Show All| Filter by State | State: <u>%s</u>|checklist' show_category_count=true placeholder_zip='SEARCH BY ZIPCODE' enable_zipcode=false radius_options='200:200 Miles' radius_unit=mi/]

    I am not certain, with the details supplied, how you are routing the query to the /search-results/ page, but this should instead route to the directory page.

    Other tips, use the is_search condition to display content when performing a search query and use the is_front_page to display content only on the directory front page.

    I hope this helps; please let me know.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Thanks Steven. I’ll dig through this information. I appreciate your help. Will let you know how it goes. Might be a day or two.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Sure thing! The setup you want can be a bit complex, so feel free to ask me any questions if you run into any issues. Let me know how it goes.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Thanks. I started on it last night for a bit and will definitely have questions.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    I will ask a question to shorten the learning curve if you don’t mind (old brain takes longer to digest new data).

    On each of the category pages I show slightly different search options – the passed parameters 3,4 and 5 are for the main groups of services paint, maintenance and construction but each of those has slightly different cn_multi_category code so that we can allow them to filter by sub-categories of the parent i.e. paint > facility painting, roll door painting, etc.. and I can’t figure out if it is possible to use a variable to swap out the bold areas below and use one block of cn_multi_category code as the cn-content tag does not seem to work to swap out the cn_multi_category code – is that correct? Or maybe I did it wrong. Thanks.

    [cn_multi_category_search category=’10|Show All| Search by Service| Showing Contractors by Service: %s|select,3|Show All| Filter by Painting Services| by %s|checklist,90|Show All| Job Size | by %s|checklist,11|Show All| Filter by State | by %s|checklist’ show_category_count=true enable_zipcode=false]

    [cn_multi_category_search category=’10|Show All| Search by Service| Showing Contractors by Service: %s|select,4|Show All| Filter by Maintenance & Repair Services| by %s|checklist,90|Show All| Job Size | by %s|checklist,11|Show All| Search by State | by %s|checklist’ show_category_count=true enable_zipcode=false]

    [cn_multi_category_search category=’10|Show All| Search by Service| Showing Contractors by Service: %s|select,5|Show All| Filter by Construction & Remodeling Services| by %s|checklist,90|Show All| Job Size | by %s|checklist,11|Show All| Search by State | by %s|checklist’ show_category_count=true enable_zipcode=false]

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Okay skip it. I did get it working, only I could not get the search results on the same page – it returned the query but showed ‘No results.’

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Oops spoke too soon. It does not work as expected – it does search but I am not seeing the unique category specific multi search as indicated above.

    Plugin Author Steven

    (@shazahm1hotmailcom)

    Can you please paste the shortcodes as they are on the directory page? Please use the Code block when you copy-paste into the reply; thanks!

    When I look at the site, I still see all the separate pages — are you testing on a different page, if so, what is the link?

    Thread Starter allfrom1supply

    (@allfrom1supply)

    The test page is here https://help.allfrom1supply.com/test/?cn-cat-in%5B0%5D=3 the categories are 3, 4 and 5

    [cn-content condition=is_category parameter=3]
    <div class="commercial-painters">
    <p>Select filters and press SEARCH to return filtered results, or use the keyword or zipcode search options.</p>
    </div>
    [/cn-content]
    
    [cn-content condition=is_category parameter=4]
    <div class="maintenance-repair">
    <p>Select filters and press SEARCH to return filtered results, or use the keyword or zipcode search options.</p>
    </div>
    [/cn-content]
    
    [cn-content condition=is_category parameter=5]
    <div class="remodel">
    <p>Select filters and press SEARCH to return filtered results, or use the keyword or zipcode search options.</p>
    </div>
    [/cn-content]
    
    
    [cn_multi_category_search category='10|Show All| Search by Service| Showing Contractors by Service: <u>%s</u>|select,3|Show All| Filter by Painting Services| by <u>%s</u>|checklist,90|Show All| Job Size | by <u>%s</u>|checklist,11|Show All| Filter by State | by <u>%s</u>|checklist' show_category_count=true placeholder_zip='SEARCH BY ZIPCODE' enable_zipcode=false radius_options='200:200 Miles' radius_unit=mi]
    
    [connections template="slim-plus" order_by="id|RANDOM" enable_keyword='TRUE' image_width=200 image_height=200 enable_note='FALSE' show_email='TRUE']

    Unfortunately theactive search pages (not this test one) points to the search-results page https://help.allfrom1supply.com/search-results/?cn-cat-in%5B%5D=3&cn-cat-in%5B%5D=16&cn-s= (code follows) because the owner is actively showing some contractors the new directory. This is the code on that page.

    [connections template="slim-plus" order_by="id|RANDOM" enable_keyword='TRUE' image_width=200 image_height=200 enable_note='FALSE' show_email='TRUE']
    Plugin Author Steven

    (@shazahm1hotmailcom)

    The first items I see…

    The links at the top for “Painters…, Maint…, and Construction” need to be updated to the test page so they will resolve to the test page.

    The second item I see…

    You need to add the home_id=n force_home=false options to the cn_multi_category_search shortcode so the search result resolves to the test page instead of the directory homepage. The n needs to be changed to the Page ID number of the “test” page.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Thanks Steven. I will try this at the end of day when they are done showing our store and the WordPress help site – including your directory- to the customers. I’ll let you know. I appreciate your help very much.

    Thread Starter allfrom1supply

    (@allfrom1supply)

    Hi Steven.

    I added those parameters and just tested it using the links

    https://help.allfrom1supply.com/test/?cn-cat-in%5B%5D=3
     https://help.allfrom1supply.com/test/?cn-cat-in%5B%5D=4
     https://help.allfrom1supply.com/test/?cn-cat-in%5B%5D=5

    and when I pick additional filters like state this does return the correct results but this is not able to dynamically change the filter categories. That is what I was trying to sort. Essentially I need to see if there is a way to conditionally change that first group. They are set up like this. The Job Size and the States are the same for all three, but the ‘sub services’ grouped under painting, maintenance and construction are unique if that makes sense. I almost think I need a conditional statement of some sort.

    Services
    –Commercial Painting
    —-Facility Painting & Re-Imaging
    —-Exterior Painting
    —-Interior Painting
    etc

    –Maintenance & Repair
    —-Roll Door Repairs
    —-Roll Door Replacement
    —-Swing Door Repair
    etc

    –Construction & Remodeling
    —-Office Remodels
    —-Storage Apartment Remodels
    —-Unit Remix
    etc

    Plugin Author Steven

    (@shazahm1hotmailcom)

    I did not notice you had different search shortcodes, sorry.

    You can use the content shortcode with these too. Example for the painters search shortcode:

    [cn-content condition=is_category parameter=3]
    [cn_multi_category_search category='10|Show All| Search by Service| Showing Contractors by Service: <u>%s</u>|select,3|Show All| Filter by Painting Services| by <u>%s</u>|checklist,90|Show All| Job Size | by <u>%s</u>|checklist,11|Show All| Filter by State | by <u>%s</u>|checklist' show_category_count=true placeholder_zip='SEARCH BY ZIPCODE' enable_zipcode=false radius_options='200:200 Miles' radius_unit=mi/]
    [/cn-content]

    Notice I only added a trailing forward slash to the search shortcode. This is critical for the WP Shortcode parser to properly read both enclosing and self-enclosing shortcodes used on the same page.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Clear Search’ is closed to new replies.