Erläuterung "Mein Content" Schnittstelle (engl.)

MyContent Search Introduction

CleverReach offers you a pretty easy way to integrate your very own content by using the wizard. To do so, you have to set up a simple dynamic script (php, asp, jsp, perl, ...) which has to return JSON formated data based on two steps.

  1. Setup custom filter values like f.e. product name and category
  2. Return searchresults and some settings.

Take a look at this basic PHP example

1. Initial setup

CleverReach will do a "POST" (no GET) (?get=filter[&password=password]) on the stored Product Search URL. This "HAS TO" return JSON encoded filters so CleverReach can setup a Form based on the following filters for user to search for data. CleverReach will create input fields based on the filters returned by you. The user then fill out the generated form and these values will be posted back to you script in order to filter the searchresults.

The following example will create a dropdown list names "Category" and a Input field named "Product".

Example of a response:

[	 
	{
	"name":"Category",						//Displayed name of the to be searched for value 
	"description":"Place description here or leave emtpy",		//[optional] detailed description of the field
	"required":false,						//is required (true|false)
	"query_key":"category",						//submited (POST) name of the field. DON'T use "get" and "password" here
	"type":"dropdown",						//input type (input | dropdown)
	"values":							//if dropdown, set options here
		[	{"text":"","value":""},				//text > displayed text, value > submited balue
			{"text":"cat 1","value":1},			//...
			{"text":"cat 2","value":2},
			{"text":"cat 3","value":3},
			{"text":"   subcat 1","value":4}
		]
	}
	// ... (add as many filters as you want)
	, {
	"name":"Product",
	"description":"Place description here or leave emtpy",
	"required":false,
	"query_key":"product",
	"type":"input"}
]
		

2. Search results

Once the user hits the search button, a POST is initiated. CleverReach will do a "POST" (no GET) (?get=search[&password=password]) on the stored Product Search URL. The response hast to include Settings and Items based on the following format.

The JSON Encoded response consists out of 2 Parts. The "settings", containing the result type and misc options and the "items", which contain the actual searchresults themselves.

Example of a response:

{
	// define returned data types and misc options
	"settings":{
				"type":"product",		// determines which type of layout users can 
								// choose after item is selected 
								// available types are: (rss | product | content)
								// "rss" > TEXT layouts only 
								// "product" > PRODUCT layouts only  
								// "content" > Ignores layouts and uses item conten/description as content 
				
				// the following options will be displayed after the user has chosen a layout
				 
				"link_editable":false,		// lets user change link (true|false)			
				"link_text_editable":false,	// lets user edit link text (true|false)
				"image_size_editable":false,	// lets user change image sizes (true|false)
	},
				
	// array of actual search results				
	"items":	
		[
			{	"title":"Test Product 1",			// Title
				"description":"Description text",		// If RSS or PRODUCT > description text.
				"content":"<b>custom HTML content</b>", 	// [optional] If type is "content", this becomes the HTML content
										// if its not set, description will be used
										
				"image":'http://server.com/image.jpg',		// [optional] Image path  	
				"url":'http://www.server.com',			// [optional] Link
				"price":"EUR 12,99",				// [optional] (only for product types) Preformated Price
				"display_info":"additional info text"		// [optional] adds an additional info line to the search results
			},
			// ...
			{	"title":"Arkham City Batman Action Figure",
				"description":'Welcome to Arkham City, the new maximum security "home" for all of Gotham City’s thugs, gangsters, ...',
				"image":'http://ecx.images-amazon.com/images/I/41fR%2Bl-cb5L._SL500_AA300_.jpg',
				"price":"$ 12,99",
				"url":'http://www.amazon.com/DC-Direct-Batman-Arkham-Series/dp/B005UH6HOG'
			}
		]
}