OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
list_order.php
Go to the documentation of this file.
1 <?php
2 
6 class List_Order extends Order_List
7 {
13  protected $_blDesc = false;
14 
20  public function getListSorting()
21  {
22  $aSort = oxConfig::getParameter( 'sort' );
23  if ( $this->_aCurrSorting === null && isset( $aSort[0]['oxorderdate'] ) ) {
24  $this->_aCurrSorting[]["max(oxorder.oxorderdate)"] = "desc";
25  return $this->_aCurrSorting;
26  } else {
27  return parent::getListSorting();
28  }
29  }
30 
36  protected function _getViewListSize()
37  {
38  return $this->_getUserDefListSize();
39  }
40 
47  public function render()
48  {
50 
51  $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
52 
53  return "list_order.tpl";
54  }
55 
56 
65  public function _prepareWhereQuery( $aWhere, $sqlFull )
66  {
67  $sQ = oxAdminList::_prepareWhereQuery( $aWhere, $sqlFull );
68  $sQ .= " group by oxorderarticles.oxartnum";
69  return $sQ;
70  }
71 
79  protected function _calcListItemsCount( $sSql )
80  {
81  $oStr = getStr();
82 
83  // count SQL
84  $sSql = $oStr->preg_replace( '/select .* from/', 'select count(*) from ', $sSql );
85 
86  // removing order by
87  $sSql = $oStr->preg_replace( '/order by .*$/', '', $sSql );
88 
89  // con of list items which fits current search conditions
90  $this->_iListSize = oxDb::getDb()->getOne( "select count(*) from ( $sSql ) as test", false, false );
91 
92  // set it into session that other frames know about size of DB
93  oxSession::setVar( 'iArtCnt', $this->_iListSize );
94  }
95 
103  protected function _buildSelectString( $oObject = null )
104  {
105  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 ';
106  }
107 
115  protected function _prepareOrderByQuery( $sSql = null )
116  {
117  // calculating sum
118  $sSumQ = getStr()->preg_replace( array( "/select .*? from/", "/group by oxorderarticles.oxartnum/" ), array( "select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", "" ), $sSql );
119  $this->_aViewData["sumresult"] = oxDb::getDb()->getOne( $sSumQ, false, false );
120  return parent::_prepareOrderByQuery( $sSql );
121  }
122 }