Пример #1
0
 /**
  * Setting product position in list, amount of articles etc
  *
  * @param oxcategory $oCategory    active category id
  * @param object     $oCurrArticle current article
  * @param string     $sOrderBy     order by fields
  *
  * @return object
  */
 protected function _loadIdsInList($oCategory, $oCurrArticle, $sOrderBy = null)
 {
     $oIdList = oxNew('oxArticleList');
     $oIdList->setCustomSorting($sOrderBy);
     // additionally check if this category is loaded and is price category ?
     if ($oCategory->isPriceCategory()) {
         $oIdList->loadPriceIds($oCategory->oxcategories__oxpricefrom->value, $oCategory->oxcategories__oxpriceto->value);
     } else {
         $sActCat = $oCategory->getId();
         $oIdList->loadCategoryIDs($sActCat, oxRegistry::getSession()->getVariable('session_attrfilter'));
         // if not found - reloading with empty filter
         if (!isset($oIdList[$oCurrArticle->getId()])) {
             $oIdList->loadCategoryIDs($sActCat, null);
         }
     }
     return $oIdList;
 }
 /**
  * Returns category SEO url for specified page
  *
  * @param oxcategory $oCategory category object
  * @param int        $iPage     page tu prepare number
  * @param int        $iLang     language
  * @param bool       $blFixed   fixed url marker (default is null)
  *
  * @return string
  */
 public function getCategoryPageUrl($oCategory, $iPage, $iLang = null, $blFixed = null)
 {
     if (!isset($iLang)) {
         $iLang = $oCategory->getLanguage();
     }
     $sStdUrl = $oCategory->getBaseStdLink($iLang) . '&pgNr=' . $iPage;
     $sParams = (int) ($iPage + 1);
     $sStdUrl = $this->_trimUrl($sStdUrl, $iLang);
     $sSeoUrl = $this->getCategoryUri($oCategory, $iLang) . $sParams . "/";
     if ($blFixed === null) {
         $blFixed = $this->_isFixed('oxcategory', $oCategory->getId(), $iLang);
     }
     return $this->_getFullUrl($this->_getPageUri($oCategory, 'oxcategory', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed), $iLang);
 }
Пример #3
0
 /**
  * sets a single category, handles sorting and parent hasVisibleSubCats
  *
  * @param oxcategory $oCat          the category
  * @param string     $sKey          (optional, default=null)  the key for that category, without a key, the category isjust added to the array
  * @param boolean    $blSkipSorting (optional, default=false) should we skip sorting now? (deprecated on 2011.01.27 for v4.5.0)
  *
  * @return null
  */
 public function setSubCat($oCat, $sKey = null, $blSkipSorting = false)
 {
     if ($sKey) {
         $this->_aSubCats[$sKey] = $oCat;
     } else {
         $this->_aSubCats[] = $oCat;
     }
     // keeping ref. to parent
     $oCat->setParentCategory($this);
     if ($oCat->getIsVisible()) {
         $this->setHasVisibleSubCats(true);
     }
 }
Пример #4
0
 public function testaListPrepareMetaKeyword()
 {
     $aSubCats[0] = new oxcategory();
     $aSubCats[0]->oxcategories__oxtitle = new oxField('agentū Литовfür sub_category_1');
     $aSubCats[1] = new oxcategory();
     $aSubCats[1]->oxcategories__oxtitle = new oxField('agentū Литовfür Nada fedia nada');
     $oParentCategory = new oxcategory();
     $oParentCategory->oxcategories__oxtitle = new oxField('agentū Литовfür parent_category');
     $oCategory = new oxcategory();
     $oCategory->oxcategories__oxtitle = new oxField('current_category');
     $oCategory->oxcategories__oxparentid = new oxField('parentCategoryId');
     $oCategory->setSubCats($aSubCats);
     $oCategory->setParentCategory($oParentCategory);
     $aCatTree[] = $oParentCategory;
     $aCatTree[] = $oCategory;
     $oCategoryTree = $this->getMock('oxcategorylist', array('getPath'));
     $oCategoryTree->expects($this->any())->method('getPath')->will($this->returnValue($aCatTree));
     $oListView = $this->getMock('alist', array('getActiveCategory', 'getCategoryTree'));
     $oListView->expects($this->any())->method('getActiveCategory')->will($this->returnValue($oCategory));
     $oListView->expects($this->any())->method('getCategoryTree')->will($this->returnValue($oCategoryTree));
     $this->assertEquals('agentū, литовfür, parent_category, current_category, sub_category_1, nada, fedia', $oListView->UNITprepareMetaKeyword(null));
 }
Пример #5
0
 public function testGetRootIdWithoutCat()
 {
     $this->assertNull(oxcategory::getRootId(null));
 }