account_order.php

Go to the documentation of this file.
00001 <?php
00002 
00011 class Account_Order extends Account
00012 {
00013 
00019     protected $_iAllArtCnt = 0;
00020 
00026     protected $_iCntPages = null;
00027 
00033     protected $_sThisTemplate = 'page/account/order.tpl';
00034 
00040     protected $_aOrderList = null;
00041 
00047     protected $_aArticlesList = null;
00048 
00056     public function render()
00057     {
00058         parent::render();
00059 
00060         // is logged in ?
00061         $oUser = $this->getUser();
00062         if (!$oUser) {
00063             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00064         }
00065 
00066         return $this->_sThisTemplate;
00067     }
00068 
00074     public function getOrderList()
00075     {
00076         if ($this->_aOrderList === null) {
00077             $this->_aOrderList = array();
00078 
00079             // Load user Orderlist
00080             if ($oUser = $this->getUser()) {
00081                 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
00082                 $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
00083                 $this->_iAllArtCnt = $oUser->getOrderCount();
00084                 if ($this->_iAllArtCnt && $this->_iAllArtCnt > 0) {
00085                     $this->_aOrderList = $oUser->getOrders($iNrofCatArticles, $this->getActPage());
00086                     $this->_iCntPages = round($this->_iAllArtCnt / $iNrofCatArticles + 0.49);
00087                 }
00088             }
00089         }
00090 
00091         return $this->_aOrderList;
00092     }
00093 
00099     public function getOrderArticleList()
00100     {
00101         if ($this->_aArticlesList === null) {
00102 
00103             // marking as set
00104             $this->_aArticlesList = false;
00105             $oOrdersList = $this->getOrderList();
00106             if ($oOrdersList && $oOrdersList->count()) {
00107                 $this->_aArticlesList = oxNew('oxarticlelist');
00108                 $this->_aArticlesList->loadOrderArticles($oOrdersList);
00109             }
00110         }
00111 
00112         return $this->_aArticlesList;
00113     }
00114 
00120     public function getPageNavigation()
00121     {
00122         if ($this->_oPageNavigation === null) {
00123             $this->_oPageNavigation = $this->generatePageNavigation();
00124         }
00125 
00126         return $this->_oPageNavigation;
00127     }
00128 
00134     public function getBreadCrumb()
00135     {
00136         $aPaths = array();
00137         $aPath = array();
00138         $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
00139         $sSelfLink = $this->getViewConfig()->getSelfLink();
00140 
00141         $aPath['title'] = oxRegistry::getLang()->translateString('MY_ACCOUNT', $iBaseLanguage, false);
00142         $aPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sSelfLink . 'cl=account');
00143         $aPaths[] = $aPath;
00144 
00145         $aPath['title'] = oxRegistry::getLang()->translateString('ORDER_HISTORY', $iBaseLanguage, false);
00146         $aPath['link'] = $this->getLink();
00147         $aPaths[] = $aPath;
00148 
00149         return $aPaths;
00150     }
00151 }