account_order.php

Go to the documentation of this file.
00001 <?php
00002 
00011 class Account_Order extends Account
00012 {
00017     protected $_iAllArtCnt = 0;
00018 
00023     protected $_iCntPages = null;
00024 
00029     protected $_sThisTemplate = 'page/account/order.tpl';
00030 
00036     protected $_aOrderList = null;
00037 
00043     protected $_aArticlesList  = null;
00044 
00052     public function render()
00053     {
00054         parent::render();
00055 
00056         // is logged in ?
00057         $oUser = $this->getUser();
00058         if ( !$oUser ) {
00059             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00060         }
00061 
00062         return $this->_sThisTemplate;
00063     }
00064 
00070     public function getOrderList()
00071     {
00072         if ( $this->_aOrderList === null ) {
00073             $this->_aOrderList = array();
00074 
00075             // Load user Orderlist
00076             if ( $oUser = $this->getUser() ) {
00077                 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00078                 $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00079                 $this->_iAllArtCnt = $oUser->getOrderCount();
00080                 if ( $this->_iAllArtCnt && $this->_iAllArtCnt > 0 ) {
00081                     $this->_aOrderList = $oUser->getOrders( $iNrofCatArticles, $this->getActPage() );
00082                     $this->_iCntPages  = round( $this->_iAllArtCnt/$iNrofCatArticles + 0.49 );
00083                 }
00084             }
00085         }
00086         return $this->_aOrderList;
00087     }
00088 
00094     public function getOrderArticleList()
00095     {
00096         if ( $this->_aArticlesList === null ) {
00097 
00098             // marking as set
00099             $this->_aArticlesList = false;
00100             $oOrdersList = $this->getOrderList();
00101             if ( $oOrdersList && $oOrdersList->count() ) {
00102                 $this->_aArticlesList = oxNew( 'oxarticlelist' );
00103                 $this->_aArticlesList->loadOrderArticles( $oOrdersList );
00104             }
00105         }
00106         return $this->_aArticlesList;
00107     }
00108 
00114     public function getPageNavigation()
00115     {
00116         if ( $this->_oPageNavigation === null ) {
00117             $this->_oPageNavigation = $this->generatePageNavigation();
00118         }
00119         return $this->_oPageNavigation;
00120     }
00121 
00127     public function getBreadCrumb()
00128     {
00129         $aPaths = array();
00130         $aPath = array();        
00131         $aPath['title'] = oxRegistry::getLang()->translateString( 'MY_ACCOUNT', oxRegistry::getLang()->getBaseLanguage(), false );
00132         $aPath['link']  = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=account' );
00133         $aPaths[] = $aPath;
00134 
00135         $aPath['title'] = oxRegistry::getLang()->translateString( 'ORDER_HISTORY', oxRegistry::getLang()->getBaseLanguage(), false );
00136         $aPath['link']  = $this->getLink();
00137         $aPaths[] = $aPath;
00138 
00139         return $aPaths;
00140     }
00141 }