Go to the documentation of this file.00001 <?php
00002
00009 class Article_Overview extends oxAdminDetails
00010 {
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 = $this->getEditObjectId();
00027 if ($soxId != "-1" && isset($soxId)) {
00028
00029
00030 $oArticle->loadInLang(oxRegistry::getConfig()->getRequestParameter("editlanguage"), $soxId);
00031
00032
00033 $oDB = oxDb::getDb();
00034
00035
00036 if ($oArticle->oxarticles__oxparentid->value) {
00037 $oParentArticle = oxNew("oxarticle");
00038 $oParentArticle->load($oArticle->oxarticles__oxparentid->value);
00039 $this->_aViewData["parentarticle"] = $oParentArticle;
00040 $this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value;
00041 }
00042
00043
00044 $sSelect = "select sum(oxamount) from oxorderarticles ";
00045 $sSelect .= "where oxartid=" . $oDB->quote($soxId);
00046 $this->_aViewData["totalordercnt"] = $iTotalOrderCnt = (float) $oDB->getOne($sSelect);
00047
00048
00049 $sSelect = "select sum(oxorderarticles.oxamount) from oxorderarticles, oxorder " .
00050 "where (oxorder.oxpaid>0 or oxorder.oxsenddate > 0) and oxorderarticles.oxstorno != '1' " .
00051 "and oxorderarticles.oxartid=" . $oDB->quote($soxId) .
00052 "and oxorder.oxid =oxorderarticles.oxorderid";
00053 $this->_aViewData["soldcnt"] = $iSoldCnt = (float) $oDB->getOne($sSelect);
00054
00055
00056 $sSelect = "select sum(oxamount) from oxorderarticles where oxstorno = '1' " .
00057 "and oxartid=" . $oDB->quote($soxId);
00058 $this->_aViewData["canceledcnt"] = $iCanceledCnt = (float) $oDB->getOne($sSelect);
00059
00060
00061 $this->_aViewData["leftordercnt"] = $iTotalOrderCnt - $iSoldCnt - $iCanceledCnt;
00062
00063
00064 $sSelect = "select oxartid,sum(oxamount) as cnt from oxorderarticles " .
00065 "group by oxartid order by cnt desc";
00066
00067 $rs = $oDB->execute($sSelect);
00068 $iTopPos = 0;
00069 $iPos = 0;
00070 if ($rs != false && $rs->recordCount() > 0) {
00071 while (!$rs->EOF) {
00072 $iPos++;
00073 if ($rs->fields[0] == $soxId) {
00074 $iTopPos = $iPos;
00075 }
00076 $rs->moveNext();
00077 }
00078 }
00079
00080 $this->_aViewData["postopten"] = $iTopPos;
00081 $this->_aViewData["toptentotal"] = $iPos;
00082 }
00083
00084 $this->_aViewData["afolder"] = $myConfig->getConfigParam('aProductfolder');
00085 $this->_aViewData["aSubclass"] = $myConfig->getConfigParam('aArticleClasses');
00086
00087 return "article_overview.tpl";
00088 }
00089
00090 }