00001 <?php
00002
00006 class List_Order extends Order_List
00007 {
00013 protected function _getViewListSize()
00014 {
00015 return $this->_getUserDefListSize();
00016 }
00017
00024 public function render()
00025 {
00026 oxAdminList::render();
00027
00028 $this->_aViewData["viewListSize"] = $this->_getViewListSize();
00029 $this->_aViewData["whereparam"] = $this->_aViewData["whereparam"] . '&viewListSize='.$this->_getViewListSize();
00030 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00031
00032 return "list_order.tpl";
00033 }
00034
00043 public function _prepareWhereQuery( $aWhere, $sqlFull )
00044 {
00045 return oxAdminList::_prepareWhereQuery( $aWhere, $sqlFull );
00046 }
00047
00055 protected function _calcListItemsCount( $sSql )
00056 {
00057
00058 $sSql = preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00059
00060
00061 $sSql = preg_replace( '/order by .*$/', '', $sSql );
00062
00063
00064 $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00065
00066
00067 oxSession::setVar( 'iArtCnt', $this->_iListSize );
00068 }
00069
00073 protected function _buildSelectString( $oObject = null )
00074 {
00075 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 ';
00076 }
00077
00085 protected function _prepareOrderByQuery( $sSql = null )
00086 {
00087
00088 $sSumQ = preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00089 $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00090
00091 $sSql = " $sSql group by oxorderarticles.oxartnum";
00092 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00093 $sSortDesc = ($sSort == 'oxorder.oxorderdate') ? 'DESC' : '';
00094 $sSql .= " order by $sSort " . $sSortDesc;
00095 }
00096
00097 return $sSql;
00098 }
00099 }