Sidebar

startup_tutorial_and_checklist:feature_configuration:exporting_listings:rss_feed:region_specific_example

Region Specific RSS Feed Example

These instructions will walk you through the steps needed to allow the RSS feed to display region specific content based on the region passed through the url of the RSS feed. Note that the default templates already "link" to the RSS feed which shows the most recent 20 listings(classifieds & auctions) placed from all categories on the site. This will make it so that when you would display results from specific regions, the "linked" RSS feed only shows classifieds and auctions recently placed in the region passed within the url of the link to the RSS feed.

Skills

  • Comfortable with using FTP (to upload and download files from your site) <
  • Basic understanding of how PHP works will help, but not necessary. <

In the "base" of where the software is installed, the same folder that the rss_listings.php file is located, create a new file named rss_listings.config.php. This file will overwrite the settings in the rss_listings.php file, without actually editing that file, so that the setting changes we make will not be un-done when the software is updated. In the newly created file, add the configurations you wish to change from their default configuration. By default the RSS feed uses the region id passed by cookie. That cookie is set if your site is using the geographic navigation addon filter feature and the client has chosen a region to filter their normal site browsing results by. If that's how you wish to choose the region in your RSS feed you do not need to go further. That's how the software does it by default. If you are using this default configuration and are not using the geographic navigation addon your RSS feeds will not be region specific. This tutorial will only show how to change the default "cookie set" region configuration to one where you can pass the region filter directly within the query string of the url used to link to the rss feed.

By default the region is set by cookie within the RSS feed. Simply going to the default RSS feed within the software the region id within the region cookie set by the geographic navigation filter addon will be used to filter the listing results of the RSS feed by the current region the client is searching. The following is the default configuration for that within the rss_listings.php file:

/**
 * Restrict feed contents according to Geographic Navigation?
 * 
 * possible values:
 * 0 - do not filter on geo nav region
 * geoListingFeed::COOKIE_SET - use the current browser's active "region" selection (cookie)
 * geoListingFeed::URL_SET - default from all regions, but can specify in the URL
 * 		for example: "rss_listings.php?geoNavRegion=52" to display only listings in region 52
 * specific region value (e.g. "52") - display only listings from the given region 
 * 
 * 
 */
$feed->geoNavRegion = geoListingFeed::COOKIE_SET;

You'll notice in the code (included from the rss_listings.php file) you'll see comments on how to change that configuration to change the RSS results.

You could change the above to the following to allow the region id to be set within the url itself:

$feed->geoNavRegion = geoListingFeed::URL_SET;

If you want the region set for the RSS feed to be pulled from the region cookie leave the configuration default. If you want to set the region within the url of the linked RSS feed use the second configuration above within your custom rss config file.

Your next step would be to save the "rss config" file you created and upload it, remember it should be located in the base of the Geo installation, in the same folder as rss_listings.php file. By default that is the base directory of the Geo software. The same directory the config.php file for the software is.

From here you can hard code your rss region specific links directly into the pages of your system. Within many of the default page templates of the software there is the following tag:

<link rel="alternate" type="application/rss+xml" title="Newest Listing Feed" href="rss_listings.php" />

By default you'll find that within the following page templates:

/main_page/basic_page.tpl
/main_page/cart_page.tpl
/main_page/category_page.tpl
/main_page/front_page.tpl
/main_page/listing_page.tpl
/main_page/login_page.tpl

You can add your region specific rss listings link to or in place of the above rss link.

To create your region specific you would pass the region id through the query string of the url like suggested in the above comments found in the rss_listings.php file. Those comments mention the numeric region id should be passed to the software. You can find the region id for any region within the software by going to the following admin tool:

GEOGRAPHIC SETUP > REGIONS

The region id you are looking for are in parentheses next to each region within that admin tool. Within the default region configuration the United States is 1, Australia is 14, Canada is 39,….etc. You would use that number for the appropriate country within your rss url url like so:

rss_listings.php?geoNavRegion=1 (for the United States)  
rss_listings.php?geoNavRegion=14 (for the Australia)
rss_listings.php?geoNavRegion=39 (for the Canada)

<tip c n>Note: Does your template design work differently than the default templates? If you have different templates that the ones mentioned above, just add the following line to your design where you do have the region link in a "<link>" within your templates html <head> section</code> </tip>

startup_tutorial_and_checklist/feature_configuration/exporting_listings/rss_feed/region_specific_example.txt · Last modified: 2017/01/04 12:45 by geojames