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