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 
00044     protected $_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
00045 
00059     public function render()
00060     {
00061         parent::render();
00062 
00063         // is logged in ?
00064         $oUser = $this->getUser();
00065         if ( !$oUser ) {
00066             return $this->_sThisTemplate = $this->_sThisLoginTemplate;
00067         }
00068 
00069         //to maintain compatibility we still set the old template variable using new getter in render
00070         $this->_aViewData['noticelist']  = $this->getNoticeProductList();
00071         $this->_aViewData['similarlist'] = $this->getSimilarProducts();
00072         $this->_aViewData['similarrecommlist'] = $this->getSimilarRecommLists();
00073 
00074         return $this->_sThisTemplate;
00075     }
00076 
00082     public function getNoticeProductList()
00083     {
00084         if ( $this->_aNoticeProductList === null ) {
00085             if ( $oUser = $this->getUser() ) {
00086                 $this->_aNoticeProductList = $oUser->getBasket( 'noticelist' )->getArticles();
00087             }
00088         }
00089         return $this->_aNoticeProductList;
00090     }
00091 
00097     public function getSimilarProducts()
00098     {
00099         // similar products list
00100         if ( $this->_aSimilarProductList === null && count( $this->getNoticeProductList() ) ) {
00101 
00102             // just ensuring that next call will skip this check
00103             $this->_aSimilarProductList = false;
00104 
00105             // loading similar products
00106             if ( $oSimilarProd = current( $this->getNoticeProductList() ) ) {
00107                 $this->_aSimilarProductList = $oSimilarProd->getSimilarProducts();
00108             }
00109         }
00110 
00111         return $this->_aSimilarProductList;
00112     }
00113 
00119     public function getSimilarRecommLists()
00120     {
00121         // recommlist
00122         if ( $this->_aRecommList === null ) {
00123 
00124             // just ensuring that next call will skip this check
00125             $this->_aRecommList = false;
00126 
00127             // loading recomm list
00128             $aNoticeProdList = $this->getNoticeProductList();
00129             if ( is_array( $aNoticeProdList ) && count( $aNoticeProdList ) ) {
00130                 $oRecommList = oxNew('oxrecommlist');
00131                 $this->_aRecommList = $oRecommList->getRecommListsByIds( array_keys( $aNoticeProdList ));
00132 
00133             }
00134         }
00135         return $this->_aRecommList;
00136     }
00137 }

Generated on Wed Apr 22 12:26:31 2009 for OXID eShop CE by  doxygen 1.5.5