dynexportbase.php

Go to the documentation of this file.
00001 <?php
00002 
00006 DEFINE("ERR_SUCCESS", -2);
00007 DEFINE("ERR_GENERAL", -1);
00008 DEFINE("ERR_FILEIO", 1);
00009 
00015 class DynExportBase extends oxAdminDetails
00016 {
00022     public $sClassDo            = "";
00023 
00029     public $sClassMain          = "";
00030 
00036     public $sExportPath          = "export/";
00037 
00043     public $sExportFileType      = "txt";
00044 
00050     public $sExportFileName      = "dynexport";
00051 
00057     public $fpFile               = null;
00058 
00064     public $iExportPerTick       = 30;
00065 
00071     protected $_sFilePath        = null;
00072 
00078     protected $_aExportResultset = array();
00079 
00085     protected $_sThisTemplate = "dynexportbase.tpl";
00086 
00092     protected $_aCatLvlCache = null;
00093 
00099     public function __construct()
00100     {
00101         parent::__construct();
00102 
00103         // set generic frame template
00104         $this->_sFilePath = $this->getConfig()->getConfigParam( 'sShopDir' ) . "/". $this->sExportPath . $this->sExportFileName . "." . $this->sExportFileType;
00105     }
00106 
00113     public function render()
00114     {
00115         parent::render();
00116 
00117         // assign all member variables to template
00118         $aClassVars = get_object_vars( $this );
00119         while ( list( $name, $value ) = each( $aClassVars ) ) {
00120             $this->_aViewData[$name] = $value;
00121         }
00122 
00123         $this->_aViewData['sOutputFile']     = $this->_sFilePath;
00124         $this->_aViewData['sDownloadFile']   = $this->getConfig()->getConfigParam( 'sShopURL' ) . $this->sExportPath . $this->sExportFileName . "." . $this->sExportFileType;
00125 
00126         return $this->_sThisTemplate;
00127     }
00128 
00134     public function createMainExportView()
00135     {
00136         // parent categorie tree
00137         $this->_aViewData["cattree"] = oxNew( "oxCategoryList" );
00138         $this->_aViewData["cattree"]->buildList( $this->getConfig()->getConfigParam( 'bl_perfLoadCatTree' ) );
00139 
00140         $oLangObj = oxNew( 'oxLang' );
00141         $aLangs = $oLangObj->getLanguageArray();
00142         foreach ( $aLangs as $id => $language) {
00143             $language->selected = ($id == $this->_iEditLang);
00144             $this->_aViewData["aLangs"][$id] = clone $language;
00145         }
00146     }
00147 
00153     public function start()
00154     {
00155         // delete file, if its already there
00156         $this->fpFile = @fopen( $this->_sFilePath, "w" );
00157         if ( !isset( $this->fpFile ) || !$this->fpFile ) {
00158             // we do have an error !
00159             $this->stop( ERR_FILEIO );
00160         } else {
00161             $this->_aViewData['refresh'] = 0;
00162             $this->_aViewData['iStart']  = 0;
00163             fclose( $this->fpFile );
00164 
00165             // prepare it
00166             $iEnd = $this->prepareExport();
00167             oxSession::setVar( "iEnd", $iEnd );
00168             $this->_aViewData['iEnd'] = $iEnd;
00169         }
00170     }
00171 
00179     public function stop( $iError = 0 )
00180     {
00181         if ( $iError ) {
00182             $this->_aViewData['iError'] = $iError;
00183         }
00184 
00185         // delete temporary heap table
00186         oxDb::getDb()->execute( "drop TABLE if exists ". $this->_getHeapTableName() );
00187     }
00188 
00196     public function nextTick( $iCnt)
00197     {
00198         return false;
00199     }
00200 
00208     public function write( $sLine )
00209     {
00210         $sLine = $this->removeSID( $sLine );
00211         $sLine = str_replace( array("\r\n","\n"), "", $sLine);
00212         fwrite( $this->fpFile, $sLine."\r\n");
00213     }
00214 
00220     public function run()
00221     {
00222         $blContinue = true;
00223         $iExportedItems = 0;
00224 
00225 
00226 
00227         $this->fpFile = @fopen( $this->_sFilePath, "a");
00228         if ( !isset( $this->fpFile) || !$this->fpFile) {
00229             // we do have an error !
00230             $this->stop( ERR_FILEIO);
00231         } else {
00232             // file is open
00233             $iStart = oxConfig::getParameter("iStart");
00234             // load from session
00235             $this->_aExportResultset = oxConfig::getParameter( "aExportResultset");
00236 
00237             for ( $i = $iStart; $i < $iStart + $this->iExportPerTick; $i++) {
00238                 if ( ( $iExportedItems = $this->nextTick( $i ) ) === false ) {
00239                     // end reached
00240                     $this->stop( ERR_SUCCESS);
00241                     $blContinue = false;
00242                     break;
00243                 }
00244             }
00245             if ( $blContinue) {
00246                 // make ticker continue
00247                 $this->_aViewData['refresh'] = 0;
00248                 $this->_aViewData['iStart']  = $i;
00249                 $this->_aViewData['iExpItems'] = $iExportedItems;
00250             }
00251             fclose( $this->fpFile);
00252         }
00253     }
00254 
00262     public function removeSid( $sInput )
00263     {
00264         $sSid = $this->getSession()->getId();
00265 
00266         // remove sid from link
00267         $sOutput = str_replace( "sid={$sSid}/", "", $sInput);
00268         $sOutput = str_replace( "sid/{$sSid}/", "", $sOutput);
00269         $sOutput = str_replace( "sid={$sSid}&amp;", "", $sOutput);
00270         $sOutput = str_replace( "sid={$sSid}&", "", $sOutput);
00271         $sOutput = str_replace( "sid={$sSid}", "", $sOutput);
00272 
00273         return $sOutput;
00274     }
00275 
00285     public function shrink( $sInput, $iMaxSize, $blRemoveNewline = true )
00286     {
00287         if ( $blRemoveNewline ) {
00288             $sInput = str_replace( "\r\n", " ", $sInput );
00289             $sInput = str_replace( "\n", " ", $sInput );
00290         }
00291 
00292         $sInput = str_replace( "\t", "    ", $sInput );
00293 
00294         // remove html entities, remove html tags
00295         $sInput = $this->_unHTMLEntities( strip_tags( $sInput ) );
00296 
00297         $oStr = getStr();
00298         if ( $oStr->strlen( $sInput ) > $iMaxSize - 3 ) {
00299             $sInput = $oStr->substr( $sInput, 0, $iMaxSize - 5 ) . "...";
00300         }
00301 
00302         return $sInput;
00303     }
00304 
00313     public function getCategoryString( $oArticle, $sSeparator = "/" )
00314     {
00315         $sCatStr = '';
00316 
00317         $sLang = oxLang::getInstance()->getBaseLanguage();
00318         $oDB = oxDb::getDb();
00319 
00320         $sCatView = getViewName( 'oxcategories', $sLang );
00321         $sO2CView = getViewName( 'oxobject2category', $sLang );
00322 
00323         //selecting category
00324         $sQ  = "select $sCatView.oxleft, $sCatView.oxright, $sCatView.oxrootid from $sO2CView as oxobject2category left join $sCatView on $sCatView.oxid = oxobject2category.oxcatnid ";
00325         $sQ .= "where oxobject2category.oxobjectid=".$oDB->quote( $oArticle->getId() )." and $sCatView.oxactive = 1 order by oxobject2category.oxtime ";
00326 
00327         $oRs = $oDB->execute( $sQ );
00328         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00329             $sLeft   = $oRs->fields[0];
00330             $sRight  = $oRs->fields[1];
00331             $sRootId = $oRs->fields[2];
00332 
00333             //selecting all parent category titles
00334             $sQ = "select oxtitle from $sCatView where oxright >= {$sRight} and oxleft <= {$sLeft} and oxrootid = '{$sRootId}' order by oxleft ";
00335 
00336             $oRs = $oDB->execute( $sQ );
00337             if ( $oRs != false && $oRs->recordCount() > 0 ) {
00338                 while ( !$oRs->EOF ) {
00339                     if ( $sCatStr ) {
00340                         $sCatStr .= $sSeparator;
00341                     }
00342                     $sCatStr .= $oRs->fields[0];
00343                     $oRs->moveNext();
00344                 }
00345             }
00346         }
00347 
00348         return $sCatStr;
00349     }
00350 
00358     public function getDefaultCategoryString( $oArticle )
00359     {
00360         $sLang = oxLang::getInstance()->getBaseLanguage();
00361         $oDB = oxDb::getDb();
00362 
00363         $sCatView = getViewName( 'oxcategories', $sLang );
00364         $sO2CView = getViewName( 'oxobject2category', $sLang );
00365 
00366         //selecting category
00367         $sQ =  "select $sCatView.oxtitle from $sO2CView as oxobject2category left join $sCatView on $sCatView.oxid = oxobject2category.oxcatnid ";
00368         $sQ .= "where oxobject2category.oxobjectid=".$oDB->quote( $oArticle->getId() )." and $sCatView.oxactive = 1 order by oxobject2category.oxtime ";
00369 
00370         return $oDB->getOne( $sQ);
00371     }
00372 
00380     public function prepareCSV( $sInput )
00381     {
00382         $sInput = oxUtilsString::getInstance()->prepareCSVField( $sInput );
00383         return str_replace( array( "&nbsp;", "&euro;", "|" ), array( " ", "", "" ), $sInput );
00384     }
00385 
00393     public function prepareXML( $sInput )
00394     {
00395         $sOutput = str_replace( "&", "&amp;", $sInput );
00396         $sOutput = str_replace( "\"", "&quot;", $sOutput );
00397         $sOutput = str_replace( ">", "&gt;", $sOutput );
00398         $sOutput = str_replace( "<", "&lt;", $sOutput );
00399         $sOutput = str_replace( "'", "&apos;", $sOutput );
00400 
00401         return $sOutput;
00402     }
00403 
00411     public function getDeepestCategoryPath( $oArticle )
00412     {
00413         return $this->_findDeepestCatPath( $oArticle );
00414     }
00415 
00421     public function prepareExport()
00422     {
00423         $oDB = oxDb::getDb();
00424         $sHeapTable = $this->_getHeapTableName();
00425 
00426         // #1070 Saulius 2005.11.28
00427         // check mySQL version
00428         $oRs = $oDB->execute( "SHOW VARIABLES LIKE 'version'" );
00429         $sTableCharset = $this->_generateTableCharSet( $oRs->fields[1] );
00430 
00431         // create heap table
00432         if ( !( $this->_createHeapTable( $sHeapTable, $sTableCharset ) ) ) {
00433             // error
00434             oxUtils::getInstance()->showMessageAndExit( "Could not create HEAP Table {$sHeapTable}\n<br>" );
00435         }
00436 
00437         $sCatAdd = $this->_getCatAdd( oxConfig::getParameter( "acat" ) );
00438         if ( !$this->_insertArticles( $sHeapTable, $sCatAdd ) ) {
00439             oxUtils::getInstance()->showMessageAndExit( "Could not insert Articles in Table {$sHeapTable}\n<br>" );
00440         }
00441 
00442         $this->_removeParentArticles( $sHeapTable );
00443         $this->_setSessionParams();
00444 
00445         // get total cnt
00446         return $oDB->getOne( "select count(*) from {$sHeapTable}" );
00447     }
00448 
00457     public function getOneArticle( $iCnt, & $blContinue )
00458     {
00459         $myConfig  = $this->getConfig();
00460 
00461         //[Alfonsas 2006-05-31] setting specific parameter
00462         //to be checked in oxarticle.php init() method
00463         $myConfig->setConfigParam( 'blExport', true );
00464         $blContinue = false;
00465 
00466         if ( ( $oArticle = $this->_initArticle( $this->_getHeapTableName(), $iCnt, $blContinue ) ) ) {
00467             $blContinue = true;
00468             $oArticle = $this->_setCampaignDetailLink( $oArticle );
00469         }
00470 
00471         //[Alfonsas 2006-05-31] unsetting specific parameter
00472         //to be checked in oxarticle.php init() method
00473         $myConfig->setConfigParam( 'blExport', false );
00474 
00475         return $oArticle;
00476     }
00477 
00486     public function assureContent( $sInput, $sReplace = null)
00487     {
00488         $oStr = getStr();
00489         if ( !$oStr->strlen( $sInput ) ) {
00490             if ( !isset( $sReplace ) || !$oStr->strlen( $sReplace ) ) {
00491                 $sReplace = "-";
00492             }
00493             $sInput = $sReplace;
00494         }
00495         return $sInput;
00496     }
00497 
00506     protected function _unHtmlEntities( $sInput )
00507     {
00508         $aTransTbl = array_flip( get_html_translation_table( HTML_ENTITIES ) );
00509         return strtr( $sInput, $aTransTbl );
00510     }
00511 
00517     protected function _getHeapTableName()
00518     {
00519         // table name must not start with any digit
00520         return "tmp_".str_replace( "0", "", md5( $this->getSession()->getId() ) );
00521     }
00522 
00530     protected function _generateTableCharSet( $sMysqlVersion )
00531     {
00532         $sTableCharset = "";
00533 
00534         //if MySQL >= 4.1.0 set charsets and collations
00535         if ( version_compare( $sMysqlVersion, '4.1.0', '>=' ) > 0 ) {
00536             $oDB = oxDb::getDb( true );
00537             $oRs = $oDB->execute( "SHOW FULL COLUMNS FROM `oxarticles` WHERE field like 'OXID'" );
00538             if ( isset( $oRs->fields['Collation'] ) && ( $sMysqlCollation = $oRs->fields['Collation'] ) ) {
00539                 $oRs = $oDB->execute( "SHOW COLLATION LIKE '{$sMysqlCollation}'" );
00540                 if ( isset( $oRs->fields['Charset'] ) && ( $sMysqlCharacterSet = $oRs->fields['Charset'] ) ) {
00541                     $sTableCharset = "DEFAULT CHARACTER SET {$sMysqlCharacterSet} COLLATE {$sMysqlCollation}";
00542                 }
00543             }
00544 
00545         }
00546         return $sTableCharset;
00547     }
00548 
00557     protected function _createHeapTable( $sHeapTable, $sTableCharset )
00558     {
00559         $blDone = false;
00560 
00561         $oDB = oxDb::getDb();
00562         $sQ = "CREATE TABLE if not exists {$sHeapTable} ( oxid char(32) NOT NULL default '' ) ENGINE=HEAP {$sTableCharset}";
00563         if ( ( $oDB->execute( $sQ ) ) !== false ) {
00564             $blDone = true;
00565             $oDB->execute( "truncate table {$sHeapTable}" );
00566         }
00567 
00568         return $blDone;
00569     }
00570 
00578     protected function _getCatAdd( $aChosenCat )
00579     {
00580         $sCatAdd = null;
00581         if ( is_array( $aChosenCat ) && count( $aChosenCat ) ) {
00582             $oDB = oxDb::getDb();
00583             $sCatAdd = " and ( ";
00584             $blSep = false;
00585             foreach ( $aChosenCat as $sCat ) {
00586                 if ( $blSep ) {
00587                     $sCatAdd .= " or ";
00588                 }
00589                 $sCatAdd .= "oxobject2category.oxcatnid = ".$oDB->quote( $sCat );
00590                 $blSep = true;
00591             }
00592             $sCatAdd .= ")";
00593         }
00594         return $sCatAdd;
00595     }
00596 
00605     protected function _insertArticles( $sHeapTable, $sCatAdd )
00606     {
00607         $oDB = oxDb::getDb();
00608 
00609         $iExpLang = oxConfig::getParameter( "iExportLanguage" );
00610         if (!isset($iExpLang)) {
00611             $iExpLang = oxSession::getVar( "iExportLanguage" );
00612         }
00613 
00614         $oArticle = oxNew( 'oxarticle' );
00615         $oArticle->setLanguage( $iExpLang );
00616 
00617         $sO2CView = getViewName( 'oxobject2category', $iExpLang );
00618         $sArticleTable = getViewName( "oxarticles", $iExpLang );
00619 
00620         $sSelect  = "insert into {$sHeapTable} select {$sArticleTable}.oxid from {$sArticleTable}, {$sO2CView} as oxobject2category where ";
00621         $sSelect .= $oArticle->getSqlActiveSnippet();
00622 
00623         if ( ! oxConfig::getParameter( "blExportVars" ) ) {
00624             $sSelect .= " and {$sArticleTable}.oxid = oxobject2category.oxobjectid and {$sArticleTable}.oxparentid = '' ";
00625         } else {
00626             $sSelect .= " and ( {$sArticleTable}.oxid = oxobject2category.oxobjectid or {$sArticleTable}.oxparentid = oxobject2category.oxobjectid ) ";
00627         }
00628 
00629         $sSearchString = oxConfig::getParameter( "search" );
00630         if ( isset( $sSearchString ) ) {
00631             $sSelect .= "and ( {$sArticleTable}.OXTITLE like ".$oDB->quote( "%{$sSearchString}%" );
00632             $sSelect .= " or {$sArticleTable}.OXSHORTDESC like ".$oDB->quote( "%$sSearchString%" );
00633             $sSelect .= " or {$sArticleTable}.oxsearchkeys like ".$oDB->quote( "%$sSearchString%" ) ." ) ";
00634         }
00635 
00636         if ( $sCatAdd ) {
00637             $sSelect .= $sCatAdd;
00638         }
00639 
00640             if ( !$sCatAdd ) {
00641                 $sShopID = $this->getConfig()->getShopId();
00642                 $sSelect .= " and {$sArticleTable}.oxshopid = '$sShopID' ";
00643             }
00644 
00645         // add minimum stock value
00646         if ( $this->getConfig()->getConfigParam( 'blUseStock' ) && ( $dMinStock = oxConfig::getParameter( "sExportMinStock" ) ) ) {
00647             $dMinStock = str_replace( array( ";", " ", "/", "'"), "", $dMinStock );
00648             $sSelect .= " and {$sArticleTable}.oxstock >= ".$oDB->quote( $dMinStock );
00649         }
00650 
00651         $sSelect .= " group by {$sArticleTable}.oxid";
00652 
00653         return $oDB->execute( $sSelect ) ? true : false;
00654     }
00655 
00663     protected function _removeParentArticles( $sHeapTable )
00664     {
00665         if ( !( oxConfig::getParameter( "blExportMainVars" ) ) ) {
00666 
00667             $oDB = oxDb::getDb();
00668             $sArticleTable = getViewName('oxarticles');
00669 
00670             // we need to remove again parent articles so that we only have the variants itself
00671             $sQ = "select $sHeapTable.oxid from $sHeapTable, $sArticleTable where
00672                           $sHeapTable.oxid = $sArticleTable.oxparentid group by $sHeapTable.oxid";
00673 
00674             $oRs = $oDB->execute( $sQ );
00675             $sDel = "delete from $sHeapTable where oxid in ( ";
00676             $blSep = false;
00677             if ($oRs != false && $oRs->recordCount() > 0) {
00678                 while ( !$oRs->EOF ) {
00679                     if ( $blSep ) {
00680                         $sDel .= ",";
00681                     }
00682                     $sDel .= $oDB->quote( $oRs->fields[0] );
00683                     $blSep = true;
00684                     $oRs->moveNext();
00685                 }
00686             }
00687             $sDel .= " )";
00688             $oDB->execute( $sDel );
00689         }
00690     }
00691 
00698     protected function _setSessionParams()
00699     {
00700         // reset it from session
00701         oxSession::deleteVar( "sExportDelCost" );
00702         $dDelCost = oxConfig::getParameter( "sExportDelCost");
00703         if ( isset( $dDelCost ) ) {
00704             $dDelCost = str_replace( array( ";", " ", "/", "'"), "", $dDelCost );
00705             $dDelCost = str_replace( ",", ".", $dDelCost );
00706             oxSession::setVar( "sExportDelCost", $dDelCost );
00707         }
00708 
00709         oxSession::deleteVar( "sExportMinPrice" );
00710         $dMinPrice = oxConfig::getParameter( "sExportMinPrice" );
00711         if ( isset( $dMinPrice ) ) {
00712             $dMinPrice = str_replace( array( ";", " ", "/", "'"), "", $dMinPrice);
00713             $dMinPrice = str_replace( ",", ".", $dMinPrice);
00714             oxSession::setVar( "sExportMinPrice", $dMinPrice);
00715         }
00716 
00717         // #827
00718         oxSession::deleteVar( "sExportCampaign" );
00719         $sCampaign = oxConfig::getParameter( "sExportCampaign" );
00720         if ( isset( $sCampaign ) ) {
00721             $sCampaign = str_replace( array( ";", " ", "/", "'"), "", $sCampaign );
00722             oxSession::setVar( "sExportCampaign", $sCampaign );
00723         }
00724 
00725         // reset it from session
00726         oxSession::deleteVar("blAppendCatToCampaign" );
00727         // now retrieve it from get or post.
00728         $blAppendCatToCampaign = oxConfig::getParameter( "blAppendCatToCampaign" );
00729         if ( $blAppendCatToCampaign ) {
00730             oxSession::setVar( "blAppendCatToCampaign", $blAppendCatToCampaign );
00731         }
00732 
00733         // reset it from session
00734         oxSession::deleteVar("iExportLanguage" );
00735         oxSession::setVar( "iExportLanguage", oxConfig::getParameter( "iExportLanguage" ) );
00736     }
00737 
00743     protected function _loadRootCats()
00744     {
00745         if ( $this->_aCatLvlCache === null ) {
00746             $this->_aCatLvlCache = array();
00747 
00748             $sCatView = getViewName('oxcategories');
00749             $oDb = oxDb::getDb();
00750 
00751             // Load all root cat's == all trees
00752             $sSQL = "select oxid from $sCatView where oxparentid = 'oxrootid'";
00753             $oRs = $oDb->execute( $sSQL);
00754             if ( $oRs != false && $oRs->recordCount() > 0 ) {
00755                 while ( !$oRs->EOF ) {
00756                     // now load each tree
00757                     $sSQL = "SELECT s.oxid, s.oxtitle,
00758                              s.oxparentid, count( * ) AS LEVEL FROM $sCatView v,
00759                              $sCatView s WHERE s.oxrootid = '".$oRs->fields[0]."' and
00760                              v.oxrootid='".$oRs->fields[0]."' and s.oxleft BETWEEN
00761                              v.oxleft AND v.oxright AND s.oxhidden = '0' GROUP BY s.oxleft order by level";
00762 
00763                     $oRs2 = $oDb->Execute( $sSQL );
00764                     if ( $oRs2 != false && $oRs2->recordCount() > 0 ) {
00765                         while ( !$oRs2->EOF ) {
00766                             // store it
00767                             $oCat = new OxStdClass();
00768                             $oCat->_sOXID     = $oRs2->fields[0];
00769                             $oCat->oxtitle    = $oRs2->fields[1];
00770                             $oCat->oxparentid = $oRs2->fields[2];
00771                             $oCat->ilevel     = $oRs2->fields[3];
00772                             $this->_aCatLvlCache[$oCat->_sOXID] = $oCat;
00773 
00774                             $oRs2->moveNext();
00775                         }
00776                     }
00777                     $oRs->moveNext();
00778                 }
00779             }
00780         }
00781 
00782         return $this->_aCatLvlCache;
00783     }
00784 
00792     protected function _findDeepestCatPath( $oArticle )
00793     {
00794         $sRet = "";
00795 
00796         // find deepest
00797         $aIds = $oArticle->getCategoryIds();
00798         if ( is_array( $aIds ) && count( $aIds ) ) {
00799             if ( $aCatLvlCache = $this->_loadRootCats() ) {
00800                 $sIdMax  = null;
00801                 $dMaxLvl = 0;
00802                 foreach ( $aIds as $sCatId ) {
00803                     if ( $dMaxLvl < $aCatLvlCache[$sCatId]->ilevel ) {
00804                         $dMaxLvl = $aCatLvlCache[$sCatId]->ilevel;
00805                         $sIdMax  = $sCatId;
00806                         $sRet    = $aCatLvlCache[$sCatId]->oxtitle;
00807                     }
00808                 }
00809 
00810                 // endless
00811                 for ( ;; ) {
00812                     if ( !isset( $aCatLvlCache[$sIdMax]->oxparentid ) || $aCatLvlCache[$sIdMax]->oxparentid == "oxrootid" ) {
00813                         break;
00814                     }
00815                     $sIdMax = $aCatLvlCache[$sIdMax]->oxparentid;
00816                     $sRet = $aCatLvlCache[$sIdMax]->oxtitle."/".$sRet;
00817                 }
00818             }
00819         }
00820         return $sRet;
00821     }
00822 
00832     protected function _initArticle( $sHeapTable, $iCnt, & $blContinue )
00833     {
00834 
00835 
00836         $oRs = oxDb::getDb()->selectLimit( "select oxid from $sHeapTable", 1, $iCnt );
00837         if ( $oRs != false && $oRs->recordCount() > 0 ) {
00838             $oArticle = oxNew( 'oxarticle' );
00839             $oArticle->setLoadParentData( true );
00840 
00841             $oArticle->setLanguage( oxSession::getVar( "iExportLanguage" ) );
00842 
00843             if ( $oArticle->load( $oRs->fields[0] ) ) {
00844                 // if article exists, do not stop export
00845                 $blContinue = true;
00846                 // check price
00847                 $dMinPrice = oxConfig::getParameter( "sExportMinPrice" );
00848                 if ( !isset( $dMinPrice ) || ( isset( $dMinPrice ) && ( $oArticle->getPrice()->getBruttoPrice() >= $dMinPrice ) ) ) {
00849 
00850                     //Saulius: variant title added
00851                     $sTitle = $oArticle->oxarticles__oxvarselect->value ? " " .$oArticle->oxarticles__oxvarselect->value : "";
00852                     $oArticle->oxarticles__oxtitle->setValue( $oArticle->oxarticles__oxtitle->value . $sTitle );
00853 
00854 
00855                     return $oArticle;
00856                 }
00857             }
00858         }
00859     }
00860 
00868     protected function _setCampaignDetailLink( $oArticle )
00869     {
00870         // #827
00871         if ( $sCampaign = oxConfig::getParameter( "sExportCampaign" ) ) {
00872             // modify detaillink
00873             //#1166R - pangora - campaign
00874             $oArticle->appendLink( "campaign={$sCampaign}" );
00875 
00876             if ( oxConfig::getParameter( "blAppendCatToCampaign") &&
00877                  ( $sCat = $this->getCategoryString( $oArticle ) ) ) {
00878                 $oArticle->appendLink( "/$sCat" );
00879             }
00880         }
00881         return $oArticle;
00882     }
00883 
00889     public function getViewId()
00890     {
00891         return 'dyn_interface';
00892     }
00893 }
00894