OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
start.php
Go to the documentation of this file.
1 <?php
2 
7 class Start extends oxUBase
8 {
9 
15  protected $_sListDisplayType = null;
16 
22  protected $_sThisTemplate = 'page/shop/start.tpl';
23 
29  protected $_sMetaDescriptionIdent = 'oxstartmetadescription';
30 
36  protected $_sMetaKeywordsIdent = 'oxstartmetakeywords';
37 
43  protected $_blLoadActions = null;
44 
50  protected $_aTopArticleList = null;
51 
57  protected $_aNewArticleList = null;
58 
64  protected $_oFirstArticle = null;
65 
71  protected $_oCatOfferArticle = null;
72 
78  protected $_oCatOfferArtList = null;
79 
87  protected $_sTagCloud = null;
88 
94  protected $_blTop5Action = true;
95 
101  protected $_blBargainAction = true;
102 
103 
111  public function render()
112  {
113 
114  if (oxRegistry::getConfig()->getRequestParameter('showexceptionpage') == '1') {
115  return 'message/exception.tpl';
116  }
117 
118  $myConfig = $this->getConfig();
119 
120  $oRss = oxNew('oxrssfeed');
121  if ($myConfig->getConfigParam('iTop5Mode') && $myConfig->getConfigParam('bl_rssTopShop')) {
122  $this->addRssFeed($oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles');
123  }
124  if ($myConfig->getConfigParam('iNewestArticlesMode') && $myConfig->getConfigParam('bl_rssNewest')) {
125  $this->addRssFeed($oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles');
126  }
127  if ($myConfig->getConfigParam('bl_rssBargain')) {
128  $this->addRssFeed($oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles');
129  }
130 
131  parent::render();
132 
133  return $this->_sThisTemplate;
134  }
135 
147  protected function _prepareMetaDescription($sMeta, $iLength = 1024, $blDescTag = false)
148  {
149  if (!$sMeta &&
150  $this->getConfig()->getConfigParam('bl_perfLoadAktion') &&
151  $oArt = $this->getFirstArticle()
152  ) {
153  $oDescField = $oArt->getLongDescription();
154  $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
155  }
156 
157  return parent::_prepareMetaDescription($sMeta, $iLength, $blDescTag);
158  }
159 
170  protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
171  {
172  if (!$sKeywords &&
173  $this->getConfig()->getConfigParam('bl_perfLoadAktion') &&
174  $oArt = $this->getFirstArticle()
175  ) {
176  $oDescField = $oArt->getLongDescription();
177  $sKeywords = $oDescField->value;
178  }
179 
180  return parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
181  }
182 
188  protected function _getLoadActionsParam()
189  {
190  if ($this->_blLoadActions === null) {
191  $this->_blLoadActions = false;
192  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
193  $this->_blLoadActions = true;
194  }
195  }
196 
197  return $this->_blLoadActions;
198  }
199 
205  public function getArticleList()
206  {
207  if ($this->_aArticleList === null) {
208  $this->_aArticleList = array();
209  if ($this->_getLoadActionsParam()) {
210  // start list
211  $oArtList = oxNew('oxarticlelist');
212  $oArtList->loadActionArticles('OXSTART');
213  if ($oArtList->count()) {
214  $this->_aArticleList = $oArtList;
215  }
216  }
217  }
218 
219  return $this->_aArticleList;
220  }
221 
227  public function getTopArticleList()
228  {
229  if ($this->_aTopArticleList === null) {
230  $this->_aTopArticleList = false;
231  if ($this->_getLoadActionsParam()) {
232  // start list
233  $oArtList = oxNew('oxarticlelist');
234  $oArtList->loadActionArticles('OXTOPSTART');
235  if ($oArtList->count()) {
236  $this->_aTopArticleList = $oArtList;
237  }
238  }
239  }
240 
242  }
243 
244 
250  public function getNewestArticles()
251  {
252  if ($this->_aNewArticleList === null) {
253  $this->_aNewArticleList = array();
254  if ($this->_getLoadActionsParam()) {
255  // newest articles
256  $oArtList = oxNew('oxarticlelist');
257  $oArtList->loadNewestArticles();
258  if ($oArtList->count()) {
259  $this->_aNewArticleList = $oArtList;
260  }
261  }
262  }
263 
265  }
266 
272  public function getFirstArticle()
273  {
274  if ($this->_oFirstArticle === null) {
275  $this->_oFirstArticle = false;
276  if ($this->_getLoadActionsParam()) {
277  // top articles ( big one )
278  $oArtList = oxNew('oxarticlelist');
279  $oArtList->loadActionArticles('OXFIRSTSTART');
280  if ($oArtList->count()) {
281  $this->_oFirstArticle = $oArtList->current();
282  }
283  }
284  }
285 
286  return $this->_oFirstArticle;
287  }
288 
294  public function getCatOfferArticle()
295  {
296  if ($this->_oCatOfferArticle === null) {
297  $this->_oCatOfferArticle = false;
298  if ($oArtList = $this->getCatOfferArticleList()) {
299  $this->_oCatOfferArticle = $oArtList->current();
300  }
301  }
302 
304  }
305 
311  public function getCatOfferArticleList()
312  {
313  if ($this->_oCatOfferArtList === null) {
314  $this->_oCatOfferArtList = array();
315  if ($this->_getLoadActionsParam()) {
316  // "category offer" articles
317  $oArtList = oxNew('oxarticlelist');
318  $oArtList->loadActionArticles('OXCATOFFER');
319  if ($oArtList->count()) {
320  $this->_oCatOfferArtList = $oArtList;
321  }
322  }
323  }
324 
326  }
327 
333  public function getTitleSuffix()
334  {
335  return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
336  }
337 
343  public function getCanonicalUrl()
344  {
345  if (oxRegistry::getUtils()->seoIsActive() && ($oViewConf = $this->getViewConfig())) {
346  return oxRegistry::get("oxUtilsUrl")->prepareCanonicalUrl($oViewConf->getHomeLink());
347  }
348  }
349 
350 
356  public function getBanners()
357  {
358 
359  $oBannerList = null;
360 
361  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
362  $oBannerList = oxNew('oxActionList');
363  $oBannerList->loadBanners();
364  }
365 
366  return $oBannerList;
367  }
368 
374  public function getManufacturerForSlider()
375  {
376 
377  $oList = null;
378 
379  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
380  $oList = $this->getManufacturerlist();
381  }
382 
383  return $oList;
384  }
385 }