getQueryAliases example

/** * Returns the short form of a given alias * * $this->getQueryAlias('sSearch') returns 'q' * * @param string $key * * @return string|null */
    public function getShortAlias($key)
    {
        $list = $this->getQueryAliases();

        return $list[$key] ?? null;
    }

    /** * Replaces the query params with their matching long form * * @return void */
    public function replaceShortRequestQueries(Enlight_Controller_Request_RequestHttp $request)
    {
        

            if (!empty($metaDescription)) {
                $metaDescription = html_entity_decode($metaDescription, ENT_COMPAT, 'UTF-8');
                $metaDescription = trim((string) preg_replace('/\s\s+/', ' ', strip_tags($metaDescription)));
                $metaDescription = htmlspecialchars($metaDescription, ENT_COMPAT);
            }
        }

        $controller = $request->getControllerName();

        if ($request->get('action') === 'manufacturer' && $request->get('controller') === 'listing') {
            $alias = $mapper->getQueryAliases();

            if (\array_key_exists('sSupplier', $alias) && ($index = array_search($alias['sSupplier']$queryBlacklist, true))) {
                unset($queryBlacklist[$index]);
            }

            if ($index = array_search('sSupplier', $queryBlacklist, true)) {
                unset($queryBlacklist[$index]);
            }

            if ($request->getQuery('sCategory') !== Shopware()->Shop()->getCategory()->getId()) {
                $queryBlacklist[] = 'sCategory';
                
$sortings = $service->getList($sortingIds$context);

        $this->View()->assign([
            'term' => $term,
            'criteria' => $criteria,
            'facets' => $result->getFacets(),
            'sPage' => $this->Request()->getParam('sPage', 1),
            'sSort' => $this->Request()->getParam('sSort', 7),
            'sTemplate' => $this->Request()->getParam('sTemplate'),
            'sPerPage' => array_values(explode('|', $pageCounts)),
            'sRequests' => $request,
            'shortParameters' => $mapper->getQueryAliases(),
            'pageSizes' => array_values(explode('|', $pageCounts)),
            'ajaxCountUrlParams' => [],
            'sortings' => $sortings,
            'sSearchResults' => [
                'sArticles' => $products,
                'sArticlesCount' => $result->getTotalCount(),
            ],
            'productBoxLayout' => $this->get(Shopware_Components_Config::class)->get('searchProductBoxLayout'),
        ]);
    }

    
 else {
                $pages['numbers'][$i]['markup'] = false;
            }
            $pages['numbers'][$i]['value'] = $i;
            $pages['numbers'][$i]['link'] = $this->Front()->ensureRouter()->assemble(['sViewport' => 'newsletter', 'action' => 'listing', 'p' => $i]);
        }

        $this->View()->assign('sPage', $page);
        $this->View()->assign('sNumberPages', $count);
        $this->View()->assign('sPages', $pages);
        $this->View()->assign('sContent', $content);
        $this->View()->assign('shortParameters', $this->container->get('query_alias_mapper')->getQueryAliases());
    }

    /** * Detail action method */
    public function detailAction()
    {
        $customergroups = $this->getCustomerGroups();
        $customergroups = Shopware()->Db()->quote($customergroups);
        $context = $this->container->get(ContextServiceInterface::class)->getShopContext();

        
$sPerPage = (int) $this->Request()->getParam('sPerPage');

        if ($sPerPage <= 0) {
            $sPerPage = 1;
        }

        $this->View()->assign([
            'sPage' => (int) $this->Request()->getParam('sPage'),
            'pages' => ceil($result->getTotalCount() / $sPerPage),
            'baseUrl' => $this->Request()->getBaseUrl() . $this->Request()->getPathInfo(),
            'pageSizes' => explode('|', $this->container->get(\Shopware_Components_Config::class)->get('numberArticlesToShow')),
            'shortParameters' => $this->container->get(QueryAliasMapper::class)->getQueryAliases(),
            'limit' => $sPerPage,
        ]);

        $this->container->get('events')->notify('Shopware_Controllers_Widgets_Listing_fetchPagination_preFetch', [
            'result' => $result,
            'subject' => $this,
        ]);
    }

    /** * @param int|null $categoryId * * @return array<string, mixed> */
$sPage = (int) $request->getParam('sPage', 1);

        return [
            'sArticles' => $products,
            'criteria' => $criteria,
            'facets' => $searchResult->getFacets(),
            'sPage' => $sPage,
            'pageIndex' => $sPage,
            'pageSizes' => $pageSizes,
            'sPerPage' => $criteria->getLimit(),
            'sNumberArticles' => $searchResult->getTotalCount(),
            'shortParameters' => $this->queryAliasMapper->getQueryAliases(),
            'sTemplate' => $request->getParam('sTemplate') ? (string) $request->getParam('sTemplate') : null,
            'sSort' => (int) $request->getParam('sSort', $this->config->get('defaultListingSorting')),
        ];
    }

    /** * Helper function which loads a full product struct and converts the product struct * to the shopware 3 array structure. * * @param array<int, int> $selection * * @return array<string, mixed> */
Home | Imprint | This part of the site doesn't use cookies.