This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

shop:search CMS action

Defined in /modules/shop/classes/shop_actions.php, lines 2723-2918
Author LemonStand eCommerce Inc.
Base action for the Search page. The action finds products in the database, according to a search query and other search parameters passed to the search page in the URL. Please read the Creating the Search page article for action usage examples.
The action automatically loads GET parameters from the URL and performs the search. Example of a correct search URL: /search/query=laptop&records=6. Example of a simple search form:
<form method="get" action="/search">
  <input name="query" type="text" value="<?= isset($query) ? $query : null ?>"/>
  <input type="submit" value="Find Products"/>
  <input type="hidden" name="records" value="6"/>
</form>
The option_names and option_values parameters described below work in the following way. You can define any number of the option_names and option_values fields. On the form you should have an equal number of the option_names[] and option_values[] fields. LemonStand matches names and values specified in fields with equal index. The first value from the option_values[] field will correspond the first option_names[] field. For example, if you want to organize a search in the Color option (and only), you can define two fields (one of them is hidden):
<form method="get" action="/search">
  <input name="query" type="text" value="<?= isset($query) ? $query : null ?>"/>
  <input type="submit" value="Find Products"/>
  <input type="hidden" name="records" value="6"/>

  <input type="hidden" name="option_names[]" value="Color"/>
  Product color:
  <input type="text" name="option_values[]" value=""/>
</form>
The attribute_names and attribute_values fields work in the same way. You can find more examples in the Creating the Search page article.

Supported form fields

Field Type Description
query string specifies the search query string.
records integer specifies a number of products to output on a single page.
min_price float specifies the minimum product price.
max_price float specifies the maximum product price.
categories array a list of category identifiers the products should belong to.
custom_groups array a list of custom product group identifiers the products should belong to.
sorting string manages the search result sorting.
manufacturers array a list of manufacturer identifiers the products should belong to.
option_names array a list of product option names.
option_values array a list of product option values.
attribute_names array a list of product attribute names.
attribute_values array a list of product attribute values.

Generated PHP variables

Variable Type Description
no_query boolean indicates whether no query was provided by a visitor.
query string a search query string passed to the search page through the page URL.
min_price float the min_price value specified in the search form.
max_price float the max_price value specified in the search form.
sorting string the sorting value specified in the search form.
selected_categories array a list of category identifiers specified in the search form.
selected_manufacturers array a list of manufacturer identifiers specified in the search form.
selected_options array a list of product options specified in the search form.
selected_attributes array a list of product attributes specified in the search form.
search_params_str string a string, containing all search parameters in a URL format.
records integer a number of records per page to output on the search page.
products Db_DataCollection a collection of found products.
pagination Phpr_Pagination a pagination object.

Supported form field details

query form field

Specifies the search query string.

records form field

Specifies a number of products to output on a single page.

min_price form field

Specifies the minimum product price. You can use this and the max_price parameters to limit products with a price range.

max_price form field

Specifies the maximum product price.

categories form field

A list of category identifiers the products should belong to. This parameter should be an array, so you need to use the categories[] name for your form controls. You can use either checkboxes or a SELECT element for specifying category identifiers.

custom_groups form field

A list of custom product group identifiers the products should belong to. This parameter should be an array, so you need to use the custom_groups[] name for your form controls. You can use either checkboxes or a SELECT element for specifying custom group identifiers.

sorting form field

Manages the search result sorting. Supported values are:
  • relevance (default)
  • name
  • name desc
  • price
  • price desc
  • created_at
  • created_at desc
  • product_rating
  • product_rating desc
  • product_rating_all
  • product_rating_all desc

manufacturers form field

A list of manufacturer identifiers the products should belong to. This parameter should be an array, so you need to use the manufacturers[] name for your form controls. You can use either checkboxes or a SELECT element for specifying manufacturer identifiers.

option_names form field

A list of product option names. Use this and the option_values parameters to search in product options. This parameter should be an array, so you need to use the option_names[] name for your form controls.

option_values form field

A list of product option values. Use this parameter in combination with the option_names parameter to specify values you want to search in product options. This parameter should be an array, so you need to use the option_values[] name for your form controls.

attribute_names form field

A list of product attribute names. Use this and the attribute_values parameters to search in product attributes. This parameter should be an array, so you need to use the attribute_names[] name for your form controls.

attribute_values form field

A list of product attribute values. Use this parameter in combination with the attribute_names parameter to specify values you want to search in product attributes. This parameter should be an array, so you need to use the attribute_values[] name for your form controls.

Generated PHP variable details

no_query variable

boolean $no_query;
Indicates whether no query was provided by a visitor. The value is TRUE is the search query string is empty and no other parameters were specified.

query variable

string $query;
A search query string passed to the search page through the page URL.

min_price variable

float $min_price;
The min_price value specified in the search form.

max_price variable

float $max_price;
The max_price value specified in the search form.

sorting variable

string $sorting;
The sorting value specified in the search form.

selected_categories variable

array $selected_categories;
A list of category identifiers specified in the search form.

selected_manufacturers variable

array $selected_manufacturers;
A list of manufacturer identifiers specified in the search form.

selected_options variable

array $selected_options;
A list of product options specified in the search form.

selected_attributes variable

array $selected_attributes;
A list of product attributes specified in the search form.

search_params_str variable

string $search_params_str;
A string, containing all search parameters in a URL format. You can pass this string between pagination pages. In the default store implementation this value can be passed to the suffix parameter of the pagination partial.

records variable

integer $records;
A number of records per page to output on the search page. The default parameter value is 20.

products variable

A collection of found products. Each element in the collection is an object of the Shop_Product class.

pagination variable

Phpr_Pagination $pagination;
A pagination object.