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
00040 public function buildWhere()
00041 {
00042 return oxAdminList::buildWhere();
00043 }
00044
00052 protected function _calcListItemsCount( $sSql )
00053 {
00054
00055 $sSql = preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00056
00057
00058 $sSql = preg_replace( '/order by .*$/', '', $sSql );
00059
00060
00061 $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00062
00063
00064 oxSession::setVar( 'iArtCnt', $this->_iListSize );
00065 }
00066
00070 protected function _buildSelectString( $oObject = null )
00071 {
00072 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 ';
00073 }
00074
00082 protected function _prepareOrderByQuery( $sSql = null )
00083 {
00084
00085 $sSumQ = preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00086 $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00087
00088 $sSql = " $sSql group by oxorderarticles.oxartnum";
00089 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00090 $sSortDesc = ($sSort == 'oxorder.oxorderdate') ? 'DESC' : '';
00091 $sSql .= " order by $sSort " . $sSortDesc;
00092 }
00093
00094 return $sSql;
00095 }
00096 }