Suppress SmartAssistant Filters
SmartAssistant uses the user-provided product and category as search filters to restrict results by default. You can override the default filtering to use only product, category, or neither to filter search results.
SmartAssistant uses the user-provided product and category as search filters to restrict results. By default, it uses both product and category. When using SmartAssistant to search, you can override the default filtering to use only product, category, or neither.
A hook in the file hooks.php
, which contains hook
definitions, calls a method defined in Sample.php
. To apply a specific choice of filter, or to ignore both filters,
modify the files hooks.php
and Sample.php
.
Edit the file:
cp/customer/development/config/hooks.phpAdd the following code at the end of the file:
$rnHooks['pre_retrieve_smart_assistant_answers'][] = array( 'class' => 'Sample', // Name of the custom model 'function' => 'retrieveSmartAssistantRequest', 'filepath' => '' );
Edit the file:
cp/customer/development/models/custom/Sample.phpAdd the following code at the end of the file:
<?php namespace Custom\Models; require_once CPCORE . 'Models/Okcs.php'; class Sample extends \RightNow\Models\Okcs { function __construct() { parent::__construct(); } public function retrieveSmartAssistantRequest(&$hookData) { // Second argument determines which SA results to show. Possible values are 'Product', 'Category', 'ProductAndCategory', 'None'. parent::retrieveSmartAssistantRequest(&$hookData, 'ProductAndCategory'); } }