OXID eShop CE  4.9.7
 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 {
8 
14  protected $_blDesc = false;
15 
21  public function getListSorting()
22  {
23  $aSort = oxRegistry::getConfig()->getRequestParameter('sort');
24  if ($this->_aCurrSorting === null && isset($aSort[0]['oxorderdate'])) {
25  $this->_aCurrSorting[]["max(oxorder.oxorderdate)"] = "desc";
26 
27  return $this->_aCurrSorting;
28  } else {
29  return parent::getListSorting();
30  }
31  }
32 
38  protected function _getViewListSize()
39  {
40  return $this->_getUserDefListSize();
41  }
42 
49  public function render()
50  {
52 
53  $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
54 
55  return "list_order.tpl";
56  }
57 
58 
67  public function _prepareWhereQuery($aWhere, $sqlFull)
68  {
69  $sQ = oxAdminList::_prepareWhereQuery($aWhere, $sqlFull);
70  $sQ .= " group by oxorderarticles.oxartnum";
71 
72  return $sQ;
73  }
74 
80  protected function _calcListItemsCount($sSql)
81  {
82  $oStr = getStr();
83 
84  // count SQL
85  $sSql = $oStr->preg_replace('/select .* from/', 'select count(*) from ', $sSql);
86 
87  // removing order by
88  $sSql = $oStr->preg_replace('/order by .*$/', '', $sSql);
89 
90  // con of list items which fits current search conditions
91  $this->_iListSize = oxDb::getDb()->getOne("select count(*) from ( $sSql ) as test", false, false);
92 
93  // set it into session that other frames know about size of DB
94  oxRegistry::getSession()->setVariable('iArtCnt', $this->_iListSize);
95  }
96 
104  protected function _buildSelectString($oObject = null)
105  {
106  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 ';
107  }
108 
116  protected function _prepareOrderByQuery($sSql = null)
117  {
118  // calculating sum
119  $sSumQ = getStr()->preg_replace(array("/select .*? from/", "/group by oxorderarticles.oxartnum/"), array("select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", ""), $sSql);
120  $this->_aViewData["sumresult"] = oxDb::getDb()->getOne($sSumQ, false, false);
121 
122  return parent::_prepareOrderByQuery($sSql);
123  }
124 }