list_order.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class List_Order extends oxAdminList
00007 {
00014     public function render()
00015     {
00016         $this->_oList = oxNew( "oxlist", "core" );
00017         $this->_oList->setSqlLimit( 0, 5000 );
00018         $this->_oList->init( "oxbase", "oxorder" );
00019 
00020         $aWhere = $this->buildWhere();
00021 
00022         $sSql = $this->_buildSelectString( $this->_oList->getBaseObject() );
00023         $sSql = $this->_prepareWhereQuery( $aWhere, $sSql );
00024 
00025         // calculating sum
00026         $sSumQ = preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00027         $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00028 
00029         $sSql = $this->_prepareOrderByQuery( $sSql );
00030         $sSql = $this->_changeselect( $sSql );
00031         $this->_oList->selectString( $sSql );
00032 
00033         parent::render();
00034 
00035         $aWhere = oxConfig::getParameter( "where");
00036         if ( is_array( $aWhere ) ) {
00037             foreach ( $aWhere as $sField => $sValue ) {
00038                 $this->_aViewData["where"]->{str_replace( '.', '__', $sField )} = $sValue;
00039             }
00040         }
00041 
00042         $this->_aViewData["menustructure"] =  $this->getNavigation()->getDomXml()->documentElement->childNodes;
00043 
00044         return "list_order.tpl";
00045     }
00046 
00050     protected function _buildSelectString( $oObject = null )
00051     {
00052         return 'select oxorderarticles.oxid, oxorder.oxid as oxorderid, max(oxorder.oxorderdate) as oxorderdate, oxorderarticles.oxartnum, sum( oxorderarticles.oxamount ) as oxorderamount, oxorderarticles.oxtitle, round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) as oxprice from oxorderarticles left join oxorder on oxorder.oxid=oxorderarticles.oxorderid where 1 ';
00053     }
00054 
00062     protected function _prepareOrderByQuery( $sSql = null )
00063     {
00064         $sSql = " $sSql group by oxorderarticles.oxartnum";
00065         if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00066             $sSortDesc = ($sSort == 'oxorder.oxorderdate') ? 'DESC' : '';
00067             $sSql .= " order by $sSort " . $sSortDesc;
00068         }
00069 
00070         return $sSql;
00071     }
00072 }

Generated on Tue Apr 21 15:45:44 2009 for OXID eShop CE by  doxygen 1.5.5