OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
start.php
Go to the documentation of this file.
1 <?php
2 
7 class Start extends oxUBase
8 {
14  protected $_sListDisplayType = null;
15 
20  protected $_sThisTemplate = 'page/shop/start.tpl';
21 
27  protected $_sMetaDescriptionIdent = 'oxstartmetadescription';
28 
34  protected $_sMetaKeywordsIdent = 'oxstartmetakeywords';
35 
41  protected $_blLoadActions = null;
42 
48  protected $_aTopArticleList = null;
49 
55  protected $_aNewArticleList = null;
56 
62  protected $_oFirstArticle = null;
63 
69  protected $_oCatOfferArticle = null;
70 
76  protected $_oCatOfferArtList = null;
77 
83  protected $_sTagCloud = null;
84 
89  protected $_blTop5Action = true;
90 
95  protected $_blBargainAction = true;
96 
97 
105  public function render()
106  {
107 
108  if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
109  return 'message/exception.tpl';
110  }
111 
112  $myConfig = $this->getConfig();
113 
114  $oRss = oxNew('oxrssfeed');
115  if ($myConfig->getConfigParam( 'iTop5Mode' ) && $myConfig->getConfigParam( 'bl_rssTopShop' ) ) {
116  $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
117  }
118  if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && $myConfig->getConfigParam( 'bl_rssNewest' ) ) {
119  $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
120  }
121  if ( $myConfig->getConfigParam( 'bl_rssBargain' ) ) {
122  $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
123  }
124 
125  parent::render();
126 
127  return $this->_sThisTemplate;
128  }
129 
141  protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
142  {
143  if ( !$sMeta &&
144  $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
145  $oArt = $this->getFirstArticle() ) {
146  $oDescField = $oArt->getLongDescription();
147  $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
148  }
149  return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
150  }
151 
162  protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
163  {
164  if ( !$sKeywords &&
165  $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
166  $oArt = $this->getFirstArticle() ) {
167  $oDescField = $oArt->getLongDescription();
168  $sKeywords = $oDescField->value;
169  }
170 
171  return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
172  }
173 
179  protected function _getLoadActionsParam()
180  {
181  if ( $this->_blLoadActions === null ) {
182  $this->_blLoadActions = false;
183  if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
184  $this->_blLoadActions = true;
185  }
186  }
187  return $this->_blLoadActions;
188  }
189 
195  public function getArticleList()
196  {
197  if ( $this->_aArticleList === null ) {
198  $this->_aArticleList = array();
199  if ( $this->_getLoadActionsParam() ) {
200  // start list
201  $oArtList = oxNew( 'oxarticlelist' );
202  $oArtList->loadActionArticles( 'OXSTART' );
203  if ( $oArtList->count() ) {
204  $this->_aArticleList = $oArtList;
205  }
206  }
207  }
208  return $this->_aArticleList;
209  }
210 
216  public function getTopArticleList()
217  {
218  if ( $this->_aTopArticleList === null ) {
219  $this->_aTopArticleList = false;
220  if ( $this->_getLoadActionsParam() ) {
221  // start list
222  $oArtList = oxNew( 'oxarticlelist' );
223  $oArtList->loadActionArticles( 'OXTOPSTART' );
224  if ( $oArtList->count() ) {
225  $this->_aTopArticleList = $oArtList;
226  }
227  }
228  }
230  }
231 
232 
233 
234 
240  public function getNewestArticles()
241  {
242  if ( $this->_aNewArticleList === null ) {
243  $this->_aNewArticleList = array();
244  if ( $this->_getLoadActionsParam() ) {
245  // newest articles
246  $oArtList = oxNew( 'oxarticlelist' );
247  $oArtList->loadNewestArticles();
248  if ( $oArtList->count() ) {
249  $this->_aNewArticleList = $oArtList;
250  }
251  }
252  }
254  }
255 
261  public function getFirstArticle()
262  {
263  if ( $this->_oFirstArticle === null ) {
264  $this->_oFirstArticle = false;
265  if ( $this->_getLoadActionsParam() ) {
266  // top articles ( big one )
267  $oArtList = oxNew( 'oxarticlelist' );
268  $oArtList->loadActionArticles( 'OXFIRSTSTART' );
269  if ( $oArtList->count() ) {
270  $this->_oFirstArticle = $oArtList->current();
271  }
272  }
273  }
274  return $this->_oFirstArticle;
275  }
276 
282  public function getCatOfferArticle()
283  {
284  if ( $this->_oCatOfferArticle === null ) {
285  $this->_oCatOfferArticle = false;
286  if ( $oArtList = $this->getCatOfferArticleList() ) {
287  $this->_oCatOfferArticle = $oArtList->current();
288  }
289  }
291  }
292 
298  public function getCatOfferArticleList()
299  {
300  if ( $this->_oCatOfferArtList === null ) {
301  $this->_oCatOfferArtList = array();
302  if ( $this->_getLoadActionsParam() ) {
303  // "category offer" articles
304  $oArtList = oxNew( 'oxarticlelist' );
305  $oArtList->loadActionArticles( 'OXCATOFFER' );
306  if ( $oArtList->count() ) {
307  $this->_oCatOfferArtList = $oArtList;
308  }
309  }
310  }
312  }
313 
319  public function getTitleSuffix()
320  {
321  return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
322  }
323 
329  public function getCanonicalUrl()
330  {
331  if ( oxRegistry::getUtils()->seoIsActive() && ( $oViewConf = $this->getViewConfig() ) ) {
332  return oxRegistry::get("oxUtilsUrl")->prepareCanonicalUrl( $oViewConf->getHomeLink() );
333  }
334  }
335 
336 
342  public function getBanners()
343  {
344 
345  $oBannerList = null;
346 
347  if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
348  $oBannerList = oxNew( 'oxActionList' );
349  $oBannerList->loadBanners();
350  }
351 
352  return $oBannerList;
353  }
354 
360  public function getManufacturerForSlider()
361  {
362 
363  $oList = null;
364 
365  if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
366  $oList = $this->getManufacturerlist();
367  }
368 
369  return $oList;
370  }
371 
372 }