oxseoencodervendor.php

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

Generated on Wed Apr 22 12:26:31 2009 for OXID eShop CE by  doxygen 1.5.5