oxseoencodervendor.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxSeoEncoderVendor extends oxSeoEncoder
00009 {
00013     protected static $_instance = null;
00014 
00020     public static function getInstance()
00021     {
00022         if (!self::$_instance) {
00023             self::$_instance = oxNew("oxSeoEncoderVendor");
00024         }
00025         return self::$_instance;
00026     }
00027 
00036     public function getVendorUri( $oVendor, $iLang = null )
00037     {
00038         if (!isset($iLang)) {
00039             $iLang = $oVendor->getLanguage();
00040         }
00041         // load from db
00042         if ( !( $sSeoUrl = $this->_loadFromDb( 'oxvendor', $oVendor->getId(), $iLang ) ) ) {
00043 
00044             if ($iLang != $oVendor->getLanguage()) {
00045                 $sId = $oVendor->getId();
00046                 if ($sId == 'root') {
00047                     $oVendor = oxVendor::getRootVendor( $iLang );
00048                 } else {
00049                     $oVendor = oxNew('oxvendor');
00050                     $oVendor->loadInLang($iLang, $sId);
00051                 }
00052             }
00053 
00054             $sSeoUrl = '';
00055             if ( $oVendor->getId() != 'root' ) {
00056                 $sSeoUrl .= $this->getVendorUri( oxVendor::getRootVendor( $iLang ), $iLang );
00057             }
00058 
00059             $sSeoUrl .= $this->_prepareTitle( $oVendor->oxvendor__oxtitle->value .'/' );
00060             $sSeoUrl  = $this->_getUniqueSeoUrl( $sSeoUrl, '/', $oVendor->getId() );
00061 
00062             // save to db
00063             $this->_saveToDb( 'oxvendor', $oVendor->getId(), $oVendor->getStdLink(), $sSeoUrl, $iLang );
00064         }
00065         return $sSeoUrl;
00066     }
00067 
00078     public function getVendorPageUrl( $oVendor, $iPage, $iLang = null, $blFixed = false )
00079     {
00080         if (!isset($iLang)) {
00081             $iLang = $oVendor->getLanguage();
00082         }
00083         $sStdUrl = $oVendor->getStdLink() . '&amp;pgNr=' . $iPage;
00084         $sParams = sprintf( "%0" . ceil( $this->_iCntPages / 10 + 1 ) . "d", $iPage + 1 );
00085 
00086         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00087         $sSeoUrl = $this->getVendorUri( $oVendor, $iLang ) . $sParams . "/";
00088 
00089         return $this->_getFullUrl( $this->_getPageUri( $oVendor, 'oxvendor', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
00090     }
00091 
00100     public function getVendorUrl( $oVendor, $iLang = null )
00101     {
00102         if (!isset($iLang)) {
00103             $iLang = $oVendor->getLanguage();
00104         }
00105         return $this->_getFullUrl( $this->getVendorUri( $oVendor, $iLang ), $iLang );
00106     }
00107 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5