HCG Web Services Documentation
6 July 2009 • Version 1.0

Remote Tags for Stores

These remote tags are designed to provide store locator fuctionality through a simple tag placed in a remote website.

NOTE: Remote Tags are a restricted service and are intended for use only in websites owned by The Hain Celestial Group. They are not for general use. Please contact Jim Applegate if you need to set up access to Remote Tags.

Base URL : http://rtags.hcgweb.net/{version}/stores/

The current version is v1.

The HTTP Method used is POST.

Available Tags:


Displays a store locator form allowing the user to select a product, enter their zip code and select a distance. When the form is submitted, it then displays the results along with links for each store for a map and a feedback form.

The data must be submitted via the POST method.

URL Format


Parameter Required Description Options and Samples
version Yes The version of the rTag that you are using. v1
site-id Yes The alpha code used to identify on which HCG site the tag is installed. ge = Garden of Eatin'

See a complete list of codes.
site-host Yes The host domain for the site calling the rTag. $_SERVER['HTTP_HOST'];
scope No The store databases that should be searched local - just the local list of stores
nielsen - just stores supplied by Nielsen scanner data
all - both local and Nielsen results

Default: all
search-tpl No The template name for the search form.* locator-form
Default: locator-form
by-category No Should the product list be sorted by category? Yes
Default: Yes
result-tpl No The template name for the search results.* locator-results
Default: locator-results
action No The URL for the results page. Set this if you want to have the results display on a different page than the one displaying the form. $_SERVER['PHP_SELF'];
Default: #
map-action No The URL for the map popup page. Set this if you need to have the map display on a different page than the one displaying the form. $_SERVER['PHP_SELF'].'/map';
Default: #
message-action No The URL for the message popup page. Set this if you need to have the message form display on a different page than the one displaying the form. $_SERVER['PHP_SELF'].'/message';
Default: #
any-product No The 11-digit UPC of the product to use in an "any product" search. If this is not specified, only product-specific searches will be allowed. 01583900825
Default: none
select-upc No The 11-digit UPC of the product to highlight in the product list. 01583900825
Default: none
server-level No The server to use to pull the product list and map API keys. stage
Default: live
google-maps-api-key No An API key to use instead of the default used by the system. (really long string)
Default: the API key in the database

*For security reasons, there is no mechanism for overriding templates directly from a remote server. Many modifications can be made using CSS, but if you need to make markup changes to a template, contact Jim Applegate to either modify the default template or add a new template to the list of options.

Example Pages

The example pages below shows what the tag looks like in action.

Templates and CSS

The code

   $post_array = array();
   $post_vars = '';
   $ch = '';
   $output = '';
   $rtag_url = $server.'v1/stores/storeLocator';
   $config = array();
   $config['site-id'] = 'ge';
   $config['scope'] = 'all';
   $config['search-tpl'] = 'locator-form';
   $config['by-category'] = 'Yes';
   $config['result-tpl'] = 'locator-results';
   $config['action'] = $_SERVER['PHP_SELF'];
   $config['map-action'] = 'http://'.$_SERVER["HTTP_HOST"].'/docs/stores/popup-1.html';
   $config['message-action'] = 'http://'.$_SERVER["HTTP_HOST"].'/docs/stores/popup-1.html';
   $config['any-product'] = '01583900793';
   $config['select-upc'] = '';
   // this is the key for stage.hcgweb.net
   $config['google-maps-api-key'] = 'ABQIAAAAC3jSTq45mDaN_HUF4ld5_BQ3oBjcai7BG7FKziDvrMfZTesj_BTCYaUIjpYl43a20DVrVGAp9QYO4w';
   foreach ($config AS $key => $value)
      $post_array[] = $key.'='.urlencode($value);
   foreach ($_POST AS $key => $value)
      $post_array[] = $key.'='.$value;

   $post_vars = implode('&', $post_array);
   $ch = curl_init($rtag_url);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $output = curl_exec($ch);
   echo $output;