Go to the documentation of this file.00001 <?php
00002
00007 class oxVendorList extends oxList
00008 {
00014 protected $_oRoot = null;
00015
00021 protected $_aPath = array();
00022
00028 protected $_blShowVendorArticleCnt = false;
00029
00035 protected $_oClickedVendor = null;
00036
00045 public function __construct( $sObjectsInListName = 'oxvendor')
00046 {
00047 $this->setShowVendorArticleCnt( $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) );
00048 parent::__construct( 'oxvendor');
00049 }
00050
00058 public function setShowVendorArticleCnt( $blShowVendorArticleCnt = false )
00059 {
00060 $this->_blShowVendorArticleCnt = $blShowVendorArticleCnt;
00061 }
00062
00068 public function loadVendorList()
00069 {
00070 $oBaseObject = $this->getBaseObject();
00071 $sFieldList = $oBaseObject->getSelectFields();
00072 $sViewName = $oBaseObject->getViewName();
00073 $this->getBaseObject()->setShowArticleCnt( $this->_blShowVendorArticleCnt );
00074
00075 $sWhere = '';
00076 if ( !$this->isAdmin() ) {
00077 $sWhere = $oBaseObject->getSqlActiveSnippet();
00078 $sWhere = $sWhere?" where $sWhere and ":' where ';
00079 $sWhere .= "{$sViewName}.oxtitle != '' ";
00080 }
00081
00082 $sSelect = "select {$sFieldList} from {$sViewName} {$sWhere} order by {$sViewName}.oxtitle";
00083 $this->selectString( $sSelect );
00084 }
00085
00097 public function buildVendorTree( $sLinkTarget, $sActCat, $sShopHomeUrl )
00098 {
00099 $sActCat = str_replace( 'v_', '', $sActCat );
00100
00101
00102 $this->loadVendorList();
00103
00104
00105
00106 $this->_oRoot = oxNew( "oxVendor" );
00107 $this->_oRoot->load( 'root' );
00108
00109
00110 $this->_addCategoryFields( $this->_oRoot );
00111 $this->_aPath[] = $this->_oRoot;
00112
00113 foreach ( $this as $sVndId => $oVendor ) {
00114
00115
00116 if ( $sVndId == $sActCat ) {
00117 $this->setClickVendor( $oVendor );
00118 }
00119
00120 $this->_addCategoryFields( $oVendor );
00121 if ( $sActCat == $oVendor->oxvendor__oxid->value ) {
00122 $this->_aPath[] = $oVendor;
00123 }
00124 }
00125
00126 $this->_seoSetVendorData();
00127 }
00128
00134 public function getRootCat()
00135 {
00136 return $this->_oRoot;
00137 }
00138
00144 public function getPath()
00145 {
00146 return $this->_aPath;
00147 }
00148
00154 public function getHtmlPath()
00155 {
00156 $sHtmlVendTree = '';
00157 $sSep = '';
00158 foreach ($this->_aPath as $oVendor) {
00159 $sHtmlVendTree .= " $sSep<a href='".$oVendor->getLink()."'>".$oVendor->oxvendor__oxtitle->value."</a>";
00160 $sSep = '/ ';
00161 }
00162 return $sHtmlVendTree;
00163 }
00164
00172 protected function _addCategoryFields( $oVendor )
00173 {
00174 $oVendor->oxcategories__oxid = new oxField("v_".$oVendor->oxvendor__oxid->value);
00175 $oVendor->oxcategories__oxicon = $oVendor->oxvendor__oxicon;
00176 $oVendor->oxcategories__oxtitle = $oVendor->oxvendor__oxtitle;
00177 $oVendor->oxcategories__oxdesc = $oVendor->oxvendor__oxshortdesc;
00178
00179 $oVendor->setIsVisible( true );
00180 $oVendor->setHasVisibleSubCats( false );
00181 }
00182
00190 public function setClickVendor( $oVendor )
00191 {
00192 $this->_oClickedVendor = $oVendor;
00193 }
00194
00200 public function getClickVendor()
00201 {
00202 return $this->_oClickedVendor;
00203 }
00204
00210 protected function _seoSetVendorData()
00211 {
00212
00213 if ( oxUtils::getInstance()->seoIsActive() && !$this->isAdmin()) {
00214
00215 $oEncoder = oxSeoEncoderVendor::getInstance();
00216
00217
00218 if ($this->_oRoot) {
00219 $oEncoder->getVendorUrl($this->_oRoot);
00220 }
00221
00222
00223 foreach ($this as $sVndId => $value) {
00224 $oEncoder->getVendorUrl( $this->_aArray[$sVndId] );
00225 }
00226 }
00227 }
00228 }