/** * Returns Attributes displayable for a specific category / set of categories, or for no category. * * @param $module_srl * @param array $category_srls * @param bool $withParents takes categories parents into account * @return mixed * @throws ShopException */ public function getFilterAttributes($module_srl, array $category_srls = null, $withParents = true) { if (!is_numeric($module_srl)) { throw new ShopException('module_srl must be a valid natural number'); } $catSerials = array(); if ($withParents && !empty($category_srls)) { $cRepo = new CategoryRepository(); $paths = $cRepo->getCategoryPaths($category_srls); foreach ($paths as $srl => $path) { $catSerials = array_merge($catSerials, $path, array($srl)); } } else { $catSerials = $category_srls; } $params = array('module_srl' => $module_srl); if (!empty($catSerials)) { $params['category_srls'] = $catSerials; } $aRepo = new AttributeRepository(); $attributes = $aRepo->get(null, 'getCategoriesAttributeFilters', null, $params); return $attributes; }