OXID eShop CE  4.9.11
 All Classes Files Functions Variables Pages
manufacturerlist.php
Go to the documentation of this file.
1 <?php
2 
9 class ManufacturerList extends aList
10 {
11 
17  protected $_sListType = 'manufacturer';
18 
24  protected $_blVisibleSubCats = null;
25 
31  protected $_oSubCatList = null;
32 
38  protected $_oRecommList = null;
39 
45  protected $_sTplLocation = null;
46 
52  protected $_sCatTitle = null;
53 
59  protected $_oPageNavigation = null;
60 
66  protected $_blShowSorting = true;
67 
74 
85  public function render()
86  {
87  // load Manufacturer
88  if ($this->getManufacturerTree()) {
89  if (($oManufacturer = $this->getActManufacturer())) {
90  if ($oManufacturer->getId() != 'root') {
91  // load the articles
92  $this->getArticleList();
93 
94  // checking if requested page is correct
95  $this->_checkRequestedPage();
96 
97  // processing list articles
98  $this->_processListArticles();
99  }
100  }
101  }
102 
103  oxUBase::render();
104 
105  return $this->_sThisTemplate;
106  }
107 
113  protected function _getProductLinkType()
114  {
116  }
117 
125  protected function _loadArticles($oManufacturer)
126  {
127  $sManufacturerId = $oManufacturer->getId();
128 
129  // load only articles which we show on screen
130  $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
131  $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
132 
133  $oArtList = oxNew('oxarticlelist');
134  $oArtList->setSqlLimit($iNrofCatArticles * $this->_getRequestPageNr(), $iNrofCatArticles);
135  $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent()));
136 
137  // load the articles
138  $this->_iAllArtCnt = $oArtList->loadManufacturerArticles($sManufacturerId, $oManufacturer);
139 
140  // counting pages
141  $this->_iCntPages = round($this->_iAllArtCnt / $iNrofCatArticles + 0.49);
142 
143  return array($oArtList, $this->_iAllArtCnt);
144  }
145 
151  protected function _getSeoObjectId()
152  {
153  $sId = null;
154  if (($oManufacturer = $this->getActManufacturer())) {
155  $sId = $oManufacturer->getId();
156  }
157 
158  return $sId;
159  }
160 
171  protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
172  {
173  if (oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer())) {
174  if ($iPage) {
175  // only if page number > 0
176  $sUrl = $oManufacturer->getBaseSeoLink($iLang, $iPage);
177  }
178  } else {
179  $sUrl = parent::_addPageNrParam($sUrl, $iPage, $iLang);
180  }
181 
182  return $sUrl;
183  }
184 
190  public function generatePageNavigationUrl()
191  {
192  if ((oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer()))) {
193  return $oManufacturer->getLink();
194  } else {
196  }
197  }
198 
204  public function hasVisibleSubCats()
205  {
206  if ($this->_blVisibleSubCats === null) {
207  $this->_blVisibleSubCats = false;
208  if (($oManufacturerTree = $this->getManufacturerTree())) {
209  if (($oManufacturer = $this->getActManufacturer())) {
210  if ($oManufacturer->getId() == 'root') {
211  $this->_blVisibleSubCats = $oManufacturerTree->count();
212  $this->_oSubCatList = $oManufacturerTree;
213  }
214  }
215  }
216  }
217 
219  }
220 
226  public function getSubCatList()
227  {
228  if ($this->_oSubCatList === null) {
229  $this->_oSubCatList = $this->hasVisibleSubCats() ? $this->_oSubCatList : array();
230  }
231 
232  return $this->_oSubCatList;
233  }
234 
240  public function getArticleList()
241  {
242  if ($this->_aArticleList === null) {
243  $this->_aArticleList = array();
244  if (($oManufacturerTree = $this->getManufacturerTree())) {
245  $oManufacturer = $this->getActManufacturer();
246  if ($oManufacturer && ($oManufacturer->getId() != 'root') && $oManufacturer->getIsVisible()) {
247  list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oManufacturer);
248  if ($iAllArtCnt) {
249  $this->_aArticleList = $aArticleList;
250  }
251  }
252  }
253  }
254 
255  return $this->_aArticleList;
256  }
257 
263  public function getTitle()
264  {
265  if ($this->_sCatTitle === null) {
266  $this->_sCatTitle = '';
267  if ($oManufacturerTree = $this->getManufacturerTree()) {
268  if ($oManufacturer = $this->getActManufacturer()) {
269  $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
270  }
271  }
272  }
273 
274  return $this->_sCatTitle;
275  }
276 
282  public function getTreePath()
283  {
284  $aPath = null;
285  if ($oManufacturerTree = $this->getManufacturerTree()) {
286  $aPath = $oManufacturerTree->getPath();
287  }
288 
289  return $aPath;
290  }
291 
297  public function getActiveCategory()
298  {
299  if ($this->_oActCategory === null) {
300  $this->_oActCategory = false;
301  if (($oManufacturerTree = $this->getManufacturerTree())) {
302  if ($oManufacturer = $this->getActManufacturer()) {
303  $this->_oActCategory = $oManufacturer;
304  }
305  }
306  }
307 
308  return $this->_oActCategory;
309  }
310 
316  public function getCatTreePath()
317  {
318  if ($this->_sCatTreePath === null) {
319  $this->_sCatTreePath = false;
320  if (($oManufacturerTree = $this->getManufacturerTree())) {
321  $this->_sCatTreePath = $oManufacturerTree->getPath();
322  }
323  }
324 
325  return $this->_sCatTreePath;
326  }
327 
333  public function getTitleSuffix()
334  {
335  $sSuffix = null;
336  if ($this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value) {
337  $sSuffix = $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
338  }
339 
340  return $sSuffix;
341  }
342 
351  protected function _prepareMetaKeyword($aCatPath, $blRemoveDuplicatedWords = true)
352  {
353  return parent::_collectMetaKeyword($aCatPath);
354  }
355 
368  protected function _prepareMetaDescription($aCatPath, $iLength = 1024, $blDescTag = false)
369  {
370  return parent::_collectMetaDescription($aCatPath, $iLength, $blDescTag);
371  }
372 
381  protected function _getSubject($iLang)
382  {
383  return $this->getActManufacturer();
384  }
385 
391  public function getAddUrlParams()
392  {
393  $sAddParams = parent::getAddUrlParams();
394  $sAddParams .= ($sAddParams ? '&amp;' : '') . "listtype={$this->_sListType}";
395  if ($oManufacturer = $this->getActManufacturer()) {
396  $sAddParams .= "&amp;mnid=" . $oManufacturer->getId();
397  }
398 
399  return $sAddParams;
400  }
401 
407  public function getBreadCrumb()
408  {
409  $aPaths = array();
410 
411  $oCatTree = $this->getManufacturerTree();
412 
413  if ($oCatTree) {
414  foreach ($oCatTree->getPath() as $oCat) {
415  $aCatPath = array();
416  $aCatPath['link'] = $oCat->getLink();
417  $aCatPath['title'] = $oCat->oxmanufacturers__oxtitle->value;
418 
419  $aPaths[] = $aCatPath;
420  }
421  }
422 
423  return $aPaths;
424  }
425 
432  public function getAttributes()
433  {
434  return null;
435  }
436 }