00001 <?php
00002
00007 class oxManufacturerList extends oxList
00008 {
00014 protected $_oRoot = null;
00015
00021 protected $_aPath = array();
00022
00028 protected $_blShowManufacturerArticleCnt = false;
00029
00035 protected $_oClickedManufacturer = null;
00036
00045 public function __construct( $sObjectsInListName = 'oxmanufacturer')
00046 {
00047 $this->setShowManufacturerArticleCnt( $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) );
00048 parent::__construct( 'oxmanufacturer');
00049 }
00050
00058 public function setShowManufacturerArticleCnt( $blShowManufacturerArticleCnt = false )
00059 {
00060 $this->_blShowManufacturerArticleCnt = $blShowManufacturerArticleCnt;
00061 }
00062
00068 public function loadManufacturerList()
00069 {
00070 $sLangAdd = oxLang::getInstance()->getLanguageTag();
00071 $oBaseObject = $this->getBaseObject();
00072
00073 $sFieldList = $oBaseObject->getSelectFields();
00074 $sViewName = $oBaseObject->getViewName();
00075 $this->getBaseObject()->setShowArticleCnt( $this->_blShowManufacturerArticleCnt );
00076
00077 $sWhere = '';
00078 if ( !$this->isAdmin() ) {
00079 $sWhere = $oBaseObject->getSqlActiveSnippet();
00080 $sWhere = $sWhere?" where $sWhere and ":' where ';
00081 $sWhere .= "{$sViewName}.oxtitle{$sLangAdd} != '' ";
00082 }
00083
00084 $sSelect = "select {$sFieldList} from {$sViewName} {$sWhere} order by {$sViewName}.oxtitle{$sLangAdd}";
00085 $this->selectString( $sSelect );
00086 }
00087
00097 public function buildManufacturerTree( $sLinkTarget, $sActCat, $sShopHomeUrl )
00098 {
00099
00100 $this->loadManufacturerList();
00101
00102
00103
00104 $this->_oRoot = oxManufacturer::getRootManufacturer();
00105
00106
00107 $this->_addCategoryFields( $this->_oRoot );
00108 $this->_aPath[] = $this->_oRoot;
00109
00110 foreach ( $this as $sVndId => $oManufacturer ) {
00111
00112
00113 if ( $sVndId == $sActCat ) {
00114 $this->setClickManufacturer( $oManufacturer );
00115 }
00116
00117 $this->_addCategoryFields( $oManufacturer );
00118 if ( $sActCat == $oManufacturer->oxmanufacturers__oxid->value ) {
00119 $this->_aPath[] = $oManufacturer;
00120 }
00121 }
00122
00123 $this->_seoSetManufacturerData();
00124 }
00125
00131 public function getRootCat()
00132 {
00133 return $this->_oRoot;
00134 }
00135
00141 public function getPath()
00142 {
00143 return $this->_aPath;
00144 }
00145
00151 public function getHtmlPath()
00152 {
00153 $sHtmlVendTree = '';
00154 $sSep = '';
00155 foreach ($this->_aPath as $oManufacturer) {
00156 $sHtmlVendTree .= " $sSep<a href='".$oManufacturer->getLink()."'>".$oManufacturer->oxmanufacturers__oxtitle->value."</a>";
00157 $sSep = '/ ';
00158 }
00159 return $sHtmlVendTree;
00160 }
00161
00169 protected function _addCategoryFields( $oManufacturer )
00170 {
00171 $oManufacturer->oxcategories__oxid = new oxField( $oManufacturer->oxmanufacturers__oxid->value );
00172 $oManufacturer->oxcategories__oxicon = $oManufacturer->oxmanufacturers__oxicon;
00173 $oManufacturer->oxcategories__oxtitle = $oManufacturer->oxmanufacturers__oxtitle;
00174 $oManufacturer->oxcategories__oxdesc = $oManufacturer->oxmanufacturers__oxshortdesc;
00175
00176 $oManufacturer->setIsVisible( true );
00177 $oManufacturer->setHasVisibleSubCats( false );
00178 }
00179
00187 public function setClickManufacturer( $oManufacturer )
00188 {
00189 $this->_oClickedManufacturer = $oManufacturer;
00190 }
00191
00197 public function getClickManufacturer()
00198 {
00199 return $this->_oClickedManufacturer;
00200 }
00201
00207 protected function _seoSetManufacturerData()
00208 {
00209 if (!oxUtils::getInstance()->seoIsActive()) {
00210 return;
00211 }
00212
00213 $oEncoder = oxSeoEncoderManufacturer::getInstance();
00214
00215
00216 if ($this->_oRoot) {
00217 $oEncoder->getManufacturerUrl($this->_oRoot);
00218 }
00219
00220
00221 foreach ($this as $sVndId => $value) {
00222 $oEncoder->getManufacturerUrl( $this->_aArray[$sVndId] );
00223 }
00224 }
00225 }