article_overview.php

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

Generated on Wed May 13 13:25:50 2009 for OXID eShop CE by  doxygen 1.5.5