Go to the documentation of this file.00001 <?php
00002
00008 class oxVendorList extends oxList
00009 {
00010
00016 protected $_oRoot = null;
00017
00023 protected $_aPath = array();
00024
00030 protected $_blShowVendorArticleCnt = false;
00031
00037 protected $_oClickedVendor = null;
00038
00044 public function __construct()
00045 {
00046 $this->setShowVendorArticleCnt($this->getConfig()->getConfigParam('bl_perfShowActionCatArticleCnt'));
00047 parent::__construct('oxvendor');
00048 }
00049
00055 public function setShowVendorArticleCnt($blShowVendorArticleCnt = false)
00056 {
00057 $this->_blShowVendorArticleCnt = $blShowVendorArticleCnt;
00058 }
00059
00063 public function loadVendorList()
00064 {
00065 $oBaseObject = $this->getBaseObject();
00066 $sFieldList = $oBaseObject->getSelectFields();
00067 $sViewName = $oBaseObject->getViewName();
00068 $this->getBaseObject()->setShowArticleCnt($this->_blShowVendorArticleCnt);
00069
00070 $sWhere = '';
00071 if (!$this->isAdmin()) {
00072 $sWhere = $oBaseObject->getSqlActiveSnippet();
00073 $sWhere = $sWhere ? " where $sWhere and " : ' where ';
00074 $sWhere .= "{$sViewName}.oxtitle != '' ";
00075 }
00076
00077 $sSelect = "select {$sFieldList} from {$sViewName} {$sWhere} order by {$sViewName}.oxtitle";
00078 $this->selectString($sSelect);
00079 }
00080
00088 public function buildVendorTree($sLinkTarget, $sActCat, $sShopHomeUrl)
00089 {
00090 $sActCat = str_replace('v_', '', $sActCat);
00091
00092
00093 $this->loadVendorList();
00094
00095
00096
00097 $this->_oRoot = oxNew("oxVendor");
00098 $this->_oRoot->load('root');
00099
00100
00101 $this->_addCategoryFields($this->_oRoot);
00102 $this->_aPath[] = $this->_oRoot;
00103
00104 foreach ($this as $sVndId => $oVendor) {
00105
00106
00107 if ($sVndId == $sActCat) {
00108 $this->setClickVendor($oVendor);
00109 }
00110
00111 $this->_addCategoryFields($oVendor);
00112 if ($sActCat == $oVendor->oxvendor__oxid->value) {
00113 $this->_aPath[] = $oVendor;
00114 }
00115 }
00116
00117 $this->_seoSetVendorData();
00118 }
00119
00125 public function getRootCat()
00126 {
00127 return $this->_oRoot;
00128 }
00129
00135 public function getPath()
00136 {
00137 return $this->_aPath;
00138 }
00139
00145 protected function _addCategoryFields($oVendor)
00146 {
00147 $oVendor->oxcategories__oxid = new oxField("v_" . $oVendor->oxvendor__oxid->value);
00148 $oVendor->oxcategories__oxicon = $oVendor->oxvendor__oxicon;
00149 $oVendor->oxcategories__oxtitle = $oVendor->oxvendor__oxtitle;
00150 $oVendor->oxcategories__oxdesc = $oVendor->oxvendor__oxshortdesc;
00151
00152 $oVendor->setIsVisible(true);
00153 $oVendor->setHasVisibleSubCats(false);
00154 }
00155
00161 public function setClickVendor($oVendor)
00162 {
00163 $this->_oClickedVendor = $oVendor;
00164 }
00165
00171 public function getClickVendor()
00172 {
00173 return $this->_oClickedVendor;
00174 }
00175
00179 protected function _seoSetVendorData()
00180 {
00181
00182 if (oxRegistry::getUtils()->seoIsActive() && !$this->isAdmin()) {
00183
00184 $oEncoder = oxRegistry::get("oxSeoEncoderVendor");
00185
00186
00187 if ($this->_oRoot) {
00188 $oEncoder->getVendorUrl($this->_oRoot);
00189 }
00190
00191
00192 foreach ($this as $sVndId => $value) {
00193 $oEncoder->getVendorUrl($this->_aArray[$sVndId]);
00194 }
00195 }
00196 }
00197 }