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