Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Instant Search
Method Objective
The method requests products that match the search query. The method must be called for each entered character of the search query. The search for products starts from the second entered symbol.
Note |
---|
Note that to integrate the "Instant Search" tool it is enough to add the "personaclick-instant-search" class to the "input" tag used to enter the search query. Using this class as a selector, the PersonaClick library will show the widget by itself. The method described below should be used only if you need to show the instant search widget following your logic. |
Syntax and parameters
Code Block | ||
---|---|---|
| ||
personaclick("suggest", params, success, error); |
Name | Type | Requirement | Description |
---|---|---|---|
params | object | required | Object with request parameters. |
success | function | required | Callback-function, where the API response will be passed to. Response type: object. |
error | function | optionally | Callback-function to be called when an error occurs (any HTTP status code other than 200). |
Request parameters
Name | Type | Requirement | Description |
---|---|---|---|
search_query | string | required | The search query text. |
API response
Name | Type | Description |
---|---|---|
products | array | An array of objects with product information. Each object has the following properties:
|
products_total | number | The total number of products that match the search query. |
search_query | string | The search query text. |
categories | array | An array of objects with information about the categories matching the search query. Each object has the following properties:
If no links are specified for categories in the product feed, the API will return an empty array for this property. |
queries | array | An array of objects with relevant popular queries. Each object has the following properties:
|
html | string | Contains a rendered custom HTML template for the Instant Search widget, or null if the HTML template is empty or the default one is used. |
search_query_redirects | object | The object will be available if a redirect is created for the search query: Account -> Search -> Search redirect The object contains the following properties:
|
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("suggest", {search_query: "To be or not to be"}, function(response) { // features showing instant search widget }, function(error) { // when something went wrong }); |
Full Search
Method Objective
The method requests products that match the full search query and is used to display the search results.
Note |
---|
Note that the Full Search tool can be integrated by placing a configured DIV on the search page. The DIV will be filled with products matching the search query automatically. You can find the DIV in the Search Section of the PersonaClick account. |
Syntax and parameters
Code Block | ||
---|---|---|
| ||
personaclick("search", params, success, error); |
Name | Type | Requirement | Description |
---|---|---|---|
params | object | required | Object with request parameters. |
success | function | required | Callback-function, where the API response will be passed to. Response type: object. |
error | function | optionally | Callback-function to be called when an error occurs (any HTTP status code other than 200). |
Request Parameters
Name | Type | Requirement | Description |
---|---|---|---|
search_query | string | required | The search query text. |
limit | number | optionally | The maximum number of products in the API response (by default - 10). |
page | number | optionally | Page number (first page - 1, by default - 1). |
offset | number | optionally | The offset relative to the first product in the API response (similar to: (page - 1) * limit and when used simultaneously with page is a priority, by default - 0). |
brands | array | optionally | An array of vendor names. If used, the API response will return only the products of the listed vendors. The vendors must be listed in the product feed. |
colors | array | optionally | An array of product colors. If used, the API response will return the products of the listed colors. The colors of the product should be specified in the product feed. |
price_min | number | optionally | Minimum product price in API response. |
price_max | number | optionally | Maximum product price in API response. |
categories | array | optionally | An array of category IDs. If used, the API response will return only those products that are in the specified categories. |
category_names | boolean | optionally | Using the category names in the search. If used, the API will respond with products from categories whose names intersect with the search query. By default: true. |
sort_by | string | optionally | Sorting products in the API response. Available values:
|
order | string | optionally | Sorting directions for the
|
category_limit | number | optionally | The maximum number of categories in the API response matching the search query. |
extended | number | optionally | If the value is 1, the API will return additional product properties in the response: barcode, categories, param. See the descriptions below. |
locations | string | optionally | Comma-separated location IDs. If used, the API will return only products available in the specified locations. Locations must be specified in the imported product catalog (XML, HTTP API). |
filters | string | optionally | |
exclude | string | optionally | Comma-separated products IDs to exclude from search results. |
API response
Name | Type | Description | ||
---|---|---|---|---|
html | string | HTML code of the widget with full search results. Widget template is customizable in PersonaClick account. | ||
products | array | An array of objects with product information. Each object has the following properties:
| ||
products_total | number | The total number of products that match the search query. The following query parameters do not affect this value: page, limit, and offset. | ||
search_query | string | The search query text. | ||
brands | Object array | Object array, each containing the name property with the vendor name in the value. | ||
categories | Object array | An array of objects with information about the categories matching the search query. Each object has the following properties:
| ||
filters | Object | |||
popup | Object | Reserved for the JS SDK internal use | ||
price_range | Object | The object containing the values of the minimum and maximum price of the products in the API response. Available properties:
| ||
queries | array | Reserved. |
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
personaclick("search", {search_query: "To be or not to be", page: 2, limit: 15, brands: ["Alas", "poor", "Yorick"], categories: [1, 146, 100500], sort_by: "price", order: "asc"}, function(response) { // features showing full search widget }, function(error) { // when something went wrong }); |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|