Exemplo n.º 1
0
 /**
  * Sets details locator data for articles that came from search list.
  *
  * @param oxubase   $oLocatorTarget oxubase object
  * @param oxarticle $oCurrArticle   current article
  */
 protected function _setSearchLocatorData($oLocatorTarget, $oCurrArticle)
 {
     if ($oSearchCat = $oLocatorTarget->getActSearch()) {
         // #1834/1184M - specialchar search
         $sSearchParam = oxRegistry::getConfig()->getRequestParameter('searchparam', true);
         $sSearchFormParam = oxRegistry::getConfig()->getRequestParameter('searchparam');
         $sSearchLinkParam = rawurlencode($sSearchParam);
         $sSearchCat = oxRegistry::getConfig()->getRequestParameter('searchcnid');
         $sSearchCat = $sSearchCat ? rawurldecode($sSearchCat) : $sSearchCat;
         $sSearchVendor = oxRegistry::getConfig()->getRequestParameter('searchvendor');
         $sSearchVendor = $sSearchVendor ? rawurldecode($sSearchVendor) : $sSearchVendor;
         $sSearchManufacturer = oxRegistry::getConfig()->getRequestParameter('searchmanufacturer');
         $sSearchManufacturer = $sSearchManufacturer ? rawurldecode($sSearchManufacturer) : $sSearchManufacturer;
         // loading data for article navigation
         $oIdList = oxNew('oxArticleList');
         if ($oLocatorTarget->showSorting()) {
             $oIdList->setCustomSorting($oLocatorTarget->getSortingSql($oLocatorTarget->getSortIdent()));
         }
         $oIdList->loadSearchIds($sSearchParam, $sSearchCat, $sSearchVendor, $sSearchManufacturer);
         //page number
         $iPage = $this->_findActPageNumber($oLocatorTarget->getActPage(), $oIdList, $oCurrArticle);
         $sAddSearch = "searchparam={$sSearchLinkParam}";
         $sAddSearch .= '&listtype=search';
         if ($sSearchCat !== null) {
             $sAddSearch .= "&searchcnid={$sSearchCat}";
         }
         if ($sSearchVendor !== null) {
             $sAddSearch .= "&searchvendor={$sSearchVendor}";
         }
         if ($sSearchManufacturer !== null) {
             $sAddSearch .= "&searchmanufacturer={$sSearchManufacturer}";
         }
         // setting product position in list, amount of articles etc
         $oSearchCat->iCntOfProd = $oIdList->count();
         $oSearchCat->iProductPos = $this->_getProductPos($oCurrArticle, $oIdList, $oLocatorTarget);
         $sPageNr = $this->_getPageNumber($iPage);
         $sParams = $sPageNr . ($sPageNr ? '&' : '') . $sAddSearch;
         $oSearchCat->toListLink = $this->_makeLink($oSearchCat->link, $sParams);
         $oNextProd = $this->_oNextProduct;
         $oBackProd = $this->_oBackProduct;
         $oSearchCat->nextProductLink = $oNextProd ? $this->_makeLink($oNextProd->getLink(), $sAddSearch) : null;
         $oSearchCat->prevProductLink = $oBackProd ? $this->_makeLink($oBackProd->getLink(), $sAddSearch) : null;
         $sFormat = oxRegistry::getLang()->translateString('SEARCH_RESULT');
         $oLocatorTarget->setSearchTitle(sprintf($sFormat, $sSearchFormParam));
         $oLocatorTarget->setActiveCategory($oSearchCat);
     }
 }
Exemplo n.º 2
0
 /**
  * Sets details locator data for articles that came from tag list.
  *
  * @param oxubase   $oLocatorTarget oxubase object
  * @param oxarticle $oCurrArticle   current article
  */
 protected function _setTagLocatorData($oLocatorTarget, $oCurrArticle)
 {
     if ($oTag = $oLocatorTarget->getActTag()) {
         $myUtils = oxRegistry::getUtils();
         // loading data for article navigation
         $oIdList = oxNew('oxarticlelist');
         $oLang = oxRegistry::getLang();
         if ($oLocatorTarget->showSorting()) {
             $oIdList->setCustomSorting($oLocatorTarget->getSortingSql($oLocatorTarget->getSortIdent()));
         }
         $oIdList->getTagArticleIds($oTag->sTag, $oLang->getBaseLanguage());
         //page number
         $iPage = $this->_findActPageNumber($oLocatorTarget->getActPage(), $oIdList, $oCurrArticle);
         // setting product position in list, amount of articles etc
         $oTag->iCntOfProd = $oIdList->count();
         $oTag->iProductPos = $this->_getProductPos($oCurrArticle, $oIdList, $oLocatorTarget);
         if (oxRegistry::getUtils()->seoIsActive()) {
             $oTag->toListLink = oxRegistry::get("oxSeoEncoderTag")->getTagPageUrl($oTag->sTag, $iPage);
         } else {
             $sPageNr = $this->_getPageNumber($iPage);
             $oTag->toListLink = $this->_makeLink($oTag->link, $sPageNr);
         }
         $sAddSearch = '';
         // setting parameters when seo is Off
         if (!$myUtils->seoIsActive()) {
             $sSearchTagParameter = oxRegistry::getConfig()->getRequestParameter('searchtag', true);
             $sAddSearch = 'searchtag=' . rawurlencode($sSearchTagParameter);
             $sAddSearch .= '&listtype=tag';
         }
         $oNextProduct = $this->_oNextProduct;
         $oBackProduct = $this->_oBackProduct;
         $oTag->nextProductLink = $oNextProduct ? $this->_makeLink($oNextProduct->getLink(), $sAddSearch) : null;
         $oTag->prevProductLink = $oBackProduct ? $this->_makeLink($oBackProduct->getLink(), $sAddSearch) : null;
         $oStr = getStr();
         $sTitle = $oLang->translateString('TAGS') . ' / ' . $oStr->htmlspecialchars($oStr->ucfirst($oTag->sTag));
         $oLocatorTarget->setSearchTitle($sTitle);
         $oLocatorTarget->setActiveCategory($oTag);
     }
 }