Hook: afterAjaxSearch
Nachdem eine Ajax-Suche ausgeführt wird
/*
* -- Registration: --
* $GLOBALS['MERCONIS_HOOKS']['afterAjaxSearch'][] = array('myMerconisHookClass', 'myAfterAjaxSearch');
*
* -- Invocation: --
* After an ajax search has been performed.
*
* -- Parameters: --
* 1. $arrSearchCriteria - an array containing the search criteria
* 2. $arrProducts - an array containing the product ids in the result set
*
* -- Return value: --
* $arrProducts
*
* -- Objective: --
* e.g. profiling the user's search behaviour, manipulation of the search result
*
*/
public function myAfterAjaxSearch($arrSearchCriteria, $arrProducts) {
/*
* Example: Add a product to the result set if it is not in it yet
* but another product (possibly somehow related to it) is.
*/
if (in_array(577, $arrProducts) && !in_array(564, $arrProducts)) {
$arrProducts[] = 564;
}
/*
* If you need to access detailed product information, you can
* get the product object like this:
*/
$objLsShopController = \System::importStatic('ls_shop_controller');
foreach ($arrProducts as $productID) {
$objProduct = $objLsShopController->getObjProduct($productID);
/*
* do something...
*/
}
return $arrProducts;
}