account_noticelist.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Account_Noticelist extends Account
00011 {
00016     protected $_sThisTemplate = 'account_noticelist.tpl';
00017 
00023     protected $_aNoticeProductList = null;
00024 
00030     protected $_aSimilarProductList = null;
00031 
00037     protected $_aRecommList = null;
00038 
00045     protected $_iViewIndexState = 1;
00046 
00060     public function render()
00061     {
00062         parent::render();
00063 
00064         // is logged in ?
00065         $oUser = $this->getUser();
00066         if ( !$oUser ) {
00067             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00068         }
00069 
00070         //to maintain compatibility we still set the old template variable using new getter in render
00071         $this->_aViewData['noticelist']  = $this->getNoticeProductList();
00072         $this->_aViewData['similarlist'] = $this->getSimilarProducts();
00073         $this->_aViewData['similarrecommlist'] = $this->getSimilarRecommLists();
00074 
00075         return $this->_sThisTemplate;
00076     }
00077 
00083     public function getNoticeProductList()
00084     {
00085         if ( $this->_aNoticeProductList === null ) {
00086             if ( $oUser = $this->getUser() ) {
00087                 $this->_aNoticeProductList = $oUser->getBasket( 'noticelist' )->getArticles();
00088             }
00089         }
00090         return $this->_aNoticeProductList;
00091     }
00092 
00098     public function getSimilarProducts()
00099     {
00100         // similar products list
00101         if ( $this->_aSimilarProductList === null && count( $this->getNoticeProductList() ) ) {
00102 
00103             // just ensuring that next call will skip this check
00104             $this->_aSimilarProductList = false;
00105 
00106             // loading similar products
00107             if ( $oSimilarProd = current( $this->getNoticeProductList() ) ) {
00108                 $this->_aSimilarProductList = $oSimilarProd->getSimilarProducts();
00109             }
00110         }
00111 
00112         return $this->_aSimilarProductList;
00113     }
00114 
00120     public function getSimilarRecommLists()
00121     {
00122         // recommlist
00123         if ( $this->_aRecommList === null ) {
00124 
00125             // just ensuring that next call will skip this check
00126             $this->_aRecommList = false;
00127 
00128             // loading recomm list
00129             $aNoticeProdList = $this->getNoticeProductList();
00130             if ( is_array( $aNoticeProdList ) && count( $aNoticeProdList ) ) {
00131                 $oRecommList = oxNew('oxrecommlist');
00132                 $this->_aRecommList = $oRecommList->getRecommListsByIds( array_keys( $aNoticeProdList ));
00133 
00134             }
00135         }
00136         return $this->_aRecommList;
00137     }
00138 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5