list_order.php
Go to the documentation of this file.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 $oStr = getStr();
00059
00060
00061 $sSql = $oStr->preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
00062
00063
00064 $sSql = $oStr->preg_replace( '/order by .*$/', '', $sSql );
00065
00066
00067 $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test" );
00068
00069
00070 oxSession::setVar( 'iArtCnt', $this->_iListSize );
00071 }
00072
00080 protected function _buildSelectString( $oObject = null )
00081 {
00082 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 ';
00083 }
00084
00092 protected function _prepareOrderByQuery( $sSql = null )
00093 {
00094
00095 $sSumQ = getStr()->preg_replace("/select .*? from/", "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", $sSql );
00096 $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ );
00097
00098 $sSql = " $sSql group by oxorderarticles.oxartnum";
00099 if ( $sSort = oxConfig::getParameter( "sort" ) ) {
00100 if ($sSort == 'oxorder.oxorderdate') {
00101 $sSql .= " order by max(oxorder.oxorderdate) DESC";
00102 } else {
00103 $sSql .= " order by " . oxDb::getInstance()->escapeString( $sSort );
00104 }
00105 }
00106 return $sSql;
00107 }
00108 }