article_main.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Article_Main extends oxAdminDetails
00010 {
00017     public function render()
00018     {
00019         $myConfig = $this->getConfig();
00020         parent::render();
00021 
00022         $this->_aViewData['edit'] = $oArticle = oxNew( 'oxarticle' );
00023 
00024         $soxId = $this->getEditObjectId();
00025         $svoxId = oxConfig::getParameter( "voxid" );
00026         $soxparentId = oxConfig::getParameter( "oxparentid" );
00027 
00028         // new variant ?
00029         if ( isset( $svoxId ) && $svoxId == "-1" && isset($soxparentId) && $soxparentId && $soxparentId != "-1") {
00030             $oParentArticle = oxNew( "oxarticle");
00031             $oParentArticle->load( $soxparentId);
00032             $this->_aViewData["parentarticle"] = $oParentArticle;
00033             $this->_aViewData["oxparentid"] = $soxparentId;
00034 
00035             $this->_aViewData["oxid"] =  $soxId = "-1";
00036         }
00037 
00038         if (  $soxId && $soxId != "-1") {
00039 
00040             // load object
00041             $oArticle->loadInLang( $this->_iEditLang, $soxId );
00042 
00043 
00044             // load object in other languages
00045             $oOtherLang = $oArticle->getAvailableInLangs();
00046             if (!isset($oOtherLang[$this->_iEditLang])) {
00047                 // echo "language entry doesn't exist! using: ".key($oOtherLang);
00048                 $oArticle->loadInLang( key($oOtherLang), $soxId );
00049             }
00050 
00051             // variant handling
00052             if ( $oArticle->oxarticles__oxparentid->value) {
00053                 $oParentArticle = oxNew( "oxarticle");
00054                 $oParentArticle->load( $oArticle->oxarticles__oxparentid->value);
00055                 $this->_aViewData["parentarticle"] = $oParentArticle;
00056                 $this->_aViewData["oxparentid"]    = $oArticle->oxarticles__oxparentid->value;
00057                 $this->_aViewData["issubvariant"]  = 1;
00058             }
00059 
00060             // #381A
00061             $this->_formJumpList($oArticle, $oParentArticle );
00062 
00063             //loading tags
00064             $oArticleTagList = oxNew( "oxarticletaglist" );
00065             $oArticleTagList->loadInLang( $this->_iEditLang, $oArticle->getId() );
00066             $oArticle->tags = $oArticleTagList->get();
00067 
00068             $aLang = array_diff (oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00069             if ( count( $aLang))
00070                 $this->_aViewData["posslang"] = $aLang;
00071 
00072             foreach ( $oOtherLang as $id => $language) {
00073                 $oLang= new stdClass();
00074                 $oLang->sLangDesc = $language;
00075                 $oLang->selected = ($id == $this->_iEditLang);
00076                 $this->_aViewData["otherlang"][$id] =  clone $oLang;
00077             }
00078         }
00079 
00080         $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oArticle, "oxarticles__oxlongdesc", "details.tpl.css");
00081         $this->_aViewData["blUseTimeCheck"] = $myConfig->getConfigParam( 'blUseTimeCheck' );
00082 
00083         return "article_main.tpl";
00084     }
00085 
00094     protected function _getEditValue( $oObject, $sField )
00095     {
00096         $sEditObjectValue = '';
00097         if ( $oObject ) {
00098             $oDescField = $oObject->getLongDescription();
00099             $sEditObjectValue = $this->_processEditValue( $oDescField->getRawValue() );
00100             $oDescField = new oxField( $sEditObjectValue, oxField::T_RAW );
00101         }
00102 
00103         return $sEditObjectValue;
00104     }
00105 
00111     public function save()
00112     {
00113         parent::save();
00114 
00115         $oConfig = $this->getConfig();
00116         $soxId    = $this->getEditObjectId();
00117         $aParams  = $oConfig->getRequestParameter( "editval" );
00118 
00119         // default values
00120         $aParams = $this->addDefaultValues( $aParams );
00121 
00122         // null values
00123         if (isset($aParams['oxarticles__oxvat']) && $aParams['oxarticles__oxvat'] === '') {
00124             $aParams['oxarticles__oxvat'] = null;
00125         }
00126 
00127         // varianthandling
00128         $soxparentId = $oConfig->getRequestParameter( "oxparentid");
00129         if ( isset( $soxparentId) && $soxparentId && $soxparentId != "-1") {
00130             $aParams['oxarticles__oxparentid'] = $soxparentId;
00131         } else {
00132             unset( $aParams['oxarticles__oxparentid']);
00133         }
00134 
00135         $oArticle = oxNew( "oxarticle");
00136         $oArticle->setLanguage($this->_iEditLang);
00137 
00138         if ( $soxId != "-1") {
00139             $oArticle->loadInLang( $this->_iEditLang, $soxId);
00140         } else {
00141             $aParams['oxarticles__oxid']        = null;
00142             $aParams['oxarticles__oxissearch']  = 1;
00143             $aParams['oxarticles__oxstockflag'] = 1;
00144             if ( empty($aParams['oxarticles__oxstock']) ) {
00145                 $aParams['oxarticles__oxstock'] = 0;
00146             }
00147 
00148                 // shopid
00149                 $aParams['oxarticles__oxshopid'] = oxRegistry::getSession()->getVariable( "actshop");
00150 
00151             if (!isset($aParams['oxarticles__oxactive'])) {
00152                 $aParams['oxarticles__oxactive'] = 0;
00153             }
00154         }
00155 
00156         //article number handling, warns for artnum dublicates
00157         if ( isset( $aParams['oxarticles__oxartnum']) && strlen($aParams['oxarticles__oxartnum']) > 0 &&
00158             $oConfig->getConfigParam( 'blWarnOnSameArtNums' ) &&
00159             $oArticle->oxarticles__oxartnum->value !=  $aParams['oxarticles__oxartnum']
00160             ) {
00161             $sSelect  = "select oxid from ".getViewName( 'oxarticles' );
00162             $sSelect .= " where oxartnum = '".$aParams['oxarticles__oxartnum']."'";
00163             $sSelect .= " and oxid != '".$aParams['oxarticles__oxid']."'";
00164             if ($oArticle->assignRecord( $sSelect ))
00165                 $this->_aViewData["errorsavingatricle"] = 1;
00166         }
00167 
00168 
00169             // #905A resetting article count in price categories if price has been changed
00170             if ( isset($aParams["oxarticles__oxprice"]) && $aParams["oxarticles__oxprice"] != $oArticle->oxarticles__oxprice->value) {
00171                 $this->resetCounter( "priceCatArticle", $oArticle->oxarticles__oxprice->value );
00172             }
00173 
00174             $aResetIds = array();
00175             if ( isset($aParams['oxarticles__oxactive']) && $aParams['oxarticles__oxactive'] != $oArticle->oxarticles__oxactive->value) {
00176                 //check categories
00177                 $this->_resetCategoriesCounter( $oArticle->oxarticles__oxid->value );
00178 
00179                 // vendors
00180                 $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1;
00181                 $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1;
00182             }
00183 
00184             // vendors
00185             if ( isset($aParams['oxarticles__oxvendorid']) && $aParams['oxarticles__oxvendorid'] != $oArticle->oxarticles__oxvendorid->value) {
00186                 $aResetIds['vendor'][$aParams['oxarticles__oxvendorid']] = 1;
00187                 $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1;
00188             }
00189 
00190             // manufacturers
00191             if ( isset($aParams['oxarticles__oxmanufacturerid']) && $aParams['oxarticles__oxmanufacturerid'] != $oArticle->oxarticles__oxmanufacturerid->value ) {
00192                 $aResetIds['manufacturer'][$aParams['oxarticles__oxmanufacturerid']] = 1;
00193                 $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1;
00194             }
00195 
00196             // resetting counts
00197             $this->_resetCounts( $aResetIds );
00198 
00199         $oArticle->setLanguage(0);
00200 
00201         //triming spaces from article title (M:876)
00202         if (isset($aParams['oxarticles__oxtitle'])) {
00203             $aParams['oxarticles__oxtitle'] = trim( $aParams['oxarticles__oxtitle'] );
00204         }
00205 
00206         $oArticle->assign( $aParams );
00207         $oArticle->setArticleLongDesc( $this->_processLongDesc( $aParams['oxarticles__oxlongdesc'] ) );
00208         $oArticle->setLanguage($this->_iEditLang);
00209         $oArticle = oxRegistry::get("oxUtilsFile")->processFiles( $oArticle );
00210         $oArticle->save();
00211 
00212         // set oxid if inserted
00213         if ( $soxId == "-1") {
00214             $sFastCat = $oConfig->getRequestParameter( "art_category");
00215             if ( $sFastCat != "-1") {
00216                 $this->addToCategory($sFastCat, $oArticle->getId());
00217             }
00218         }
00219 
00220         //saving tags
00221         if (isset($aParams['tags'])) {
00222             $sTags = $aParams['tags'];
00223             if (!trim($sTags)) {
00224                 $sTags = $oArticle->oxarticles__oxsearchkeys->value;
00225             }
00226             $aInvalidTags = $this->_setTags( $sTags, $oArticle->getId() );
00227             if ( !empty( $aInvalidTags ) ) {
00228                 $this->_aViewData["invalid_tags"] = implode( ', ', $aInvalidTags );
00229             }
00230         }
00231 
00232         $this->setEditObjectId( $oArticle->getId() );
00233     }
00234 
00242     protected function _processLongDesc( $sValue )
00243     {
00244         // TODO: the code below is redundant, optimize it, assignments should go smooth without conversions
00245         // hack, if editor screws up text, htmledit tends to do so
00246         $sValue = str_replace( '&amp;nbsp;', '&nbsp;', $sValue );
00247         $sValue = str_replace( '&amp;', '&', $sValue );
00248         $sValue = str_replace( '&quot;', '"', $sValue );
00249         $sValue = str_replace( '&lang=', '&amp;lang=', $sValue);
00250         $sValue = str_replace( '<p>&nbsp;</p>', '', $sValue);
00251         $sValue = str_replace( '<p>&nbsp; </p>', '', $sValue);
00252 
00253         return $sValue;
00254     }
00255 
00263     protected function _resetCategoriesCounter( $sArticleId )
00264     {
00265         $oDb = oxDb::getDb();
00266         $sQ = "select oxcatnid from oxobject2category where oxobjectid = ".$oDb->quote( $sArticleId );
00267         $oRs = $oDb->execute($sQ);
00268         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00269             while (!$oRs->EOF) {
00270                 $this->resetCounter( "catArticle", $oRs->fields[0] );
00271                 $oRs->moveNext();
00272             }
00273         }
00274     }
00275 
00284     protected function _setTags( $sTags, $sArticleId )
00285     {
00286         $oArticleTagList = oxNew('oxarticletaglist');
00287         $oArticleTagList->loadInLang( $this->_iEditLang, $sArticleId );
00288         $oArticleTagList->set( $sTags );
00289         $oArticleTagList->save();
00290 
00291         return $oArticleTagList->get()->getInvalidTags();
00292     }
00293 
00302     public function addToCategory($sCatID, $sOXID)
00303     {
00304         $myConfig  = $this->getConfig();
00305 
00306         $oNew = oxNew( "oxbase");
00307         $oNew->init( "oxobject2category" );
00308         $oNew->oxobject2category__oxtime     = new oxField( 0 );
00309         $oNew->oxobject2category__oxobjectid = new oxField( $sOXID );
00310         $oNew->oxobject2category__oxcatnid   = new oxField( $sCatID );
00311 
00312         $oNew->save();
00313 
00314             // resetting amount of articles in category
00315             $this->resetCounter( "catArticle", $sCatID );
00316     }
00317 
00327     public function copyArticle( $sOldId = null, $sNewId = null, $sParentId = null )
00328     {
00329         $myConfig = $this->getConfig();
00330 
00331         $sOldId = $sOldId ? $sOldId : $this->getEditObjectId();
00332         $sNewId = $sNewId ? $sNewId : oxUtilsObject::getInstance()->generateUID();
00333 
00334         $oArticle = oxNew( 'oxbase' );
00335         $oArticle->init( 'oxarticles' );
00336         if ( $oArticle->load( $sOldId ) ) {
00337 
00338             if ( $myConfig->getConfigParam( 'blDisableDublArtOnCopy' ) ) {
00339                 $oArticle->oxarticles__oxactive->setValue( 0 );
00340                 $oArticle->oxarticles__oxactivefrom->setValue( 0 );
00341                 $oArticle->oxarticles__oxactiveto->setValue( 0 );
00342             }
00343 
00344             // setting parent id
00345             if ( $sParentId ) {
00346                 $oArticle->oxarticles__oxparentid->setValue( $sParentId );
00347             }
00348 
00349             // setting oxinsert/oxtimestamp
00350             $iNow = date( 'Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime() );
00351             $oArticle->oxarticles__oxinsert    = new oxField( $iNow );
00352 
00353             // mantis#0001590: OXRATING and OXRATINGCNT not set to 0 when copying article
00354             $oArticle->oxarticles__oxrating    = new oxField( 0 );
00355             $oArticle->oxarticles__oxratingcnt = new oxField( 0 );
00356 
00357             $oArticle->setId( $sNewId );
00358             $oArticle->save();
00359 
00360             //copy categories
00361             $this->_copyCategories( $sOldId, $sNewId );
00362 
00363             //atributes
00364             $this->_copyAttributes( $sOldId, $sNewId );
00365 
00366             //sellist
00367             $this->_copySelectlists( $sOldId, $sNewId );
00368 
00369             //crossseling
00370             $this->_copyCrossseling( $sOldId, $sNewId );
00371 
00372             //accessoire
00373             $this->_copyAccessoires( $sOldId, $sNewId );
00374 
00375             // #983A copying staffelpreis info
00376             $this->_copyStaffelpreis( $sOldId, $sNewId );
00377 
00378             //copy article extends (longdescription, tags)
00379             $this->_copyArtExtends( $sOldId, $sNewId);
00380 
00381             //files
00382             $this->_copyFiles( $sOldId, $sNewId );
00383 
00384                 // resetting
00385                 $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1;
00386                 $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1;
00387                 $this->_resetCounts( $aResetIds );
00388 
00389 
00390             $myUtilsObject = oxUtilsObject::getInstance();
00391             $oDb = oxDb::getDb();
00392 
00393             //copy variants
00394             $sQ = "select oxid from oxarticles where oxparentid = ".$oDb->quote( $sOldId );
00395             $oRs = $oDb->execute( $sQ );
00396             if ( $oRs !== false && $oRs->recordCount() > 0) {
00397                 while ( !$oRs->EOF ) {
00398                     $this->copyArticle( $oRs->fields[0], $myUtilsObject->generateUid(), $sNewId );
00399                     $oRs->moveNext();
00400                 }
00401             }
00402 
00403             // only for top articles
00404             if ( !$sParentId ) {
00405 
00406                 $this->setEditObjectId( $oArticle->getId() );
00407 
00408                 //article number handling, warns for artnum dublicates
00409                 if ( $myConfig->getConfigParam( 'blWarnOnSameArtNums' ) &&
00410                      $oArticle->oxarticles__oxartnum->value && oxConfig::getParameter( 'fnc' ) == 'copyArticle' ) {
00411                     $sSelect = "select oxid from ".$oArticle->getCoreTableName()."
00412                                 where oxartnum = ".$oDb->quote( $oArticle->oxarticles__oxartnum->value )." and oxid != ".$oDb->quote( $sNewId );
00413 
00414                     if ( $oArticle->assignRecord( $sSelect ) ) {
00415                         $this->_aViewData["errorsavingatricle"] = 1;
00416                     }
00417                 }
00418             }
00419         }
00420     }
00421 
00430     protected function _copyCategories( $sOldId, $sNewId )
00431     {
00432         $myUtilsObject = oxUtilsObject::getInstance();
00433         $oShopMetaData = oxRegistry::get("oxShopMetaData");
00434         $oDb = oxDb::getDb();
00435 
00436 
00437         $sO2CView = getViewName( 'oxobject2category' );
00438         $sQ = "select oxcatnid, oxtime from {$sO2CView} where oxobjectid = ".$oDb->quote( $sOldId );
00439         $oRs = $oDb->execute( $sQ );
00440         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00441             while ( !$oRs->EOF ) {
00442                 $sUid = $myUtilsObject->generateUid();
00443                 $sCatId = $oRs->fields[0];
00444                 $sTime  = $oRs->fields[1];
00445 
00446 
00447                     $oDb->execute("insert into oxobject2category (oxid, oxobjectid, oxcatnid, oxtime) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sNewId ).", ".$oDb->quote( $sCatId ).", ".$oDb->quote( $sTime ).") ");
00448 
00449                 $oRs->moveNext();
00450 
00451                     // resetting article count in category
00452                     $this->resetCounter( "catArticle", $sCatId );
00453             }
00454         }
00455     }
00456 
00465     protected function _copyAttributes( $sOldId, $sNewId )
00466     {
00467         $myUtilsObject = oxUtilsObject::getInstance();
00468         $oDb = oxDb::getDb();
00469 
00470         $sQ = "select oxid from oxobject2attribute where oxobjectid = ".$oDb->quote( $sOldId );
00471         $oRs = $oDb->execute($sQ);
00472         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00473             while ( !$oRs->EOF ) {
00474                 // #1055A
00475                 $oAttr = oxNew( "oxbase" );
00476                 $oAttr->init( "oxobject2attribute" );
00477                 $oAttr->load( $oRs->fields[0] );
00478                 $oAttr->setId( $myUtilsObject->generateUID() );
00479                 $oAttr->oxobject2attribute__oxobjectid->setValue( $sNewId );
00480                 $oAttr->save();
00481                 $oRs->moveNext();
00482             }
00483         }
00484     }
00485 
00494     protected function _copyFiles( $sOldId, $sNewId )
00495     {
00496         $myUtilsObject = oxUtilsObject::getInstance();
00497         $oDb = oxDb::getDb( oxDB::FETCH_MODE_ASSOC );
00498 
00499         $sQ = "SELECT * FROM `oxfiles` WHERE `oxartid` = ".$oDb->quote( $sOldId );
00500         $oRs = $oDb->execute($sQ);
00501         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00502             while ( !$oRs->EOF ) {
00503 
00504                 $oFile = oxNew( "oxfile" );
00505                 $oFile->setId( $myUtilsObject->generateUID() );
00506                 $oFile->oxfiles__oxartid = new oxField( $sNewId );
00507                 $oFile->oxfiles__oxfilename =  new oxField( $oRs->fields['OXFILENAME'] );
00508                 $oFile->oxfiles__oxfilesize =  new oxField( $oRs->fields['OXFILESIZE'] );
00509                 $oFile->oxfiles__oxstorehash =  new oxField( $oRs->fields['OXSTOREHASH'] );
00510                 $oFile->oxfiles__oxpurchasedonly =  new oxField( $oRs->fields['OXPURCHASEDONLY'] );
00511                 $oFile->save();
00512                 $oRs->moveNext();
00513             }
00514         }
00515     }
00516 
00525     protected function _copySelectlists( $sOldId, $sNewId )
00526     {
00527         $myUtilsObject = oxUtilsObject::getInstance();
00528         $oDb = oxDb::getDb();
00529 
00530         $sQ = "select oxselnid from oxobject2selectlist where oxobjectid = ".$oDb->quote( $sOldId );
00531         $oRs = $oDb->execute( $sQ );
00532         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00533             while ( !$oRs->EOF ) {
00534                 $sUid = $myUtilsObject->generateUID();
00535                 $sId = $oRs->fields[0];
00536                 $oDb->execute( "insert into oxobject2selectlist (oxid, oxobjectid, oxselnid) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sNewId ).", ".$oDb->quote( $sId ).") " );
00537                 $oRs->moveNext();
00538             }
00539         }
00540     }
00541 
00550     protected function _copyCrossseling( $sOldId, $sNewId )
00551     {
00552         $myUtilsObject = oxUtilsObject::getInstance();
00553         $oDb = oxDb::getDb();
00554 
00555         $sQ = "select oxobjectid from oxobject2article where oxarticlenid = ".$oDb->quote( $sOldId );
00556         $oRs = $oDb->execute( $sQ );
00557         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00558             while ( !$oRs->EOF ) {
00559                 $sUid = $myUtilsObject->generateUID();
00560                 $sId = $oRs->fields[0];
00561                 $oDb->execute("insert into oxobject2article (oxid, oxobjectid, oxarticlenid) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sId ).", ".$oDb->quote( $sNewId )." ) ");
00562                 $oRs->moveNext();
00563             }
00564         }
00565     }
00566 
00575     protected function _copyAccessoires( $sOldId, $sNewId )
00576     {
00577         $myUtilsObject = oxUtilsObject::getInstance();
00578         $oDb = oxDb::getDb();
00579 
00580         $sQ = "select oxobjectid from oxaccessoire2article where oxarticlenid= ".$oDb->quote( $sOldId );
00581         $oRs = $oDb->execute( $sQ );
00582         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00583             while ( !$oRs->EOF ) {
00584                 $sUId = $myUtilsObject->generateUid();
00585                 $sId = $oRs->fields[0];
00586                 $oDb->execute( "insert into oxaccessoire2article (oxid, oxobjectid, oxarticlenid) VALUES (".$oDb->quote( $sUId ).", ".$oDb->quote( $sId ).", ".$oDb->quote( $sNewId ).") " );
00587                 $oRs->moveNext();
00588             }
00589         }
00590     }
00591 
00600     protected function _copyStaffelpreis( $sOldId, $sNewId )
00601     {
00602         $sShopId = $this->getConfig()->getShopId();
00603         $oPriceList = oxNew( "oxlist" );
00604         $oPriceList->init( "oxbase", "oxprice2article" );
00605         $sQ = "select * from oxprice2article where oxartid = '$sOldId' and oxshopid = '$sShopId' and (oxamount > 0 or oxamountto > 0) order by oxamount ";
00606         $oPriceList->selectString( $sQ );
00607         if ( $oPriceList->count() ) {
00608             foreach ( $oPriceList as $oItem ) {
00609                 $oItem->oxprice2article__oxid->setValue( $oItem->setId() );
00610                 $oItem->oxprice2article__oxartid->setValue( $sNewId );
00611                 $oItem->save();
00612             }
00613         }
00614     }
00615 
00624     protected function _copyArtExtends( $sOldId, $sNewId)
00625     {
00626         $oExt = oxNew( "oxbase");
00627         $oExt->init( "oxartextends" );
00628         $oExt->load( $sOldId );
00629         $oExt->setId( $sNewId );
00630         $oExt->save();
00631     }
00632 
00633 
00639     public function saveinnlang()
00640     {
00641         $this->save();
00642     }
00643 
00652     public function addDefaultValues( $aParams )
00653     {
00654         return $aParams;
00655     }
00656 
00665     protected function _formJumpList( $oArticle, $oParentArticle )
00666     {
00667         $aJumpList = array();
00668         //fetching parent article variants
00669         if ( isset( $oParentArticle ) ) {
00670             $aJumpList[] = array( $oParentArticle->oxarticles__oxid->value, $this->_getTitle( $oParentArticle ) );
00671             $oParentVariants = $oParentArticle->getAdminVariants( oxConfig::getParameter( "editlanguage" ) );
00672             if ( $oParentVariants->count()) {
00673                 foreach ( $oParentVariants as $oVar) {
00674                     $aJumpList[] = array( $oVar->oxarticles__oxid->value, " - ".$this->_getTitle( $oVar ) );
00675                     if ( $oVar->oxarticles__oxid->value == $oArticle->oxarticles__oxid->value ) {
00676                         $oVariants = $oArticle->getAdminVariants(oxConfig::getParameter( "editlanguage"));
00677                         if ( $oVariants->count() ) {
00678                             foreach ( $oVariants as $oVVar) {
00679                                 $aJumpList[] = array( $oVVar->oxarticles__oxid->value, " -- ".$this->_getTitle( $oVVar));
00680                             }
00681                         }
00682                     }
00683                 }
00684             }
00685         } else {
00686             $aJumpList[] = array( $oArticle->oxarticles__oxid->value, $this->_getTitle( $oArticle));
00687             //fetching this article variants data
00688             $oVariants = $oArticle->getAdminVariants(oxConfig::getParameter( "editlanguage"));
00689             if ( $oVariants && $oVariants->count())
00690                 foreach ($oVariants as $oVar) {
00691                     $aJumpList[] = array( $oVar->oxarticles__oxid->value, " - ".$this->_getTitle( $oVar));
00692                 }
00693         }
00694         if ( count($aJumpList) > 1)
00695             $this->_aViewData["thisvariantlist"] = $aJumpList;
00696     }
00697 
00705     protected function _getTitle( $oObj )
00706     {
00707         $sTitle = $oObj->oxarticles__oxtitle->value;
00708         if ( !strlen( $sTitle ) ) {
00709             $sTitle = $oObj->oxarticles__oxvarselect->value;
00710         }
00711 
00712         return $sTitle;
00713     }
00714 
00720     public function getCategoryList()
00721     {
00722         $oCatTree = oxNew( "oxCategoryList");
00723         $oCatTree->loadList();
00724         return $oCatTree;
00725     }
00726 
00732     public function getVendorList()
00733     {
00734         $oVendorlist = oxNew( "oxvendorlist" );
00735         $oVendorlist->loadVendorList();
00736 
00737         return $oVendorlist;
00738     }
00739 
00745     public function getManufacturerList()
00746     {
00747         $oManufacturerList = oxNew( "oxmanufacturerlist" );
00748         $oManufacturerList->loadManufacturerList();
00749 
00750         return $oManufacturerList;
00751     }
00752 }