public function indexAction()
    {
        $request = $this->getCurrentRequest();
        $page = $request->get('page', 1);
        $displayMax = $request->get('max', 9);
        $displayMode = $request->get('mode', 'grid');
        $filter = $request->get('filter');
        $option = $request->get('option');

        if (!\in_array($displayMode, ['grid'], true)) { // "list" mode will be added later
            throw new NotFoundHttpException(sprintf('Given display_mode "%s" doesn\'t exist.', $displayMode));
        }

        $category = $this->retrieveCategoryFromQueryString();

        $this->get('sonata.seo.page')->setTitle($category ? $category->getName() : $this->get('translator')->trans('catalog_index_title'));

        $pager = $this->get('knp_paginator');
        $pagination = $pager->paginate($this->getProductSetManager()->getCategoryActiveProductsQueryBuilder($category, $filter, $option), $page, $displayMax);

        return $this->render('SonataProductBundle:Catalog:index.html.twig', [
            'display_mode' => $displayMode,
            'pager' => $pagination,
            'currency' => $this->getCurrencyDetector()->getCurrency(),
            'category' => $category,
            'provider' => $this->getProviderFromCategory($category),
        ]);
    }