OXID eShop CE  4.10.5
 All Classes Namespaces 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 
40  protected $_oRecommList = null;
41 
47  protected $_sTplLocation = null;
48 
54  protected $_sCatTitle = null;
55 
61  protected $_oPageNavigation = null;
62 
68  protected $_blShowSorting = true;
69 
76 
87  public function render()
88  {
90 
91  // load Manufacturer
92  if ($this->getManufacturerTree()) {
93  if (($oManufacturer = $this->getActManufacturer())) {
94  if ($oManufacturer->getId() != 'root') {
95  // load the articles
96  $this->getArticleList();
97 
98  // checking if requested page is correct
99  $this->_checkRequestedPage();
100 
101  // processing list articles
102  $this->_processListArticles();
103  }
104  }
105  }
106 
107  return $this->_sThisTemplate;
108  }
109 
115  protected function _getProductLinkType()
116  {
118  }
119 
127  protected function _loadArticles($oManufacturer)
128  {
129  $sManufacturerId = $oManufacturer->getId();
130 
131  // load only articles which we show on screen
132  $iNrofCatArticles = (int) $this->getConfig()->getConfigParam('iNrofCatArticles');
133  $iNrofCatArticles = $iNrofCatArticles ? $iNrofCatArticles : 1;
134 
135  $oArtList = oxNew('oxarticlelist');
136  $oArtList->setSqlLimit($iNrofCatArticles * $this->_getRequestPageNr(), $iNrofCatArticles);
137  $oArtList->setCustomSorting($this->getSortingSql($this->getSortIdent()));
138 
139  // load the articles
140  $this->_iAllArtCnt = $oArtList->loadManufacturerArticles($sManufacturerId, $oManufacturer);
141 
142  // counting pages
143  $this->_iCntPages = round($this->_iAllArtCnt / $iNrofCatArticles + 0.49);
144 
145  return array($oArtList, $this->_iAllArtCnt);
146  }
147 
153  protected function _getSeoObjectId()
154  {
155  $sId = null;
156  if (($oManufacturer = $this->getActManufacturer())) {
157  $sId = $oManufacturer->getId();
158  }
159 
160  return $sId;
161  }
162 
173  protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
174  {
175  if (oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer())) {
176  if ($iPage) {
177  // only if page number > 0
178  $sUrl = $oManufacturer->getBaseSeoLink($iLang, $iPage);
179  }
180  } else {
181  $sUrl = parent::_addPageNrParam($sUrl, $iPage, $iLang);
182  }
183 
184  return $sUrl;
185  }
186 
192  public function generatePageNavigationUrl()
193  {
194  if ((oxRegistry::getUtils()->seoIsActive() && ($oManufacturer = $this->getActManufacturer()))) {
195  return $oManufacturer->getLink();
196  } else {
198  }
199  }
200 
206  public function hasVisibleSubCats()
207  {
208  if ($this->_blVisibleSubCats === null) {
209  $this->_blVisibleSubCats = false;
210  if (($oManufacturerTree = $this->getManufacturerTree())) {
211  if (($oManufacturer = $this->getActManufacturer())) {
212  if ($oManufacturer->getId() == 'root') {
213  $this->_blVisibleSubCats = $oManufacturerTree->count();
214  $this->_oSubCatList = $oManufacturerTree;
215  }
216  }
217  }
218  }
219 
221  }
222 
228  public function getSubCatList()
229  {
230  if ($this->_oSubCatList === null) {
231  $this->_oSubCatList = $this->hasVisibleSubCats() ? $this->_oSubCatList : array();
232  }
233 
234  return $this->_oSubCatList;
235  }
236 
242  public function getArticleList()
243  {
244  if ($this->_aArticleList === null) {
245  $this->_aArticleList = array();
246  if (($oManufacturerTree = $this->getManufacturerTree())) {
247  $oManufacturer = $this->getActManufacturer();
248  if ($oManufacturer && ($oManufacturer->getId() != 'root') && $oManufacturer->getIsVisible()) {
249  list($aArticleList, $iAllArtCnt) = $this->_loadArticles($oManufacturer);
250  if ($iAllArtCnt) {
251  $this->_aArticleList = $aArticleList;
252  }
253  }
254  }
255  }
256 
257  return $this->_aArticleList;
258  }
259 
265  public function getTitle()
266  {
267  if ($this->_sCatTitle === null) {
268  $this->_sCatTitle = '';
269  if ($oManufacturerTree = $this->getManufacturerTree()) {
270  if ($oManufacturer = $this->getActManufacturer()) {
271  $this->_sCatTitle = $oManufacturer->oxmanufacturers__oxtitle->value;
272  }
273  }
274  }
275 
276  return $this->_sCatTitle;
277  }
278 
284  public function getTreePath()
285  {
286  $aPath = null;
287  if ($oManufacturerTree = $this->getManufacturerTree()) {
288  $aPath = $oManufacturerTree->getPath();
289  }
290 
291  return $aPath;
292  }
293 
299  public function getActiveCategory()
300  {
301  if ($this->_oActCategory === null) {
302  $this->_oActCategory = false;
303  if (($oManufacturerTree = $this->getManufacturerTree())) {
304  if ($oManufacturer = $this->getActManufacturer()) {
305  $this->_oActCategory = $oManufacturer;
306  }
307  }
308  }
309 
310  return $this->_oActCategory;
311  }
312 
318  public function getCatTreePath()
319  {
320  if ($this->_sCatTreePath === null) {
321  $this->_sCatTreePath = false;
322  if (($oManufacturerTree = $this->getManufacturerTree())) {
323  $this->_sCatTreePath = $oManufacturerTree->getPath();
324  }
325  }
326 
327  return $this->_sCatTreePath;
328  }
329 
335  public function getTitleSuffix()
336  {
337  $sSuffix = null;
338  if ($this->getActManufacturer()->oxmanufacturers__oxshowsuffix->value) {
339  $sSuffix = $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
340  }
341 
342  return $sSuffix;
343  }
344 
353  protected function _prepareMetaKeyword($aCatPath, $blRemoveDuplicatedWords = true)
354  {
355  return parent::_collectMetaKeyword($aCatPath);
356  }
357 
370  protected function _prepareMetaDescription($aCatPath, $iLength = 1024, $blDescTag = false)
371  {
372  return parent::_collectMetaDescription($aCatPath, $iLength, $blDescTag);
373  }
374 
383  protected function _getSubject($iLang)
384  {
385  return $this->getActManufacturer();
386  }
387 
393  public function getAddUrlParams()
394  {
395  $sAddParams = parent::getAddUrlParams();
396  $sAddParams .= ($sAddParams ? '&amp;' : '') . "listtype={$this->_sListType}";
397  if ($oManufacturer = $this->getActManufacturer()) {
398  $sAddParams .= "&amp;mnid=" . $oManufacturer->getId();
399  }
400 
401  return $sAddParams;
402  }
403 
409  public function getBreadCrumb()
410  {
411  $aPaths = array();
412 
413  $oCatTree = $this->getManufacturerTree();
414 
415  if ($oCatTree) {
416  foreach ($oCatTree->getPath() as $oCat) {
417  $aCatPath = array();
418  $aCatPath['link'] = $oCat->getLink();
419  $aCatPath['title'] = $oCat->oxmanufacturers__oxtitle->value;
420 
421  $aPaths[] = $aCatPath;
422  }
423  }
424 
425  return $aPaths;
426  }
427 
434  public function getAttributes()
435  {
436  return null;
437  }
438 }