OXID eShop CE  4.8.10
 All Classes Files Functions Variables Pages
oxseoencoderrecomm.php
Go to the documentation of this file.
1 <?php
2 
8 {
12  protected static $_instance = null;
13 
21  public static function getInstance()
22  {
23  return oxRegistry::get("oxSeoEncoderRecomm");
24  }
25 
34  public function getRecommUri( $oRecomm, $iLang = null )
35  {
36  if ( !( $sSeoUrl = $this->_loadFromDb( 'dynamic', $oRecomm->getId(), $iLang ) ) ) {
37  $myConfig = $this->getConfig();
38 
39  // fetching part of base url
40  $sSeoUrl = $this->_getStaticUri(
41  $oRecomm->getBaseStdLink( $iLang, false ),
42  $myConfig->getShopId(),
43  $iLang
44  )
45  .
46  $this->_prepareTitle( $oRecomm->oxrecommlists__oxtitle->value, false, $iLang );
47 
48  // creating unique
49  $sSeoUrl = $this->_processSeoUrl( $sSeoUrl, $oRecomm->getId(), $iLang );
50 
51  // inserting
52  $this->_saveToDb( 'dynamic', $oRecomm->getId(), $oRecomm->getBaseStdLink( $iLang ), $sSeoUrl, $iLang, $myConfig->getShopId() );
53  }
54 
55  return $sSeoUrl;
56  }
57 
66  public function getRecommUrl( $oRecomm, $iLang = null)
67  {
68  if (!isset($iLang)) {
69  $iLang = oxRegistry::getLang()->getBaseLanguage();
70  }
71  return $this->_getFullUrl( $this->getRecommUri( $oRecomm, $iLang ), $iLang );
72  }
73 
84  public function getRecommPageUrl( $oRecomm, $iPage, $iLang = null, $blFixed = false )
85  {
86  if (!isset($iLang)) {
87  $iLang = oxRegistry::getLang()->getBaseLanguage();
88  }
89  $sStdUrl = $oRecomm->getBaseStdLink( $iLang ) . '&amp;pgNr=' . $iPage;
90  $sParams = (int) ($iPage + 1);
91 
92  $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
93  $sSeoUrl = $this->getRecommUri( $oRecomm, $iLang ) . $sParams . "/";
94 
95  return $this->_getFullUrl( $this->_getPageUri( $oRecomm, 'dynamic', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
96  }
97 }