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         $sValue = str_replace( '<p>&nbsp;</p>', '', $sValue);
00256         $sValue = str_replace( '<p>&nbsp; </p>', '', $sValue);
00257 
00258         return $sValue;
00259     }
00260 
00268     protected function _resetCategoriesCounter( $sArticleId )
00269     {
00270         $oDb = oxDb::getDb();
00271         $sQ = "select oxcatnid from oxobject2category where oxobjectid = ".$oDb->quote( $sArticleId );
00272         $oRs = $oDb->execute($sQ);
00273         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00274             while (!$oRs->EOF) {
00275                 $this->resetCounter( "catArticle", $oRs->fields[0] );
00276                 $oRs->moveNext();
00277             }
00278         }
00279     }
00280 
00289     protected function _setTags( $sTags, $sArticleId )
00290     {
00291         $oArticleTagList = oxNew('oxarticletaglist');
00292         $oArticleTagList->loadInLang( $this->_iEditLang, $sArticleId );
00293         $oArticleTagList->set( $sTags );
00294         $oArticleTagList->save();
00295 
00296         return $oArticleTagList->get()->getInvalidTags();
00297     }
00298 
00307     public function addToCategory($sCatID, $sOXID)
00308     {
00309         $myConfig  = $this->getConfig();
00310 
00311         $oNew = oxNew( "oxbase");
00312         $oNew->init( "oxobject2category" );
00313         $oNew->oxobject2category__oxtime     = new oxField( 0 );
00314         $oNew->oxobject2category__oxobjectid = new oxField( $sOXID );
00315         $oNew->oxobject2category__oxcatnid   = new oxField( $sCatID );
00316 
00317         $oNew->save();
00318 
00319             // resetting amount of articles in category
00320             $this->resetCounter( "catArticle", $sCatID );
00321     }
00322 
00332     public function copyArticle( $sOldId = null, $sNewId = null, $sParentId = null )
00333     {
00334         $myConfig = $this->getConfig();
00335 
00336         $sOldId = $sOldId ? $sOldId : $this->getEditObjectId();
00337         $sNewId = $sNewId ? $sNewId : oxUtilsObject::getInstance()->generateUID();
00338 
00339         $oArticle = oxNew( 'oxbase' );
00340         $oArticle->init( 'oxarticles' );
00341         if ( $oArticle->load( $sOldId ) ) {
00342 
00343             if ( $myConfig->getConfigParam( 'blDisableDublArtOnCopy' ) ) {
00344                 $oArticle->oxarticles__oxactive->setValue( 0 );
00345                 $oArticle->oxarticles__oxactivefrom->setValue( 0 );
00346                 $oArticle->oxarticles__oxactiveto->setValue( 0 );
00347             }
00348 
00349             // setting parent id
00350             if ( $sParentId ) {
00351                 $oArticle->oxarticles__oxparentid->setValue( $sParentId );
00352             }
00353 
00354             // setting oxinsert/oxtimestamp
00355             $iNow = date( 'Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime() );
00356             $oArticle->oxarticles__oxinsert    = new oxField( $iNow );
00357 
00358             // mantis#0001590: OXRATING and OXRATINGCNT not set to 0 when copying article
00359             $oArticle->oxarticles__oxrating    = new oxField( 0 );
00360             $oArticle->oxarticles__oxratingcnt = new oxField( 0 );
00361 
00362             $oArticle->setId( $sNewId );
00363             $oArticle->save();
00364 
00365             //copy categories
00366             $this->_copyCategories( $sOldId, $sNewId );
00367 
00368             //atributes
00369             $this->_copyAttributes( $sOldId, $sNewId );
00370 
00371             //sellist
00372             $this->_copySelectlists( $sOldId, $sNewId );
00373 
00374             //crossseling
00375             $this->_copyCrossseling( $sOldId, $sNewId );
00376 
00377             //accessoire
00378             $this->_copyAccessoires( $sOldId, $sNewId );
00379 
00380             // #983A copying staffelpreis info
00381             $this->_copyStaffelpreis( $sOldId, $sNewId );
00382 
00383             //copy article extends (longdescription, tags)
00384             $this->_copyArtExtends( $sOldId, $sNewId);
00385 
00386             //files
00387             $this->_copyFiles( $sOldId, $sNewId );
00388 
00389                 // resetting
00390                 $aResetIds['vendor'][$oArticle->oxarticles__oxvendorid->value] = 1;
00391                 $aResetIds['manufacturer'][$oArticle->oxarticles__oxmanufacturerid->value] = 1;
00392                 $this->_resetCounts( $aResetIds );
00393 
00394 
00395             $myUtilsObject = oxUtilsObject::getInstance();
00396             $oDb = oxDb::getDb();
00397 
00398             //copy variants
00399             $sQ = "select oxid from oxarticles where oxparentid = ".$oDb->quote( $sOldId );
00400             $oRs = $oDb->execute( $sQ );
00401             if ( $oRs !== false && $oRs->recordCount() > 0) {
00402                 while ( !$oRs->EOF ) {
00403                     $this->copyArticle( $oRs->fields[0], $myUtilsObject->generateUid(), $sNewId );
00404                     $oRs->moveNext();
00405                 }
00406             }
00407 
00408             // only for top articles
00409             if ( !$sParentId ) {
00410 
00411                 $this->setEditObjectId( $oArticle->getId() );
00412 
00413                 //article number handling, warns for artnum dublicates
00414                 if ( $myConfig->getConfigParam( 'blWarnOnSameArtNums' ) &&
00415                      $oArticle->oxarticles__oxartnum->value && oxConfig::getParameter( 'fnc' ) == 'copyArticle' ) {
00416                     $sSelect = "select oxid from ".$oArticle->getCoreTableName()."
00417                                 where oxartnum = ".$oDb->quote( $oArticle->oxarticles__oxartnum->value )." and oxid != ".$oDb->quote( $sNewId );
00418 
00419                     if ( $oArticle->assignRecord( $sSelect ) ) {
00420                         $this->_aViewData["errorsavingatricle"] = 1;
00421                     }
00422                 }
00423             }
00424         }
00425     }
00426 
00435     protected function _copyCategories( $sOldId, $sNewId )
00436     {
00437         $myUtilsObject = oxUtilsObject::getInstance();
00438         $oShopMetaData = oxRegistry::get("oxShopMetaData");
00439         $oDb = oxDb::getDb();
00440 
00441 
00442         $sO2CView = getViewName( 'oxobject2category' );
00443         $sQ = "select oxcatnid, oxtime from {$sO2CView} where oxobjectid = ".$oDb->quote( $sOldId );
00444         $oRs = $oDb->execute( $sQ );
00445         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00446             while ( !$oRs->EOF ) {
00447                 $sUid = $myUtilsObject->generateUid();
00448                 $sCatId = $oRs->fields[0];
00449                 $sTime  = $oRs->fields[1];
00450 
00451 
00452                     $oDb->execute("insert into oxobject2category (oxid, oxobjectid, oxcatnid, oxtime) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sNewId ).", ".$oDb->quote( $sCatId ).", ".$oDb->quote( $sTime ).") ");
00453 
00454                 $oRs->moveNext();
00455 
00456                     // resetting article count in category
00457                     $this->resetCounter( "catArticle", $sCatId );
00458             }
00459         }
00460     }
00461 
00470     protected function _copyAttributes( $sOldId, $sNewId )
00471     {
00472         $myUtilsObject = oxUtilsObject::getInstance();
00473         $oDb = oxDb::getDb();
00474 
00475         $sQ = "select oxid from oxobject2attribute where oxobjectid = ".$oDb->quote( $sOldId );
00476         $oRs = $oDb->execute($sQ);
00477         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00478             while ( !$oRs->EOF ) {
00479                 // #1055A
00480                 $oAttr = oxNew( "oxbase" );
00481                 $oAttr->init( "oxobject2attribute" );
00482                 $oAttr->load( $oRs->fields[0] );
00483                 $oAttr->setId( $myUtilsObject->generateUID() );
00484                 $oAttr->oxobject2attribute__oxobjectid->setValue( $sNewId );
00485                 $oAttr->save();
00486                 $oRs->moveNext();
00487             }
00488         }
00489     }
00490 
00499     protected function _copyFiles( $sOldId, $sNewId )
00500     {
00501         $myUtilsObject = oxUtilsObject::getInstance();
00502         $oDb = oxDb::getDb( oxDB::FETCH_MODE_ASSOC );
00503 
00504         $sQ = "SELECT * FROM `oxfiles` WHERE `oxartid` = ".$oDb->quote( $sOldId );
00505         $oRs = $oDb->execute($sQ);
00506         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00507             while ( !$oRs->EOF ) {
00508 
00509                 $oFile = oxNew( "oxfile" );
00510                 $oFile->setId( $myUtilsObject->generateUID() );
00511                 $oFile->oxfiles__oxartid = new oxField( $sNewId );
00512                 $oFile->oxfiles__oxfilename =  new oxField( $oRs->fields['OXFILENAME'] );
00513                 $oFile->oxfiles__oxfilesize =  new oxField( $oRs->fields['OXFILESIZE'] );
00514                 $oFile->oxfiles__oxstorehash =  new oxField( $oRs->fields['OXSTOREHASH'] );
00515                 $oFile->oxfiles__oxpurchasedonly =  new oxField( $oRs->fields['OXPURCHASEDONLY'] );
00516                 $oFile->save();
00517                 $oRs->moveNext();
00518             }
00519         }
00520     }
00521 
00530     protected function _copySelectlists( $sOldId, $sNewId )
00531     {
00532         $myUtilsObject = oxUtilsObject::getInstance();
00533         $oDb = oxDb::getDb();
00534 
00535         $sQ = "select oxselnid from oxobject2selectlist where oxobjectid = ".$oDb->quote( $sOldId );
00536         $oRs = $oDb->execute( $sQ );
00537         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00538             while ( !$oRs->EOF ) {
00539                 $sUid = $myUtilsObject->generateUID();
00540                 $sId = $oRs->fields[0];
00541                 $oDb->execute( "insert into oxobject2selectlist (oxid, oxobjectid, oxselnid) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sNewId ).", ".$oDb->quote( $sId ).") " );
00542                 $oRs->moveNext();
00543             }
00544         }
00545     }
00546 
00555     protected function _copyCrossseling( $sOldId, $sNewId )
00556     {
00557         $myUtilsObject = oxUtilsObject::getInstance();
00558         $oDb = oxDb::getDb();
00559 
00560         $sQ = "select oxobjectid from oxobject2article where oxarticlenid = ".$oDb->quote( $sOldId );
00561         $oRs = $oDb->execute( $sQ );
00562         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00563             while ( !$oRs->EOF ) {
00564                 $sUid = $myUtilsObject->generateUID();
00565                 $sId = $oRs->fields[0];
00566                 $oDb->execute("insert into oxobject2article (oxid, oxobjectid, oxarticlenid) VALUES (".$oDb->quote( $sUid ).", ".$oDb->quote( $sId ).", ".$oDb->quote( $sNewId )." ) ");
00567                 $oRs->moveNext();
00568             }
00569         }
00570     }
00571 
00580     protected function _copyAccessoires( $sOldId, $sNewId )
00581     {
00582         $myUtilsObject = oxUtilsObject::getInstance();
00583         $oDb = oxDb::getDb();
00584 
00585         $sQ = "select oxobjectid from oxaccessoire2article where oxarticlenid= ".$oDb->quote( $sOldId );
00586         $oRs = $oDb->execute( $sQ );
00587         if ( $oRs !== false && $oRs->recordCount() > 0 ) {
00588             while ( !$oRs->EOF ) {
00589                 $sUId = $myUtilsObject->generateUid();
00590                 $sId = $oRs->fields[0];
00591                 $oDb->execute( "insert into oxaccessoire2article (oxid, oxobjectid, oxarticlenid) VALUES (".$oDb->quote( $sUId ).", ".$oDb->quote( $sId ).", ".$oDb->quote( $sNewId ).") " );
00592                 $oRs->moveNext();
00593             }
00594         }
00595     }
00596 
00605     protected function _copyStaffelpreis( $sOldId, $sNewId )
00606     {
00607         $sShopId = $this->getConfig()->getShopId();
00608         $oPriceList = oxNew( "oxlist" );
00609         $oPriceList->init( "oxbase", "oxprice2article" );
00610         $sQ = "select * from oxprice2article where oxartid = '$sOldId' and oxshopid = '$sShopId' and (oxamount > 0 or oxamountto > 0) order by oxamount ";
00611         $oPriceList->selectString( $sQ );
00612         if ( $oPriceList->count() ) {
00613             foreach ( $oPriceList as $oItem ) {
00614                 $oItem->oxprice2article__oxid->setValue( $oItem->setId() );
00615                 $oItem->oxprice2article__oxartid->setValue( $sNewId );
00616                 $oItem->save();
00617             }
00618         }
00619     }
00620 
00629     protected function _copyArtExtends( $sOldId, $sNewId)
00630     {
00631         $oExt = oxNew( "oxbase");
00632         $oExt->init( "oxartextends" );
00633         $oExt->load( $sOldId );
00634         $oExt->setId( $sNewId );
00635         $oExt->save();
00636     }
00637 
00638 
00644     public function saveinnlang()
00645     {
00646         $this->save();
00647     }
00648 
00657     public function addDefaultValues( $aParams )
00658     {
00659         return $aParams;
00660     }
00661 
00670     protected function _formJumpList( $oArticle, $oParentArticle )
00671     {
00672         $aJumpList = array();
00673         //fetching parent article variants
00674         if ( isset( $oParentArticle ) ) {
00675             $aJumpList[] = array( $oParentArticle->oxarticles__oxid->value, $this->_getTitle( $oParentArticle ) );
00676             $oParentVariants = $oParentArticle->getAdminVariants( oxConfig::getParameter( "editlanguage" ) );
00677             if ( $oParentVariants->count()) {
00678                 foreach ( $oParentVariants as $oVar) {
00679                     $aJumpList[] = array( $oVar->oxarticles__oxid->value, " - ".$this->_getTitle( $oVar ) );
00680                     if ( $oVar->oxarticles__oxid->value == $oArticle->oxarticles__oxid->value ) {
00681                         $oVariants = $oArticle->getAdminVariants(oxConfig::getParameter( "editlanguage"));
00682                         if ( $oVariants->count() ) {
00683                             foreach ( $oVariants as $oVVar) {
00684                                 $aJumpList[] = array( $oVVar->oxarticles__oxid->value, " -- ".$this->_getTitle( $oVVar));
00685                             }
00686                         }
00687                     }
00688                 }
00689             }
00690         } else {
00691             $aJumpList[] = array( $oArticle->oxarticles__oxid->value, $this->_getTitle( $oArticle));
00692             //fetching this article variants data
00693             $oVariants = $oArticle->getAdminVariants(oxConfig::getParameter( "editlanguage"));
00694             if ( $oVariants && $oVariants->count())
00695                 foreach ($oVariants as $oVar) {
00696                     $aJumpList[] = array( $oVar->oxarticles__oxid->value, " - ".$this->_getTitle( $oVar));
00697                 }
00698         }
00699         if ( count($aJumpList) > 1)
00700             $this->_aViewData["thisvariantlist"] = $aJumpList;
00701     }
00702 
00710     protected function _getTitle( $oObj )
00711     {
00712         $sTitle = $oObj->oxarticles__oxtitle->value;
00713         if ( !strlen( $sTitle ) ) {
00714             $sTitle = $oObj->oxarticles__oxvarselect->value;
00715         }
00716 
00717         return $sTitle;
00718     }
00719 
00725     public function getCategoryList()
00726     {
00727         $oCatTree = oxNew( "oxCategoryList");
00728         $oCatTree->loadList();
00729         return $oCatTree;
00730     }
00731 
00737     public function getVendorList()
00738     {
00739         $oVendorlist = oxNew( "oxvendorlist" );
00740         $oVendorlist->loadVendorList();
00741 
00742         return $oVendorlist;
00743     }
00744 
00750     public function getManufacturerList()
00751     {
00752         $oManufacturerList = oxNew( "oxmanufacturerlist" );
00753         $oManufacturerList->loadManufacturerList();
00754 
00755         return $oManufacturerList;
00756     }
00757 }