OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
account_order.php
Go to the documentation of this file.
1 <?php
2 
11 class Account_Order extends Account
12 {
13 
19  protected $_iAllArtCnt = 0;
20 
26  protected $_iCntPages = null;
27 
33  protected $_sThisTemplate = 'page/account/order.tpl';
34 
40  protected $_aOrderList = null;
41 
47  protected $_aArticlesList = null;
48 
56  public function render()
57  {
59 
60  // is logged in ?
61  $oUser = $this->getUser();
62  if (!$oUser) {
63  return $this->_sThisTemplate = $this->_sThisLoginTemplate;
64  }
65 
66  return $this->_sThisTemplate;
67  }
68 
74  public function getOrderList()
75  {
76  if ($this->_aOrderList === null) {
77  $this->_aOrderList = array();
78 
79  // Load user Orderlist
80  if ($oUser = $this->getUser()) {
81  $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
82  $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
83  $this->_iAllArtCnt = $oUser->getOrderCount();
84  if ($this->_iAllArtCnt && $this->_iAllArtCnt > 0) {
85  $this->_aOrderList = $oUser->getOrders($iNrofCatArticles, $this->getActPage());
86  $this->_iCntPages = round($this->_iAllArtCnt / $iNrofCatArticles + 0.49);
87  }
88  }
89  }
90 
91  return $this->_aOrderList;
92  }
93 
99  public function getOrderArticleList()
100  {
101  if ($this->_aArticlesList === null) {
102 
103  // marking as set
104  $this->_aArticlesList = false;
105  $oOrdersList = $this->getOrderList();
106  if ($oOrdersList && $oOrdersList->count()) {
107  $this->_aArticlesList = oxNew('oxarticlelist');
108  $this->_aArticlesList->loadOrderArticles($oOrdersList);
109  }
110  }
111 
112  return $this->_aArticlesList;
113  }
114 
120  public function getPageNavigation()
121  {
122  if ($this->_oPageNavigation === null) {
123  $this->_oPageNavigation = $this->generatePageNavigation();
124  }
125 
126  return $this->_oPageNavigation;
127  }
128 
134  public function getBreadCrumb()
135  {
136  $aPaths = array();
137  $aPath = array();
138  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
139  $sSelfLink = $this->getViewConfig()->getSelfLink();
140 
141  $aPath['title'] = oxRegistry::getLang()->translateString('MY_ACCOUNT', $iBaseLanguage, false);
142  $aPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sSelfLink . 'cl=account');
143  $aPaths[] = $aPath;
144 
145  $aPath['title'] = oxRegistry::getLang()->translateString('ORDER_HISTORY', $iBaseLanguage, false);
146  $aPath['link'] = $this->getLink();
147  $aPaths[] = $aPath;
148 
149  return $aPaths;
150  }
151 }