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.
Syntax and parameters
Code Block | ||
---|---|---|
| ||
pcsdk.search(params).then(success).catch(error) |
Request parameters
API response
An array of objects with product information. Each object has the following properties:
- barcode – product barcode, if it was imported in the product catalog (type: string)
- brand – product vendor (type: string)
- categories – an Object array with details of the product category hierarchy, where each object has properties:
"id" – category ID (type: string)
"level" – сategory level in the hierarchy (type: string)
"name" – category name (type: string)
"name_with_parent" – string name from the name of the parent and main product categories, separated by a "-" (type: string)
"parent_id" – parent category ID (type: string)
"url" – category page url (type: string) - category_ids – an array of IDs of the product category hierarchy (type: String array)
- currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
- discount – the percentage difference between the old price and the current price (type: number)
- discount_formatted – the percentage difference between the old and the current price that is formatted as a string with the "%" symbol (type: string)
- discount_percent – user-defined discount value (type: number)
- gift – specifies whether the product is a gift (type: boolean)
- installment – the payment cost if purchasing the product in installments (type: number)
- id – product ID (type: string)
- image_url – URL of the original product image (type: string)
- image_url_handle – relative URL of the original product image (type: string)
- image_url_resized – the object with the URLs of the resize product image. Available object keys matching the size of the image in pixels: 120, 140, 160, 180, 200, 220, 310, 520 (type: object)
- is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
- leftovers – rough number of the products left in stock. Available values are:
"one" - one product
"few" - 2-10 products
"lot" - over 10 products - model – model and product name (type: string)
- name – product name (type: string)
- oldprice – integer old price of the product (type: number)
- oldprice_formatted – formatted integer old price of the product, including currency (type: string)
- oldprice_full – old price of the product (type: number)
- oldprice_full_formatted – formatted old price of the product, including currency (type: string)
- params – object array with pairs of "key" (type: string), "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API).
- picture – link to the product image in the PersonaClick image repository (type: string)
- price – integer current price of the product (type: number)
- price_formatted – formatted integer current price of the product, including currency (type: string)
- price_full – current price of the product (type: number)
- price_full_formatted – formatted current price of the product, including currency (type: string)
- price_with_promocode – the product price when using the promo code specified for the product (type: number)
- price_with_promocode_formatted – formatted product price when using the promo code specified for the product, including currency (type: string)
- promocode – the promo code is for a specific product (type: string)
- rating – product rating (type: number)
- relative_sales_rate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
- sales_rate – level of product sales (absolute value) (type: number)
- url – product page URL (type: string)
- url_handle - relative product page URL (type: string)
An array of objects with information about the categories matching the search query. Each object has the following properties:
- id – category ID (type: string)
- name – category name (type: string)
- url – category page link (type: string)
- parent – parent category ID (type: string)
- alias – wordy category identifier (type: string)
If no links are specified for categories in the product feed, the API will return an empty array for this property.
- name – relevant search query (type: string)
- url – link to a full search page (the format of the link is configured in the PersonaClick account)
The object will be available if a redirect is created for the search query: Account -> Search -> Search redirect
The object contains the following properties:
- deep_link (type: string)
- query (type: string)
- redirect_link (type: string)
Example of use
Code Block | ||||
---|---|---|---|---|
| ||||
pcsdk.search({type: "instant_search", search_query: "To be or not to be"})
.then((response) => {
// features showing instant search widget
})
.catch((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.
Syntax and parameters
Code Block | ||
---|---|---|
| ||
pcsdk.search(params).then(success).catch(error) |
Request Parameters
Available values:
- popular - sorting products by popularity (by default)
- price - sorting by product price
- discount - sorting by discount (the difference between
oldprice
andprice
in the product feed)
Sorting directions for the sort_by
parameter.
Available values:
- asc - ascending sorting
- desc - downwards sorting (by default)
JSON string with the properties and their values that the products should match in the API response. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API). Format:
Code Block |
---|
{"property1":["value1","value2"],"property2":["value1","value2"]} |
API response
An array of objects with product information. Each object has the following properties:
- barcode – product barcode, if it was imported in the product catalog (type: string)
- brand – product vendor (type: string)
- categories – an Object array with details of the product category hierarchy, where each object has properties:
"id" – category ID (type: string)
"level" – сategory level in the hierarchy (type: string)
"name" – category name (type: string)
"name_with_parent" – string name from the name of the parent and main product categories, separated by a "-" (type: string)
"parent_id" – parent category ID (type: string)
"url" – category page url (type: string) - category_ids – an array of IDs of the product category hierarchy (type: String array)
- currency – product currency (type: string, matches the currency of the PersonaClick account, or the user value set in the settings of the PersonaClick account)
- discount – the percentage difference between the old price and the current price (type: number)
- discount_formatted – the percentage difference between the old and the current price that is formatted as a string with the "%" symbol (type: string)
- discount_percent – user-defined discount value (type: number)
- gift – specifies whether the product is a gift (type: boolean)
- installment – the payment cost if purchasing the product in installments (type: number)
- id – product ID (type: string)
- image_url – URL of the original product image (type: string)
- image_url_handle – relative URL of the original product image (type: string)
- image_url_resized – the object with the URLs of the resize product image. Available object keys matching the size of the image in pixels: 120, 140, 160, 180, 200, 220, 310, 520 (type: object)
- is_new – new arrival product (type: boolean). See the parameter in the product catalog import (XML, HTTP API)
- leftovers – rough number of the products left in stock. Available values are:
"one" - one product
"few" - 2-10 products
"lot" - over 10 products - model – model and product name (type: string)
- name – product name (type: string)
- oldprice – integer old price of the product (type: number)
- oldprice_formatted – formatted integer old price of the product, including currency (type: string)
- oldprice_full – old price of the product (type: number)
- oldprice_full_formatted – formatted old price of the product, including currency (type: string)
- params – object array with pairs of "key" (type: string), "values" (type: array) properties. The data matches the values of the "param" parameter of the product feed/catalog (XML, HTTP API).
- picture – link to the product image in the PersonaClick image repository (type: string)
- price – integer current price of the product (type: number)
- price_formatted – formatted integer current price of the product, including currency (type: string)
- price_full – current price of the product (type: number)
- price_full_formatted – formatted current price of the product, including currency (type: string)
- price_with_promocode – the product price when using the promo code specified for the product (type: number)
- price_with_promocode_formatted – formatted product price when using the promo code specified for the product, including currency (type: string)
- promocode – the promo code is for a specific product (type: string)
- rating – product rating (type: number)
- relative_sales_rate – level of sales of current product ( in percentage) in relation to the maximum level of sales of products in the store (type: number)
- sales_rate – level of product sales (absolute value) (type: number)
- url – product page URL (type: string)
- url_handle - relative product page URL (type: string)
An array of objects with information about the categories matching the search query. Each object has the following properties:
- id – category ID (type: string)
- name – category name (type: string)
- url – category page link (type: string)
- parent – parent category ID (type: string)
- alias – wordy category identifier (type: string)
Note |
---|
If no links are specified for categories in the product feed, the API will return an empty array for this property. |