article_overview.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Article_Overview extends oxAdminDetails
00011 {
00018     public function render()
00019     {
00020         $myConfig = $this->getConfig();
00021 
00022         parent::render();
00023 
00024         $this->_aViewData['edit'] = $oArticle = oxNew( 'oxarticle' );
00025 
00026         $soxId = oxConfig::getParameter( 'oxid' );
00027         if ( $soxId != "-1" && isset( $soxId ) ) {
00028 
00029             // load object
00030             $oArticle->loadInLang( oxConfig::getParameter( "editlanguage" ), $soxId );
00031 
00032 
00033             $oDB = oxDb::getDb();
00034                 // variant handling
00035                 if ( $oArticle->oxarticles__oxparentid->value) {
00036                     $oParentArticle = oxNew( "oxarticle");
00037                     $oParentArticle->load( $oArticle->oxarticles__oxparentid->value);
00038                     $this->_aViewData["parentarticle"] =  $oParentArticle;
00039                     $this->_aViewData["oxparentid"] =  $oArticle->oxarticles__oxparentid->value;
00040                 }
00041 
00042                 // ordered amount
00043                 $sSelect =  "select sum(oxamount) from oxorderarticles ";
00044                 $sSelect .= "where oxartid='$soxId'";
00045                 $this->_aViewData["totalordercnt"] = $iTotalOrderCnt = (float) $oDB->getOne( $sSelect);
00046 
00047                 // sold amount
00048                 $sSelect  = "select sum(oxorderarticles.oxamount) from  oxorderarticles, oxorder ";
00049                 $sSelect .= "where (oxorder.oxpaid>0 or oxorder.oxsenddate > 0) and oxorderarticles.oxstorno != '1' and oxorderarticles.oxartid='$soxId' ";
00050                 $sSelect .= "and oxorder.oxid =oxorderarticles.oxorderid";
00051                 $this->_aViewData["soldcnt"] = $iSoldCnt = (float) $oDB->getOne( $sSelect);;
00052 
00053                 // canceled amount
00054                 $sSelect =  "select sum(oxamount) from oxorderarticles where oxstorno = '1' and oxartid='$soxId' ";
00055                 $this->_aViewData["canceledcnt"] = $iCanceledCnt = (float) $oDB->getOne( $sSelect);
00056 
00057                 // not yet processed
00058                 $this->_aViewData["leftordercnt"] = $iTotalOrderCnt - $iSoldCnt - $iCanceledCnt;
00059 
00060                 // position in top ten
00061                 $sSelect =  "select oxartid,sum(oxamount) as cnt from oxorderarticles group by oxartid order by cnt desc";
00062             $rs = $oDB->execute( $sSelect);
00063             $iTopPos = 0;
00064             $iPos    = 0;
00065             if ( $rs != false && $rs->recordCount() > 0) {
00066                 while (!$rs->EOF) {
00067                     $iPos++;
00068                     if( $rs->fields[0] == $soxId)
00069                         $iTopPos = $iPos;
00070                     $rs->moveNext();
00071                 }
00072             }
00073 
00074             $this->_aViewData["postopten"]   = $iTopPos;
00075             $this->_aViewData["toptentotal"] = $iPos;
00076         }
00077 
00078         $this->_aViewData["afolder"]   = $myConfig->getConfigParam( 'aProductfolder' );
00079         $this->_aViewData["aSubclass"] = $myConfig->getConfigParam( 'aArticleClasses' );
00080 
00081         return "article_overview.tpl";
00082     }
00083 
00084 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5