ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to reset a search query on website.

June 09, 2011 7:28am

Subscribe [4]
  • #1 / Jun 09, 2011 7:28am

    eurohelmets

    16 posts

    Hi, I’ve got a dealer search running on my website but the issue i’m having is when I close down the website and load it up again it has the same search results loaded on the page.

    If I go to a completely different computer and look on there the results are the same there as well.

    Is there a way to reset this when a new user loads the page. Currently people are moaning thinking i’m favouring specific dealers but it’s just because the search stays loaded when another customer visits the site.

    The search is here : http://www.agv-moto.com/index.php/dealers/

    Thanks
    Chris

  • #2 / Jun 09, 2011 8:03am

    Mark Bowen

    12637 posts

    Hi Chris,

    What are you using for the search functionality? Is it the built in search form or something else?

    Doesn’t appear to be the built in search functionality as I don’t see a search string passed when I use the location text field search on that page.

    Just as an aside though, you’re not using any sort of page / template caching are you?

    Best wishes,

    Mark

  • #3 / Jun 09, 2011 8:11am

    eurohelmets

    16 posts

    Hi Mark,

    Thanks for your response.
    The site was setup but the guy that set it up is no longer looking after the site so I’m trying to get my head around it myself which having had no involvement in the development process it’s proving difficult.

    I’ve pasted the code below that shows the part that runs this :

    <form method=“post” id=“search_form” action=”#”>
          <!—<div><label for=“url_title”>Company Name: </label><input type=“text” name=“url_title” id=“name” /></div>—>
          <div><label for=“location”>Location: </label><input type=“text” name=“search:dealers-address” id=“location” /></div>
          <div><label for=“postcode”>Postcode: </label><input type=“text” name=“search:dealers-postcode” id=“postcode” maxlength=“4”/></div>
          <div><input type=“submit” name=“submit” id=“submit” value=“Search” /></div>
          </form>
        </div>
        <div id=“dealers”>
          <ul>
          {exp:weblog:entries weblog="dealers" orderby="title" sort="asc" limit="10" pagination="bottom" dynamic_parameters="search:dealers-address|search:dealers-postcode" site="{site_name}”}
          <li class=“dealer_entry”>
            <div class=“top_details”>
              <div class=“dealer_icon”>{images}agv_dealer_icon.gif</div>
              <div class=“dealer”>{title}</div>
            </div>
            <div class=“left_side_details”>
              {if dealers-address}<div class=“address”>{dealers-address}{dealers-postcode}</div>{/if}
              {if dealers-postcode}<div class=“map”>View Map</div>{/if}
            </div>     
            <div class=“right_side_details”>
              {if dealers-website}<div class=“website”>Website: {dealers-website}</div>{/if}
              {if dealers-email}<div class=“email”>Email: {dealers-email}</div>{/if}
              {if dealers-telephone}<div class=“contact”>Tel: {dealers-telephone}</div>{/if}
            </div>
            <div class=“bottom_details”>
              {if dealers-details}<div class=“details”>{dealers-details}</div>{/if}
            </div>
          </li>
          {paginate}
          <li id=“pageDetails” class=“clear”>Page {current_page} of {total_pages} {pagination_links}</li>
          {/paginate}
          {/exp:weblog:entries} 
          </ul>

    I’ve managed to do quite a lot to the site up to yet but this has just baffled me.
    Chris

  • #4 / Jun 09, 2011 9:04am

    Kernon

    173 posts

    I thought that “dynamic_parameters” wasn’t supposed to work with pagination?

  • #5 / Jun 09, 2011 9:06am

    eurohelmets

    16 posts

    I’m unsure. My knowledge is not that advanced. All I know is it works for what it needs to do it’s just it doesn’t reset when another user visits the site after someone has done a search.

    I’d love to have the whole dealer search where it finds the closest dealer based on location even if the postcode doesn’t match but that’s definitely too far away from what I know.

    Chris

  • #6 / Jun 09, 2011 9:12am

    Kernon

    173 posts

    Well, I didn’t spend a lot of time on it, but in limited testing, it seemed like a search I put in did not stick across pages.

    Also, with “dynamic_parameters”, you ARE going to have an initial display of entries on the same page.  Perhaps someone who has used it can advise you on work arounds.  However, if you really don’t want an initial display, you might consider breaking this up into two pages: one with the search form, and then a second that displays the search results.

  • #7 / Jun 09, 2011 9:12am

    Mark Bowen

    12637 posts

    Hi Chris,

    A couple of things here. The action=”“ form parameter hasn’t been filled in. This may or may not have an effect on everything so I’d try that perhaps - (click for link to documentation).

    There are also a couple of posts here and here which may also help you out on this depending on if you are getting rid of index.php or not and secondly to hopefully help get rid of any results until someone searches using the form.

    I’d also check that you’re not using any template caching on that form too.

    Best wishes,

    Mark

  • #8 / Jun 09, 2011 9:13am

    eurohelmets

    16 posts

    Hi Mark,

    Many thanks for your help.

    I’ll give it a go now and see how I get on.

    Chris

  • #9 / Jun 09, 2011 3:54pm

    Brandon Jones

    5500 posts

    All great advice, Mark. Let us know how you get on with this, Chris!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases