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
00035
00044 public function _prepareWhereQuery( $aWhere, $sqlFull )
00045 {
00046 return oxAdminList::_prepareWhereQuery( $aWhere, $sqlFull );
00047 }
00048
00056 protected function _calcListItemsCount( $sSql )
00057 {
00058
00059 $sSql = preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00060
00061
00062 $sSql = preg_replace( '/order by .*$/', '', $sSql );
00063
00064
00065 $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00066
00067
00068 oxSession::setVar( 'iArtCnt', $this->_iListSize );
00069 }
00070
00074 protected function _buildSelectString( $oObject = null )
00075 {
00076 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 ';
00077 }
00078
00086 protected function _prepareOrderByQuery( $sSql = null )
00087 {
00088
00089 $sSumQ = preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00090 $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00091
00092 $sSql = " $sSql group by oxorderarticles.oxartnum";
00093 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00094 $sSortDesc = ($sSort == 'oxorder.oxorderdate') ? 'DESC' : '';
00095 $sSql .= " order by " . oxDb::getInstance()->escapeString( $sSort ) . " " . $sSortDesc;
00096 }
00097
00098 return $sSql;
00099 }
00100 }