Go to the documentation of this file.00001 <?php
00002
00006 class List_Order extends Order_List
00007 {
00013 protected $_blDesc = false;
00014
00020 public function getListSorting()
00021 {
00022 $aSort = oxConfig::getParameter( 'sort' );
00023 if ( $this->_aCurrSorting === null && isset( $aSort[0]['oxorderdate'] ) ) {
00024 $this->_aCurrSorting[]["max(oxorder.oxorderdate)"] = "desc";
00025 return $this->_aCurrSorting;
00026 } else {
00027 return parent::getListSorting();
00028 }
00029 }
00030
00036 protected function _getViewListSize()
00037 {
00038 return $this->_getUserDefListSize();
00039 }
00040
00047 public function render()
00048 {
00049 oxAdminList::render();
00050
00051 $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
00052
00053 return "list_order.tpl";
00054 }
00055
00056
00065 public function _prepareWhereQuery( $aWhere, $sqlFull )
00066 {
00067 $sQ = oxAdminList::_prepareWhereQuery( $aWhere, $sqlFull );
00068 $sQ .= " group by oxorderarticles.oxartnum";
00069 return $sQ;
00070 }
00071
00079 protected function _calcListItemsCount( $sSql )
00080 {
00081 $oStr = getStr();
00082
00083
00084 $sSql = $oStr->preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00085
00086
00087 $sSql = $oStr->preg_replace( '/order by .*$/', '', $sSql );
00088
00089
00090 $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00091
00092
00093 oxSession::setVar( 'iArtCnt', $this->_iListSize );
00094 }
00095
00103 protected function _buildSelectString( $oObject = null )
00104 {
00105 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 ';
00106 }
00107
00115 protected function _prepareOrderByQuery( $sSql = null )
00116 {
00117
00118 $sSumQ = getStr()->preg_replace( array( "/select .*? from/", "/group by oxorderarticles.oxartnum/" ), array( "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", "" ), $sSql );
00119 $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00120 return parent::_prepareOrderByQuery( $sSql );
00121 }
00122 }