OXID eShop CE  4.9.9
 All Classes 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 
85  protected $_sTagCloud = null;
86 
92  protected $_blTop5Action = true;
93 
99  protected $_blBargainAction = true;
100 
101 
109  public function render()
110  {
111 
112  if (oxRegistry::getConfig()->getRequestParameter('showexceptionpage') == '1') {
113  return 'message/exception.tpl';
114  }
115 
116  $myConfig = $this->getConfig();
117 
118  $oRss = oxNew('oxrssfeed');
119  if ($myConfig->getConfigParam('iTop5Mode') && $myConfig->getConfigParam('bl_rssTopShop')) {
120  $this->addRssFeed($oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles');
121  }
122  if ($myConfig->getConfigParam('iNewestArticlesMode') && $myConfig->getConfigParam('bl_rssNewest')) {
123  $this->addRssFeed($oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles');
124  }
125  if ($myConfig->getConfigParam('bl_rssBargain')) {
126  $this->addRssFeed($oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles');
127  }
128 
129  parent::render();
130 
131  return $this->_sThisTemplate;
132  }
133 
145  protected function _prepareMetaDescription($sMeta, $iLength = 1024, $blDescTag = false)
146  {
147  if (!$sMeta &&
148  $this->getConfig()->getConfigParam('bl_perfLoadAktion') &&
149  $oArt = $this->getFirstArticle()
150  ) {
151  $oDescField = $oArt->getLongDescription();
152  $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
153  }
154 
155  return parent::_prepareMetaDescription($sMeta, $iLength, $blDescTag);
156  }
157 
168  protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
169  {
170  if (!$sKeywords &&
171  $this->getConfig()->getConfigParam('bl_perfLoadAktion') &&
172  $oArt = $this->getFirstArticle()
173  ) {
174  $oDescField = $oArt->getLongDescription();
175  $sKeywords = $oDescField->value;
176  }
177 
178  return parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
179  }
180 
186  protected function _getLoadActionsParam()
187  {
188  if ($this->_blLoadActions === null) {
189  $this->_blLoadActions = false;
190  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
191  $this->_blLoadActions = true;
192  }
193  }
194 
195  return $this->_blLoadActions;
196  }
197 
203  public function getArticleList()
204  {
205  if ($this->_aArticleList === null) {
206  $this->_aArticleList = array();
207  if ($this->_getLoadActionsParam()) {
208  // start list
209  $oArtList = oxNew('oxarticlelist');
210  $oArtList->loadActionArticles('OXSTART');
211  if ($oArtList->count()) {
212  $this->_aArticleList = $oArtList;
213  }
214  }
215  }
216 
217  return $this->_aArticleList;
218  }
219 
225  public function getTopArticleList()
226  {
227  if ($this->_aTopArticleList === null) {
228  $this->_aTopArticleList = false;
229  if ($this->_getLoadActionsParam()) {
230  // start list
231  $oArtList = oxNew('oxarticlelist');
232  $oArtList->loadActionArticles('OXTOPSTART');
233  if ($oArtList->count()) {
234  $this->_aTopArticleList = $oArtList;
235  }
236  }
237  }
238 
240  }
241 
242 
248  public function getNewestArticles()
249  {
250  if ($this->_aNewArticleList === null) {
251  $this->_aNewArticleList = array();
252  if ($this->_getLoadActionsParam()) {
253  // newest articles
254  $oArtList = oxNew('oxarticlelist');
255  $oArtList->loadNewestArticles();
256  if ($oArtList->count()) {
257  $this->_aNewArticleList = $oArtList;
258  }
259  }
260  }
261 
263  }
264 
270  public function getFirstArticle()
271  {
272  if ($this->_oFirstArticle === null) {
273  $this->_oFirstArticle = false;
274  if ($this->_getLoadActionsParam()) {
275  // top articles ( big one )
276  $oArtList = oxNew('oxarticlelist');
277  $oArtList->loadActionArticles('OXFIRSTSTART');
278  if ($oArtList->count()) {
279  $this->_oFirstArticle = $oArtList->current();
280  }
281  }
282  }
283 
284  return $this->_oFirstArticle;
285  }
286 
292  public function getCatOfferArticle()
293  {
294  if ($this->_oCatOfferArticle === null) {
295  $this->_oCatOfferArticle = false;
296  if ($oArtList = $this->getCatOfferArticleList()) {
297  $this->_oCatOfferArticle = $oArtList->current();
298  }
299  }
300 
302  }
303 
309  public function getCatOfferArticleList()
310  {
311  if ($this->_oCatOfferArtList === null) {
312  $this->_oCatOfferArtList = array();
313  if ($this->_getLoadActionsParam()) {
314  // "category offer" articles
315  $oArtList = oxNew('oxarticlelist');
316  $oArtList->loadActionArticles('OXCATOFFER');
317  if ($oArtList->count()) {
318  $this->_oCatOfferArtList = $oArtList;
319  }
320  }
321  }
322 
324  }
325 
331  public function getTitleSuffix()
332  {
333  return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
334  }
335 
341  public function getCanonicalUrl()
342  {
343  if (oxRegistry::getUtils()->seoIsActive() && ($oViewConf = $this->getViewConfig())) {
344  return oxRegistry::get("oxUtilsUrl")->prepareCanonicalUrl($oViewConf->getHomeLink());
345  }
346  }
347 
348 
354  public function getBanners()
355  {
356 
357  $oBannerList = null;
358 
359  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
360  $oBannerList = oxNew('oxActionList');
361  $oBannerList->loadBanners();
362  }
363 
364  return $oBannerList;
365  }
366 
372  public function getManufacturerForSlider()
373  {
374 
375  $oList = null;
376 
377  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
378  $oList = $this->getManufacturerlist();
379  }
380 
381  return $oList;
382  }
383 }