Jump to content

Default Search String for "Our Stores" Page


Ayeom

Recommended Posts

Hello.

 

My prestashop only contains 2 stores. I would like the "Our Stores" Page to auto load with a default search string from a local city.

 

When a user clicks on "Our Stores" link, the "Our Stores" page should load as if the user already input ans clicked search for the default city. make sense?

 

anyone have any ideas?

 

thanks.

Link to comment
Share on other sites

Just in case anyone else is looking to do something like this.... this is what I did,

 

Changed default search radius to 100mi in stores.tpl

Changed the value of an <input> tag that has an ID of "addressInput" to value="{l s='*Default Area I want to Search*'}"

Added an onload statement to the loader.gif --> onload="searchLocations();"

 

Now once the page loads, the page does a default search for the area I picked at a range of 100mi, therefore showing both my stores (both my stores are under 100mi from the area I picked to search).

 

I find this an imporvement over the origional because in my case, a user can see both our location and the distance in relation to a large city, then they can proceede to get specific directions from their home, work, etc by conducting an actual search.

 

I was origional just looking to get the list below the map to populate without having to do a search at all but I quickly realized this was not an option as the list requires the milage data which requires a search.

Link to comment
Share on other sites

  • 2 months later...

Hey Thanks Ayeom, Your code changes worked for me. I also wanted customers to view all stores on the 1st loaded page with the Map, then they can search their area if they want too. Thanks a lot :)

 

I also figured out how to hide my 6000 mi radius search and hide the start zipcode at default. now it sets automatically onload.

 

I am using version 1.5.4.1

 

in stores.tpl replace your code with this code below but change the zipcode 67481 (or use the start city, state, country name) and radius value 6000 to your settings. This setting gets entire USA area. It's nice because first it gives the whole USA view (centered) then goes to show a closeup view of all pinned stores listed in USA.

 


<p>{l s='Your location:'} <input type="hidden" type="text" name="location" id="addressInput" value="{l s='67481'}" onclick="this.value='';" /><input type="text" name="location" id="addressInput" value="{l s='Enter a zipcode, an address, a city or a country'}" onclick="this.value='';" /></p>

<input type="hidden" name="radius" id="radiusSelect" value="6000" />
<p style="margin-top: 15px;">  
{l s='Radius area:'}

<select name="radius" id="radiusSelect">

<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select> {$distance_unit}
<input type="button" class="button" onclick="searchLocations();" value="{l s='Search'}" style="display: inline;" />
<img src="{$img_ps_dir}loader.gif" onload="searchLocations();" class="middle" alt="" id="stores_loader" />
</p>

Edited by Never_give_up (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...