OXID eShop CE  4.10.8
 All Classes Namespaces Files Functions Variables Pages
list_order.php
Go to the documentation of this file.
1 <?php
2 
8 class List_Order extends Order_List
9 {
10 
16  protected $_blDesc = false;
17 
23  public function getListSorting()
24  {
25  $aSort = oxRegistry::getConfig()->getRequestParameter('sort');
26  if ($this->_aCurrSorting === null && isset($aSort[0]['oxorderdate'])) {
27  $this->_aCurrSorting[]["max(oxorder.oxorderdate)"] = "desc";
28 
29  return $this->_aCurrSorting;
30  } else {
31  return parent::getListSorting();
32  }
33  }
34 
40  protected function _getViewListSize()
41  {
42  return $this->_getUserDefListSize();
43  }
44 
51  public function render()
52  {
54 
55  $this->_aViewData["menustructure"] = $this->getNavigation()->getDomXml()->documentElement->childNodes;
56 
57  return "list_order.tpl";
58  }
59 
60 
69  public function _prepareWhereQuery($aWhere, $sqlFull)
70  {
71  $sQ = oxAdminList::_prepareWhereQuery($aWhere, $sqlFull);
72  $sQ .= " group by oxorderarticles.oxartnum";
73 
74  return $sQ;
75  }
76 
82  protected function _calcListItemsCount($sSql)
83  {
84  $oStr = getStr();
85 
86  // count SQL
87  $sSql = $oStr->preg_replace('/select .* from/', 'select count(*) from ', $sSql);
88 
89  // removing order by
90  $sSql = $oStr->preg_replace('/order by .*$/', '', $sSql);
91 
92  // con of list items which fits current search conditions
93  $this->_iListSize = oxDb::getDb()->getOne("select count(*) from ( $sSql ) as test", false, false);
94 
95  // set it into session that other frames know about size of DB
96  oxRegistry::getSession()->setVariable('iArtCnt', $this->_iListSize);
97  }
98 
106  protected function _buildSelectString($oObject = null)
107  {
108  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 ';
109  }
110 
118  protected function _prepareOrderByQuery($sSql = null)
119  {
120  // calculating sum
121  $sSumQ = getStr()->preg_replace(array("/select .*? from/", "/group by oxorderarticles.oxartnum/"), array("select round( sum(oxorderarticles.oxbrutprice*oxorder.oxcurrate),2) from", ""), $sSql);
122  $this->_aViewData["sumresult"] = oxDb::getDb()->getOne($sSumQ, false, false);
123 
124  return parent::_prepareOrderByQuery($sSql);
125  }
126 }