Hook: beforeProductlistOutput
Bevor eine Produktliste ausgegeben wird
/*
* -- Registration: --
* $GLOBALS['MERCONIS_HOOKS']['beforeProductlistOutput'][] = array('myMerconisHookClass', 'myBeforeProductlistOutput');
*
* -- Invocation: --
* Before a product list is rendered.
*
* -- Parameters: --
* 1. $productListID - information about which product list this call is related to
* 2. $arrProducts - an array containing the product ids of the products to display in the product list
*
* -- Return value: --
* $arrProducts
*
* -- Objective: --
* e.g. manipulation of the product list output (custom crossSeller types can
* be created this way)
*
*/
public function myBeforeProductlistOutput($productListID, $arrProducts) {
/*
* Example: Manipulate the product list of a specific crossSeller
* in order to create a custom crossSeller type (here: random crossSeller)
*/
if ($productListID == 'crossSeller_42') {
$arrProducts = array();
$this->import('Database');
$productsInDbWithOddIDs = $this->Database->prepare("
SELECT `id`
FROM `tl_ls_shop_product`
ORDER BY RAND()
")
->limit(10)
->execute();
while ($productsInDbWithOddIDs->next()) {
$arrProducts[] = $productsInDbWithOddIDs->id;
}
}
return $arrProducts;
}