Sidebar

startup_tutorial_and_checklist:usability_configuration:custom_browsing:region_links_in_listing_details

Region Search Links in Listing Details Page

This support wiki article extends on features mentioned in the searches passed through urls tutorial and smarty code available in any template. This will provide another example of the capabilities built at base within our software. If this doesn't exactly match your needs you may learn enough to do what you want.

This article will specific cover adding a link to your listing details page where clients can click and search for listings from the same region.

1) Find the Data You Need

Our first suggested step is to find out what data is available within the page which is in this case the listing details page. For the listing details page there are already many default tags to place data into the listing detail page where you want it to appear. You can find that full list of tags here in your Geo admin tool:

PAGES MANAGEMENT > BROWSING LISTINGS > LISTING DISPLAY PAGE

And scroll to the bottom of that page. The listing details page explanation tutorial covers that in more detail.

For the need here we can find the data we need within the page data. To find the variables available to you for any custom task you only need to add the {debug} tag to a template as described in this tutorial. Once you add that you'll find the is region data available. The software populates the $geographic_navigation_region variable with the current region of the listing. To use that data you only need use:

{$geographic_navigation_region}

We would also want to display the regions name within the link. That data is available in the $regions smarty variable which happens to be an array. But this will get us to the lowest regions name in that array:

{foreach from=$regions item='region'}{if $region@last}{$region.name}{/if}{/foreach}

To pass the region search variable into the search feature you would pass the following in the query string of the url:

b[search_location]=xxx

Where xxx is the region id of the region to search. Since we only want to return results for that one region this would be the url to use:

http://example.com/index.php?a=19&[search_location]=xxx

Now to add the region data to that url:

http://example.com/index.php?a=19&[search_location]={$geographic_navigation_region}

Now to put all we've got together. Lets create something that's actually clickable in the listing details page:

<a href=index.php?a=19&b[search_location]={$geographic_navigation_region}>search {foreach from=$regions item='region'}{if $region@last}{$region.name}{/if}{/foreach}</a>

You don't need to stop there. If you wanted to add the category to that search link try this:

<a href=index.php?a=19&b[search_location]={$geographic_navigation_region}&c={$category_id}>search {foreach from=$regions item='region'}{if $region@last}{$region.name}{/if}{/foreach}</a>
startup_tutorial_and_checklist/usability_configuration/custom_browsing/region_links_in_listing_details.txt · Last modified: 2014/09/25 16:55 (external edit)