コード例 #1
0
 /**
  * Returns new seo url including the model no.
  *
  *
  * @param oxArticle  $oArticle  article object
  * @param oxCategory $oCategory category object
  * @param int        $iLang     language to generate uri for
  *
  * @return string
  */
 protected function _createArticleCategoryUri($oArticle, $oCategory, $iLang)
 {
     startProfile(__FUNCTION__);
     $oArticle = $this->_getProductForLang($oArticle, $iLang);
     // create title part for uri
     $sTitle = $this->_prepareArticleTitle($oArticle);
     $sTitle = str_replace($this->_getUrlExtension(), " " . $oArticle->oxarticles__oxartnum->value, $sTitle) . "." . $this->_getUrlExtension();
     // writing category path
     $sSeoUri = $this->_processSeoUrl($sTitle, $oArticle->getId(), $iLang);
     $sCatId = $oCategory->getId();
     $this->_saveToDb('oxarticle', $oArticle->getId(), oxUtilsUrl::getInstance()->appendUrl($oArticle->getBaseStdLink($iLang), array('cnid' => $sCatId)), $sSeoUri, $iLang, null, 0, $sCatId);
     stopProfile(__FUNCTION__);
     return $sSeoUri;
 }
コード例 #2
0
 public function testGetVatForArticleCategoryArtWithoutCat()
 {
     $oArticle1 = $this->getMock('oxarticle', array('getId'));
     //make sure getCategories are never called
     $oArticle1->expects($this->once())->method('getId')->will($this->returnValue('666'));
     $oVatSelector = $this->getProxyClass("oxVatSelector");
     $this->oCategory->oxcategories__oxvat = new oxField(69, oxField::T_RAW);
     $this->oCategory->save();
     $this->assertFalse($oVatSelector->UNITgetVatForArticleCategory($oArticle1));
 }
コード例 #3
0
 /**
  * Category_Main::_deleteCatPicture() test case - deleting icon
  *
  * @return null
  */
 public function testDeletePicture_deletingIcon()
 {
     $oDb = oxDb::getDb(oxDB::FETCH_MODE_ASSOC);
     $this->_oCategory->oxcategories__oxicon = new oxField('testIcon.jpg');
     $this->_oCategory->save();
     $this->assertEquals('testIcon.jpg', $oDb->getOne("select oxicon from oxcategories where oxid='_testCatId' "), 'Category save operation failed');
     /** @var Category_Main $oView */
     $oView = $this->getProxyClass('Category_Main');
     $oView->UNITdeleteCatPicture($this->_oCategory, 'oxicon');
     $this->assertEquals('', $oDb->getOne("select oxicon from oxcategories where oxid='_testCatId' "));
 }
コード例 #4
0
ファイル: oxarticlelist_rca.php プロジェクト: spoilie/vt-rca
 /**
  * @param      $sId             oxCategory oxId
  * @param int  $iAmount         amount of articles to be loaded
  * @param bool $blFullCatTree   true = browse full category tree instead single category
  */
 public function loadRandomCategoryArticles($sId, $iAmount = 1, $blFullCatTree = null)
 {
     //var_dump($sId);
     //var_dump($iAmount);
     //var_dump($blFullCatTree);
     $oDb = oxDb::getDb(true);
     $sSelect = "SELECT a.oxid FROM " . getViewName('oxarticles') . " a " . " JOIN oxobject2category b ON a.oxid = b.oxobjectid" . " JOIN oxcategories c ON b.oxcatnid = c.oxid" . " WHERE c.oxid = " . $oDb->qstr($sId);
     if ($blFullCatTree) {
         $sSelect .= " OR c.oxrootid = " . $oDb->qstr($sId) . " OR c.oxrootid = " . $oDb->qstr(oxCategory::getRootId($sId));
     }
     $sSelect .= " AND a.oxactive = 1 AND a.oxissearch = 1 ORDER BY RAND() LIMIT {$iAmount}";
     //var_dump($sSelect);
     $aIds = $oDb->getCol($sSelect);
     $this->loadIds($aIds);
 }
コード例 #5
0
 /**
  * Set parameters, language and files to category object.
  *
  * @param oxCategory $category
  * @param array      $params
  *
  * @return oxCategory
  */
 protected function updateCategoryOnSave($category, $params)
 {
     $category->assign($params);
     $category->setLanguage($this->_iEditLang);
     $utilsFile = oxRegistry::get("oxUtilsFile");
     $category = $utilsFile->processFiles($category);
     return $category;
 }
コード例 #6
0
ファイル: oxrssfeed.php プロジェクト: ioanok/symfoxid
 /**
  * loadCategoryArticles loads 'Category Articles' rss data
  *
  * @param oxCategory $oCat category object
  *
  * @access public
  *
  * @return void
  */
 public function loadCategoryArticles(oxCategory $oCat)
 {
     $sId = $oCat->getId();
     if ($this->_aChannel = $this->_loadFromCache(self::RSS_CATARTS . $sId)) {
         return;
     }
     $oArtList = oxNew('oxarticlelist');
     $oArtList->setCustomSorting('oc.oxtime desc');
     $oArtList->loadCategoryArticles($oCat->getId(), null, $this->getConfig()->getConfigParam('iRssItemsCount'));
     $oLang = oxRegistry::getLang();
     $this->_loadData(self::RSS_CATARTS . $sId, $this->getCategoryArticlesTitle($oCat), sprintf($oLang->translateString('S_CATEGORY_PRODUCTS', $oLang->getBaseLanguage()), $oCat->oxcategories__oxtitle->value), $this->_getArticleItems($oArtList), $this->getCategoryArticlesUrl($oCat), $oCat->getLink());
 }
コード例 #7
0
 /**
  * deletes Category seo entries
  *
  * @param oxCategory $oCategory Category object
  */
 public function onDeleteCategory($oCategory)
 {
     $oDb = oxDb::getDb();
     $sIdQuoted = $oDb->quote($oCategory->getId());
     $oDb->execute("update oxseo, (select oxseourl from oxseo where oxobjectid = {$sIdQuoted} and oxtype = 'oxcategory') as test set oxseo.oxexpired=1 where oxseo.oxseourl like concat(test.oxseourl, '%') and (oxtype = 'oxcategory' or oxtype = 'oxarticle')");
     $oDb->execute("delete from oxseo where oxseo.oxtype = 'oxarticle' and oxseo.oxparams = {$sIdQuoted}");
     $oDb->execute("delete from oxseo where oxobjectid = {$sIdQuoted} and oxtype = 'oxcategory'");
     $oDb->execute("delete from oxobject2seodata where oxobjectid = {$sIdQuoted}");
 }
コード例 #8
0
ファイル: oxcategory.php プロジェクト: Crease29/oxideshop_ce
 /**
  * sets the state of has visible sub categories for the category
  *
  * @param bool $blHasVisibleSubcats marker if category has visible subcategories
  */
 public function setHasVisibleSubCats($blHasVisibleSubcats)
 {
     if ($blHasVisibleSubcats && !$this->_blHasVisibleSubCats) {
         unset($this->_blIsVisible);
         if ($this->_oParent instanceof oxCategory) {
             $this->_oParent->setHasVisibleSubCats(true);
         }
     }
     $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
 }
コード例 #9
0
ファイル: Category.php プロジェクト: Alpha-Sys/oxideshop_ce
 /**
  * sets the state of has visible sub categories for the category
  *
  * @param bool $blHasVisibleSubcats marker if category has visible subcategories
  */
 public function setHasVisibleSubCats($blHasVisibleSubcats)
 {
     if ($blHasVisibleSubcats && !$this->_blHasVisibleSubCats) {
         unset($this->_blIsVisible);
         if ($this->_oParent instanceof \OxidEsales\EshopCommunity\Application\Model\Category) {
             $this->_oParent->setHasVisibleSubCats(true);
         }
     }
     $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
 }
コード例 #10
0
ファイル: category_main.php プロジェクト: ioanok/symfoxid
 /**
  * Delete category picture, specified in $sField parameter
  *
  * @param oxCategory $oItem  active category object
  * @param string     $sField picture field name
  *
  * @return null
  */
 protected function _deleteCatPicture(oxCategory $oItem, $sField)
 {
     $myConfig = $this->getConfig();
     $sItemKey = 'oxcategories__' . $sField;
     switch ($sField) {
         case 'oxthumb':
             $sImgType = 'TC';
             break;
         case 'oxicon':
             $sImgType = 'CICO';
             break;
         case 'oxpromoicon':
             $sImgType = 'PICO';
             break;
         default:
             $sImgType = false;
     }
     if ($sImgType !== false) {
         /** @var oxUtilsPic $myUtilsPic */
         $myUtilsPic = oxRegistry::get("oxUtilsPic");
         /** @var oxUtilsFile $oUtilsFile */
         $oUtilsFile = oxRegistry::get("oxUtilsFile");
         $sDir = $myConfig->getPictureDir(false);
         $myUtilsPic->safePictureDelete($oItem->{$sItemKey}->value, $sDir . $oUtilsFile->getImageDirByType($sImgType), 'oxcategories', $sField);
         $oItem->{$sItemKey} = new oxField();
         $oItem->save();
     }
 }