OXID eShop CE  4.9.11
 All Classes Files Functions Variables Pages
oxubase.php
Go to the documentation of this file.
1 <?php
2 
7 // view indexing state for search engines:
8 define('VIEW_INDEXSTATE_INDEX', 0); // index without limitations
9 define('VIEW_INDEXSTATE_NOINDEXNOFOLLOW', 1); // no index / no follow
10 define('VIEW_INDEXSTATE_NOINDEXFOLLOW', 2); // no index / follow
11 
17 class oxUBase extends oxView
18 {
19 
25  protected $_blFbWidgetsOn = null;
26 
32  protected $_sRemoveMetaChars = '.\+*?[^]$(){}=!<>|:&';
33 
39  protected $_oaComponents = array();
40 
46  protected $_blIsOrderStep = false;
47 
53  protected $_sListType = null;
54 
60  protected $_aListDisplayTypes = array('grid', 'line', 'infogrid');
61 
67  protected $_sListDisplayType = null;
68 
74  protected $_sCustomListDisplayType = null;
75 
81  protected $_oActCategory = null;
82 
88  protected $_oActManufacturer = null;
89 
95  protected $_oActVendor = null;
96 
102  protected $_oActiveRecommList = null;
103 
109  protected $_oActSearch = null;
110 
116  protected $_blShowSorting = false;
117 
123  protected $_blLoadCurrency = null;
124 
130  protected $_blLoadManufacturerTree = null;
131 
137  protected $_blDontShowEmptyCats = null;
138 
144  protected $_blLoadLanguage = null;
145 
151  protected $_iTopCatNavItmCnt = null;
152 
158  protected $_aRssLinks = null;
159 
165  protected $_sListOrderBy = null;
166 
172  protected $_sListOrderDir = null;
173 
179  protected $_sMetaDescription = null;
180 
186  protected $_sMetaKeywords = null;
187 
193  protected $_sMetaDescriptionIdent = null;
194 
200  protected $_sMetaKeywordsIdent = null;
201 
207  protected $_sAdditionalParams = null;
208 
214  protected $_oActCurrency = null;
215 
221  protected $_blEnabledPrivateSales = null;
222 
230  protected $_blCommonAdded = false;
231 
239 
246  protected $_blForceNoIndex = false;
247 
253  protected $_iCompItemsCnt = null;
254 
260  protected $_sContentId = null;
261 
267  protected $_oContent = null;
268 
274  protected $_sViewResetID = null;
275 
281  protected $_aMenueList = null;
282 
289  protected $_aComponentNames = array(
290  'oxcmp_user' => 1, // 0 means dont init if cached
291  'oxcmp_lang' => 0,
292  'oxcmp_cur' => 1,
293  'oxcmp_shop' => 1,
294  'oxcmp_categories' => 0,
295  'oxcmp_utils' => 1,
296  'oxcmp_news' => 0,
297  'oxcmp_basket' => 1
298  );
299 
306  protected $_aUserComponentNames = array();
307 
313  protected $_oProduct = null;
314 
320  protected $_iActPage = null;
321 
327  protected $_aArticleList = null;
328 
334  protected $_oManufacturerTree = null;
335 
341  protected $_oCategoryTree = null;
342 
348  protected $_aTop5ArticleList = null;
349 
355  protected $_aBargainArticleList = null;
356 
362  protected $_blLowOrderPrice = null;
363 
369  protected $_sMinOrderPrice = null;
370 
376  protected $_iNewsRealStatus = null;
377 
383  protected $_aBlockRedirectParams = array('fnc', 'stoken', 'force_sid', 'force_admin_sid');
384 
390  protected $_oRootVendor = null;
391 
397  protected $_sVendorId = null;
398 
404  protected $_aManufacturerlist = null;
405 
411  protected $_oRootManufacturer = null;
412 
418  protected $_sManufacturerId = null;
419 
425  protected $_blNewsSubscribed = null;
426 
432  protected $_oDelAddress = null;
433 
439  protected $_sCatTreePath = null;
440 
446  protected $_aContents = array();
447 
453  protected $_blTop5Action = false;
454 
460  protected $_blBargainAction = false;
461 
467  protected $_aMustFillFields = null;
468 
474  protected $_blShowTagCloud = true;
475 
481  protected $_blRootCatChanged = false;
482 
488  protected $_aInvoiceAddress = null;
489 
495  protected $_aDeliveryAddress = null;
496 
502  protected $_sActiveUsername = null;
503 
510  protected static $_aCollectedComponentNames = null;
511 
518  protected $_blLoadComponents = true;
519 
520 
526  protected $_aSortColumns = null;
527 
533  protected function _getComponentNames()
534  {
535  if (self::$_aCollectedComponentNames === null) {
536  self::$_aCollectedComponentNames = array_merge($this->_aComponentNames, $this->_aUserComponentNames);
537 
538  // #1721: custom component handling. At the moment it is not possible to override this variable in oxubase,
539  // so we added this array to config.inc.php file
540  if (($aUserCmps = $this->getConfig()->getConfigParam('aUserComponentNames'))) {
541  self::$_aCollectedComponentNames = array_merge(self::$_aCollectedComponentNames, $aUserCmps);
542  }
543 
544  if (oxRegistry::getConfig()->getRequestParameter('_force_no_basket_cmp')) {
545  unset(self::$_aCollectedComponentNames['oxcmp_basket']);
546  }
547  }
548 
549  // resetting array pointer
550  reset(self::$_aCollectedComponentNames);
551 
553  }
554 
561  protected function _processRequest()
562  {
563  $myUtils = oxRegistry::getUtils();
564 
565  // non admin, request is not empty and was not processed by seo engine
566  if (!isSearchEngineUrl() && $myUtils->seoIsActive() && ($sStdUrl = getRequestUrl('', true))) {
567 
568  // fetching standard url and looking for it in seo table
569  if ($this->_canRedirect() && ($sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($sStdUrl))) {
570  $myUtils->redirect($this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false);
571  } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
572  // forcing to set no index/follow meta
573  $this->_forceNoIndex();
574 
575  if ($this->getConfig()->getConfigParam('blSeoLogging')) {
576  $sShopId = $this->getConfig()->getShopId();
577  $sLangId = oxRegistry::getLang()->getBaseLanguage();
578  $sIdent = md5(strtolower($sStdUrl) . $sShopId . $sLangId);
579 
580  // logging "not found" url
581  $oDb = oxDb::getDb();
582  $oDb->execute(
583  "replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )
584  values ( " . $oDb->quote($sStdUrl) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) "
585  );
586  }
587  }
588  }
589  }
590 
595  public function init()
596  {
597  $this->_processRequest();
598 
599  // storing current view
600  $blInit = true;
601 
602 
603  // init all components if there are any
604  if ($this->_blLoadComponents) {
605  foreach ($this->_getComponentNames() as $sComponentName => $blNotCacheable) {
606  // do not override initiated components
607  if (!isset($this->_oaComponents[$sComponentName])) {
608  // component objects MUST be created to support user called functions
609  $oComponent = oxNew($sComponentName);
610  $oComponent->setParent($this);
611  $oComponent->setThisAction($sComponentName);
612  $this->_oaComponents[$sComponentName] = $oComponent;
613  }
614 
615  // do we really need to initiate them ?
616  if ($blInit) {
617  $this->_oaComponents[$sComponentName]->init();
618 
619  // executing only is view does not have action method
620  if (!method_exists($this, $this->getFncName())) {
621  $this->_oaComponents[$sComponentName]->executeFunction($this->getFncName());
622  }
623  }
624  }
625  }
626 
627  parent::init();
628  }
629 
636  public function getViewId()
637  {
638  if ($this->_sViewId) {
639  return $this->_sViewId;
640  }
641 
642  $oConfig = $this->getConfig();
643  $iLang = oxRegistry::getLang()->getBaseLanguage();
644  $iCur = (int) $oConfig->getShopCurrency();
645 
646 
647  $this->_sViewId = "ox|$iLang|$iCur";
648 
649  $this->_sViewId .= "|" . ((int) $this->_blForceNoIndex) . '|' . ((int) $this->isRootCatChanged());
650 
651  // #0004798: SSL should be included in viewId
652  if ($oConfig->isSsl()) {
653  $this->_sViewId .= "|ssl";
654  }
655 
656  // #0002866: external global viewID addition
657  if (function_exists('customGetViewId')) {
658  $oExtViewId = customGetViewId();
659 
660  if ($oExtViewId !== null) {
661  $this->_sViewId .= '|' . md5(serialize($oExtViewId));
662  }
663  }
664 
665  return $this->_sViewId;
666  }
667 
668 
674  public function showSorting()
675  {
676  return $this->_blShowSorting && $this->getConfig()->getConfigParam('blShowSorting');
677  }
678 
684  public function setComponents($aComponents = null)
685  {
686  $this->_oaComponents = $aComponents;
687  }
688 
694  public function getComponents()
695  {
696  return $this->_oaComponents;
697  }
698 
706  public function getComponent($sName)
707  {
708  if (isset($sName) && isset($this->_oaComponents[$sName])) {
709  return $this->_oaComponents[$sName];
710  }
711  }
712 
718  public function setIsOrderStep($blIsOrderStep = null)
719  {
720  $this->_blIsOrderStep = $blIsOrderStep;
721  }
722 
728  public function getIsOrderStep()
729  {
730  return $this->_blIsOrderStep;
731  }
732 
733 
739  public function setActiveCategory($oCategory)
740  {
741  $this->_oActCategory = $oCategory;
742  }
743 
749  public function getActiveCategory()
750  {
751  return $this->_oActCategory;
752  }
753 
759  public function getListType()
760  {
761  if ($this->_sListType == null) {
762  if ($sListType = $this->getConfig()->getRequestParameter('listtype')) {
763  $this->_sListType = $sListType;
764  } elseif ($sListType = $this->getConfig()->getGlobalParameter('listtype')) {
765  $this->_sListType = $sListType;
766  }
767  }
768 
769  return $this->_sListType;
770  }
771 
777  public function getListDisplayType()
778  {
779  if ($this->_sListDisplayType == null) {
780  $this->_sListDisplayType = $this->getCustomListDisplayType();
781 
782  if (!$this->_sListDisplayType) {
783  $this->_sListDisplayType = $this->getConfig()->getConfigParam('sDefaultListDisplayType');
784  }
785 
786  $this->_sListDisplayType = in_array(( string ) $this->_sListDisplayType, $this->_aListDisplayTypes) ?
787  $this->_sListDisplayType : 'infogrid';
788 
789  // writing to session
790  if ($this->getConfig()->getRequestParameter('ldtype')) {
791  oxRegistry::getSession()->setVariable('ldtype', $this->_sListDisplayType);
792  }
793  }
794 
796  }
797 
803  public function getCustomListDisplayType()
804  {
805  if ($this->_sCustomListDisplayType == null) {
806  $this->_sCustomListDisplayType = $this->getConfig()->getRequestParameter('ldtype');
807 
808  if (!$this->_sCustomListDisplayType) {
809  $this->_sCustomListDisplayType = oxRegistry::getSession()->getVariable('ldtype');
810  }
811  }
812 
814  }
815 
821  public function setListType($sType)
822  {
823  $this->_sListType = $sType;
824  $this->getConfig()->setGlobalParameter('listtype', $sType);
825  }
826 
832  public function loadCurrency()
833  {
834  if ($this->_blLoadCurrency == null) {
835  $this->_blLoadCurrency = false;
836  if ($blLoadCurrency = $this->getConfig()->getConfigParam('bl_perfLoadCurrency')) {
837  $this->_blLoadCurrency = $blLoadCurrency;
838  }
839  }
840 
841  return $this->_blLoadCurrency;
842  }
843 
849  public function dontShowEmptyCategories()
850  {
851  if ($this->_blDontShowEmptyCats == null) {
852  $this->_blDontShowEmptyCats = false;
853  if ($blDontShowEmptyCats = $this->getConfig()->getConfigParam('blDontShowEmptyCategories')) {
854  $this->_blDontShowEmptyCats = $blDontShowEmptyCats;
855  }
856  }
857 
859  }
860 
866  public function showCategoryArticlesCount()
867  {
868  return $this->getConfig()->getConfigParam('bl_perfShowActionCatArticleCnt');
869  }
870 
876  public function isLanguageLoaded()
877  {
878  if ($this->_blLoadLanguage == null) {
879  $this->_blLoadLanguage = false;
880  if ($blLoadLanguage = $this->getConfig()->getConfigParam('bl_perfLoadLanguages')) {
881  $this->_blLoadLanguage = $blLoadLanguage;
882  }
883  }
884 
885  return $this->_blLoadLanguage;
886  }
887 
893  public function getTopNavigationCatCnt()
894  {
895  if ($this->_iTopCatNavItmCnt == null) {
896  $iTopCatNavItmCnt = $this->getConfig()->getConfigParam('iTopNaviCatCount');
897  $this->_iTopCatNavItmCnt = $iTopCatNavItmCnt ? $iTopCatNavItmCnt : 5;
898  }
899 
901  }
902 
910  public function addRssFeed($sTitle, $sUrl, $key = null)
911  {
912  if (!is_array($this->_aRssLinks)) {
913  $this->_aRssLinks = array();
914  }
915 
916  $sUrl = oxRegistry::get("oxUtilsUrl")->prepareUrlForNoSession($sUrl);
917 
918  if ($key === null) {
919  $this->_aRssLinks[] = array('title' => $sTitle, 'link' => $sUrl);
920  } else {
921  $this->_aRssLinks[$key] = array('title' => $sTitle, 'link' => $sUrl);
922  }
923  }
924 
930  public function getSortOrderByParameterName()
931  {
932  return 'listorderby';
933  }
934 
940  public function getSortOrderParameterName()
941  {
942  return 'listorder';
943  }
944 
945 
951  public function getSortIdent()
952  {
953  return 'alist';
954  }
955 
961  public function getDefaultSorting()
962  {
963  return null;
964  }
965 
971  public function getUserSelectedSorting()
972  {
973  $aSorting = null;
974  $oStr = getStr();
975  $oConfig = oxRegistry::getConfig();
976  $aSortDirections = array('desc', 'asc');
977 
978  $sSortBy = $oConfig->getRequestParameter($this->getSortOrderByParameterName());
979  $sSortDir = $oConfig->getRequestParameter($this->getSortOrderParameterName());
980 
981  if ($sSortBy && oxDb::getInstance()->isValidFieldName($sSortBy) && $sSortDir &&
982  oxRegistry::getUtils()->isValidAlpha($sSortDir) && in_array($oStr->strtolower($sSortDir), $aSortDirections)
983  ) {
984  $aSorting = array('sortby' => $sSortBy, 'sortdir' => $sSortDir);
985  }
986 
987  return $aSorting;
988  }
989 
990 
998  public function getSavedSorting($sSortIdent)
999  {
1000  $aSorting = oxRegistry::getSession()->getVariable('aSorting');
1001  if (isset($aSorting[$sSortIdent])) {
1002  return $aSorting[$sSortIdent];
1003  }
1004  }
1005 
1011  public function setListOrderBy($sColumn)
1012  {
1013  $this->_sListOrderBy = $sColumn;
1014  }
1015 
1021  public function setListOrderDirection($sDirection)
1022  {
1023  $this->_sListOrderDir = $sDirection;
1024  }
1025 
1031  public function getListOrderBy()
1032  {
1033  //if column is with table name split it
1034  $aColumns = explode('.', $this->_sListOrderBy);
1035 
1036  if (is_array($aColumns) && count($aColumns) > 1) {
1037  return $aColumns[1];
1038  }
1039 
1040  return $this->_sListOrderBy;
1041  }
1042 
1048  public function getListOrderDirection()
1049  {
1050  return $this->_sListOrderDir;
1051  }
1052 
1060  public function setMetaDescription($sDescription)
1061  {
1062  return $this->_sMetaDescription = $sDescription;
1063  }
1064 
1072  public function setMetaKeywords($sKeywords)
1073  {
1074  return $this->_sMetaKeywords = $sKeywords;
1075  }
1076 
1084  protected function _getMetaFromSeo($sDataType)
1085  {
1086  $sOxId = $this->_getSeoObjectId();
1087  $iLang = oxRegistry::getLang()->getBaseLanguage();
1088  $sShop = $this->getConfig()->getShopId();
1089 
1090  if ($sOxId && oxRegistry::getUtils()->seoIsActive() &&
1091  ($sKeywords = oxRegistry::get("oxSeoEncoder")->getMetaData($sOxId, $sDataType, $sShop, $iLang))
1092  ) {
1093  return $sKeywords;
1094  }
1095  }
1096 
1104  protected function _getMetaFromContent($sMetaIdent)
1105  {
1106  if ($sMetaIdent) {
1107  $oContent = oxNew('oxContent');
1108  if ($oContent->loadByIdent($sMetaIdent) &&
1109  $oContent->oxcontents__oxactive->value
1110  ) {
1111  return getStr()->strip_tags($oContent->oxcontents__oxcontent->value);
1112  }
1113  }
1114  }
1115 
1121  public function getMetaKeywords()
1122  {
1123  if ($this->_sMetaKeywords === null) {
1124  $this->_sMetaKeywords = false;
1125 
1126  // set special meta keywords ?
1127  if (($sKeywords = $this->_getMetaFromSeo('oxkeywords'))) {
1128  $this->_sMetaKeywords = $sKeywords;
1129  } elseif (($sKeywords = $this->_getMetaFromContent($this->_sMetaKeywordsIdent))) {
1130  $this->_sMetaKeywords = $this->_prepareMetaKeyword($sKeywords, false);
1131  } else {
1132  $this->_sMetaKeywords = $this->_prepareMetaKeyword(false, true);
1133  }
1134  }
1135 
1136  return $this->_sMetaKeywords;
1137  }
1138 
1144  public function getMetaDescription()
1145  {
1146  if ($this->_sMetaDescription === null) {
1147  $this->_sMetaDescription = false;
1148 
1149  // set special meta description ?
1150  if (($sDescription = $this->_getMetaFromSeo('oxdescription'))) {
1151  $this->_sMetaDescription = $sDescription;
1152  } elseif (($sDescription = $this->_getMetaFromContent($this->_sMetaDescriptionIdent))) {
1153  $this->_sMetaDescription = $this->_prepareMetaDescription($sDescription);
1154  } else {
1155  $this->_sMetaDescription = $this->_prepareMetaDescription(false);
1156  }
1157  }
1158 
1159  return $this->_sMetaDescription;
1160  }
1161 
1167  public function getActCurrency()
1168  {
1169  return $this->_oActCurrency;
1170  }
1171 
1177  public function setActCurrency($oCur)
1178  {
1179  $this->_oActCurrency = $oCur;
1180  }
1181 
1187  public function getCompareItemCount()
1188  {
1189  if ($this->_iCompItemsCnt === null) {
1190  $aItems = oxRegistry::getSession()->getVariable('aFiltcompproducts');
1191  $this->_iCompItemsCnt = is_array($aItems) ? count($aItems) : 0;
1192  }
1193 
1194  return $this->_iCompItemsCnt;
1195  }
1196 
1200  protected function _forceNoIndex()
1201  {
1202  $this->_blForceNoIndex = true;
1203  }
1204 
1211  public function noIndex()
1212  {
1213  if ($this->_blForceNoIndex) {
1214  $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
1215  } elseif ($this->getConfig()->getRequestParameter('cur')) {
1216  $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
1217  } else {
1218  switch ($this->getConfig()->getRequestParameter('fnc')) {
1219  case 'tocomparelist':
1220  case 'tobasket':
1221  $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXNOFOLLOW;
1222  break;
1223  }
1224  }
1225 
1226  return $this->_iViewIndexState;
1227  }
1228 
1234  public function getMenueList()
1235  {
1236  return $this->_aMenueList;
1237  }
1238 
1244  public function setMenueList($aMenu)
1245  {
1246  $this->_aMenueList = $aMenu;
1247  }
1248 
1252  protected function _setNrOfArtPerPage()
1253  {
1254  $myConfig = $this->getConfig();
1255 
1256  //setting default values to avoid possible errors showing article list
1257  $iNrofCatArticles = $myConfig->getConfigParam('iNrofCatArticles');
1258 
1259  $iNrofCatArticles = ($iNrofCatArticles) ? $iNrofCatArticles : 10;
1260 
1261  // checking if all needed data is set
1262  switch ($this->getListDisplayType()) {
1263  case 'grid':
1264  $aNrofCatArticles = $myConfig->getConfigParam('aNrofCatArticlesInGrid');
1265  break;
1266  case 'line':
1267  case 'infogrid':
1268  default:
1269  $aNrofCatArticles = $myConfig->getConfigParam('aNrofCatArticles');
1270  }
1271 
1272  if (!is_array($aNrofCatArticles) || !isset($aNrofCatArticles[0])) {
1273  $aNrofCatArticles = array($iNrofCatArticles);
1274  $myConfig->setConfigParam('aNrofCatArticles', $aNrofCatArticles);
1275  } else {
1276  $iNrofCatArticles = $aNrofCatArticles[0];
1277  }
1278 
1279  $oViewConf = $this->getViewConfig();
1280  //value from user input
1281  $oSession = oxRegistry::getSession();
1282  if (($iNrofArticles = (int) oxRegistry::getConfig()->getRequestParameter('_artperpage'))) {
1283  // M45 Possibility to push any "Show articles per page" number parameter
1284  $iNrofCatArticles = (in_array($iNrofArticles, $aNrofCatArticles)) ? $iNrofArticles : $iNrofCatArticles;
1285  $oViewConf->setViewConfigParam('iartPerPage', $iNrofCatArticles);
1286  $oSession->setVariable('_artperpage', $iNrofCatArticles);
1287  } elseif (($iSessArtPerPage = $oSession->getVariable('_artperpage')) && is_numeric($iSessArtPerPage)) {
1288  // M45 Possibility to push any "Show articles per page" number parameter
1289  $iNrofCatArticles = (in_array($iSessArtPerPage, $aNrofCatArticles)) ? $iSessArtPerPage : $iNrofCatArticles;
1290  $oViewConf->setViewConfigParam('iartPerPage', $iSessArtPerPage);
1291  $iNrofCatArticles = $iSessArtPerPage;
1292  } else {
1293  $oViewConf->setViewConfigParam('iartPerPage', $iNrofCatArticles);
1294  }
1295 
1296  //setting number of articles per page to config value
1297  $myConfig->setConfigParam('iNrofCatArticles', $iNrofCatArticles);
1298  }
1299 
1303  protected function _getSeoObjectId()
1304  {
1305  }
1306 
1316  protected function _prepareMetaDescription($sMeta, $iLength = 1024, $blRemoveDuplicatedWords = false)
1317  {
1318  if ($sMeta) {
1319 
1320  $oStr = getStr();
1321  if ($iLength != -1) {
1322  /* *
1323  * performance - we do not need a huge amount of initial text.
1324  * assume that effective text may be double longer than $iLength
1325  * and simple truncate it
1326  */
1327  $iELength = ($iLength * 2);
1328  $sMeta = $oStr->substr($sMeta, 0, $iELength);
1329  }
1330 
1331  // decoding html entities
1332  $sMeta = $oStr->html_entity_decode($sMeta);
1333  // stripping HTML tags
1334  $sMeta = $oStr->strip_tags($sMeta);
1335 
1336  // removing some special chars
1337  $sMeta = $oStr->cleanStr($sMeta);
1338 
1339  // removing duplicate words
1340  if ($blRemoveDuplicatedWords) {
1341  $sMeta = $this->_removeDuplicatedWords($sMeta, $this->getConfig()->getConfigParam('aSkipTags'));
1342  }
1343 
1344  // some special cases
1345  $sMeta = str_replace(' ,', ',', $sMeta);
1346  $aPattern = array("/,[\s\+\-\*]*,/", "/\s+,/");
1347  $sMeta = $oStr->preg_replace($aPattern, ',', $sMeta);
1348  $sMeta = oxRegistry::get("oxUtilsString")->minimizeTruncateString($sMeta, $iLength);
1349  $sMeta = $oStr->htmlspecialchars($sMeta);
1350 
1351  return trim($sMeta);
1352  }
1353  }
1354 
1363  protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
1364  {
1365 
1366  $sString = $this->_prepareMetaDescription($sKeywords, -1, false);
1367 
1368  if ($blRemoveDuplicatedWords) {
1369  $sString = $this->_removeDuplicatedWords($sString, $this->getConfig()->getConfigParam('aSkipTags'));
1370  }
1371 
1372  return trim($sString);
1373  }
1374 
1383  protected function _removeDuplicatedWords($aInput, $aSkipTags = array())
1384  {
1385  $oStr = getStr();
1386  if (is_array($aInput)) {
1387  $aInput = implode(" ", $aInput);
1388  }
1389 
1390  // removing some usually met characters..
1391  $aInput = $oStr->preg_replace("/[" . preg_quote($this->_sRemoveMetaChars, "/") . "]/", " ", $aInput);
1392 
1393  // splitting by word
1394  $aStrings = $oStr->preg_split("/[\s,]+/", $aInput);
1395 
1396  if ($sCount = count($aSkipTags)) {
1397  for ($iNum = 0; $iNum < $sCount; $iNum++) {
1398  $aSkipTags[$iNum] = $oStr->strtolower($aSkipTags[$iNum]);
1399  }
1400  }
1401  $sCount = count($aStrings);
1402  for ($iNum = 0; $iNum < $sCount; $iNum++) {
1403  $aStrings[$iNum] = $oStr->strtolower($aStrings[$iNum]);
1404  // removing in admin defined strings
1405  if (!$aStrings[$iNum] || in_array($aStrings[$iNum], $aSkipTags)) {
1406  unset($aStrings[$iNum]);
1407  }
1408  }
1409 
1410  // duplicates
1411  return implode(', ', array_unique($aStrings));
1412  }
1413 
1421  public function getNavigationParams()
1422  {
1423  $oConfig = $this->getConfig();
1424  $aParams['cnid'] = $this->getCategoryId();
1425  $aParams['mnid'] = $oConfig->getRequestParameter('mnid');
1426 
1427  $aParams['listtype'] = $this->getListType();
1428  $aParams['ldtype'] = $this->getCustomListDisplayType();
1429  $aParams['actcontrol'] = $this->getClassName();
1430 
1431  $aParams['recommid'] = $oConfig->getRequestParameter('recommid');
1432 
1433  $aParams['searchrecomm'] = $oConfig->getRequestParameter('searchrecomm', true);
1434  $aParams['searchparam'] = $oConfig->getRequestParameter('searchparam', true);
1435  $aParams['searchtag'] = $oConfig->getRequestParameter('searchtag', true);
1436 
1437  $aParams['searchvendor'] = $oConfig->getRequestParameter('searchvendor');
1438  $aParams['searchcnid'] = $oConfig->getRequestParameter('searchcnid');
1439  $aParams['searchmanufacturer'] = $oConfig->getRequestParameter('searchmanufacturer');
1440 
1441  return $aParams;
1442  }
1443 
1451  public function setItemSorting($sSortIdent, $sSortBy, $sSortDir = null)
1452  {
1453  $aSorting = oxRegistry::getSession()->getVariable('aSorting');
1454  $aSorting[$sSortIdent]['sortby'] = $sSortBy;
1455  $aSorting[$sSortIdent]['sortdir'] = $sSortDir ? $sSortDir : null;
1456 
1457  oxRegistry::getSession()->setVariable('aSorting', $aSorting);
1458  }
1459 
1467  public function getSorting($sSortIdent)
1468  {
1469  $aSorting = null;
1470 
1471  if ($aSorting = $this->getUserSelectedSorting()) {
1472  $this->setItemSorting($sSortIdent, $aSorting['sortby'], $aSorting['sortdir']);
1473  } elseif (!$aSorting = $this->getSavedSorting($sSortIdent)) {
1474  $aSorting = $this->getDefaultSorting();
1475  }
1476 
1477  if ($aSorting) {
1478  $this->setListOrderBy($aSorting['sortby']);
1479  $this->setListOrderDirection($aSorting['sortdir']);
1480  }
1481 
1482  return $aSorting;
1483  }
1484 
1492  public function getSortingSql($sIdent)
1493  {
1494  $aSorting = $this->getSorting($sIdent);
1495  if (is_array($aSorting)) {
1496  return implode(" ", $aSorting);
1497  }
1498  }
1499 
1505  public function getTitleSuffix()
1506  {
1507  return $this->getConfig()->getActiveShop()->oxshops__oxtitlesuffix->value;
1508  }
1509 
1513  public function getTitlePageSuffix()
1514  {
1515  }
1516 
1522  public function getTitlePrefix()
1523  {
1524  return $this->getConfig()->getActiveShop()->oxshops__oxtitleprefix->value;
1525  }
1526 
1527 
1533  public function getPageTitle()
1534  {
1535  $sTitle = '';
1536 
1537  $aTitleParts = array();
1538  $aTitleParts[] = $this->getTitlePrefix();
1539  $aTitleParts[] = $this->getTitle();
1540  $aTitleParts[] = $this->getTitleSuffix();
1541  $aTitleParts[] = $this->getTitlePageSuffix();
1542 
1543  $aTitleParts = array_filter($aTitleParts);
1544 
1545  if (count($aTitleParts)) {
1546  $sTitle = implode(' | ', $aTitleParts);
1547  }
1548 
1549 
1550  return $sTitle;
1551  }
1552 
1553 
1562  protected function _getSubject($iLang)
1563  {
1564  return null;
1565  }
1566 
1572  public function getDynUrlParams()
1573  {
1574  $sRet = '';
1575  $sListType = $this->getListType();
1576  $oConfig = $this->getConfig();
1577 
1578  switch ($sListType) {
1579  default:
1580  break;
1581  case 'search':
1582  $sRet .= "&amp;listtype={$sListType}";
1583  if ($sSearchParamForLink = rawurlencode($oConfig->getRequestParameter('searchparam', true))) {
1584  $sRet .= "&amp;searchparam={$sSearchParamForLink}";
1585  }
1586 
1587  if (($sVar = $oConfig->getRequestParameter('searchcnid', true))) {
1588  $sRet .= '&amp;searchcnid=' . rawurlencode(rawurldecode($sVar));
1589  }
1590  if (($sVar = $oConfig->getRequestParameter('searchvendor', true))) {
1591  $sRet .= '&amp;searchvendor=' . rawurlencode(rawurldecode($sVar));
1592  }
1593  if (($sVar = $oConfig->getRequestParameter('searchmanufacturer', true))) {
1594  $sRet .= '&amp;searchmanufacturer=' . rawurlencode(rawurldecode($sVar));
1595  }
1596  break;
1597  case 'tag':
1598  $sRet .= "&amp;listtype={$sListType}";
1599  if ($sParam = rawurlencode($oConfig->getRequestParameter('searchtag', true))) {
1600  $sRet .= "&amp;searchtag={$sParam}";
1601  }
1602  break;
1603  }
1604 
1605  return $sRet;
1606  }
1607 
1615  public function getBaseLink($iLang = null)
1616  {
1617  if (!isset($iLang)) {
1618  $iLang = oxRegistry::getLang()->getBaseLanguage();
1619  }
1620 
1621  $oConfig = $this->getConfig();
1622 
1623  if (oxRegistry::getUtils()->seoIsActive()) {
1624  if ($oDisplayObj = $this->_getSubject($iLang)) {
1625  $sUrl = $oDisplayObj->getLink($iLang);
1626  } else {
1627  $oEncoder = oxRegistry::get("oxSeoEncoder");
1628  $sConstructedUrl = $oConfig->getShopHomeURL($iLang) . $this->_getSeoRequestParams();
1629  $sUrl = $oEncoder->getStaticUrl($sConstructedUrl, $iLang);
1630  }
1631  }
1632 
1633  if (!$sUrl) {
1634  $sConstructedUrl = $oConfig->getShopCurrentURL($iLang) . $this->_getRequestParams();
1635  $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl($sConstructedUrl, true, null, $iLang);
1636  }
1637 
1638  return $sUrl;
1639  }
1640 
1641 
1649  public function getLink($iLang = null)
1650  {
1651  return $this->_addPageNrParam($this->getBaseLink($iLang), $this->getActPage(), $iLang);
1652  }
1653 
1657  public function getCanonicalUrl()
1658  {
1659  }
1660 
1667  public function getSimilarRecommListIds()
1668  {
1669  return false;
1670  }
1671 
1676  public function getSearchParamForHtml()
1677  {
1678  }
1679 
1687  protected function _getRequestParams($blAddPageNr = true)
1688  {
1689  $sClass = $this->getClassName();
1690  $sFnc = $this->getFncName();
1691 
1692  $aFnc = array('tobasket', 'login_noredirect', 'addVoucher', 'moveleft', 'moveright');
1693  if (in_array($sFnc, $aFnc)) {
1694  $sFnc = '';
1695  }
1696 
1697  // #680
1698  $sURL = "cl={$sClass}";
1699  if ($sFnc) {
1700  $sURL .= "&amp;fnc={$sFnc}";
1701  }
1702  if ($sVal = oxRegistry::getConfig()->getRequestParameter('cnid')) {
1703  $sURL .= "&amp;cnid={$sVal}";
1704  }
1705  if ($sVal = oxRegistry::getConfig()->getRequestParameter('mnid')) {
1706  $sURL .= "&amp;mnid={$sVal}";
1707  }
1708  if ($sVal = oxRegistry::getConfig()->getRequestParameter('anid')) {
1709  $sURL .= "&amp;anid={$sVal}";
1710  }
1711 
1712  if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('page'))) {
1713  $sURL .= "&amp;page={$sVal}";
1714  }
1715 
1716  if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('tpl'))) {
1717  $sURL .= "&amp;tpl={$sVal}";
1718  }
1719 
1720  if ($sVal = oxRegistry::getConfig()->getRequestParameter('oxloadid')) {
1721  $sURL .= "&amp;oxloadid={$sVal}";
1722  }
1723 
1724  $iPgNr = (int) oxRegistry::getConfig()->getRequestParameter('pgNr');
1725  // don't include page number for navigation
1726  // it will be done in oxubase::generatePageNavigation
1727  if ($blAddPageNr && $iPgNr > 0) {
1728  $sURL .= "&amp;pgNr={$iPgNr}";
1729  }
1730 
1731  // #1184M - specialchar search
1732  if ($sVal = rawurlencode(oxRegistry::getConfig()->getRequestParameter('searchparam', true))) {
1733  $sURL .= "&amp;searchparam={$sVal}";
1734  }
1735 
1736  if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchcnid')) {
1737  $sURL .= "&amp;searchcnid={$sVal}";
1738  }
1739 
1740  if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchvendor')) {
1741  $sURL .= "&amp;searchvendor={$sVal}";
1742  }
1743 
1744  if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchmanufacturer')) {
1745  $sURL .= "&amp;searchmanufacturer={$sVal}";
1746  }
1747 
1748  if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchrecomm')) {
1749  $sURL .= "&amp;searchrecomm={$sVal}";
1750  }
1751 
1752  if ($sVal = oxRegistry::getConfig()->getRequestParameter('searchtag')) {
1753  $sURL .= "&amp;searchtag={$sVal}";
1754  }
1755 
1756  if ($sVal = oxRegistry::getConfig()->getRequestParameter('recommid')) {
1757  $sURL .= "&amp;recommid={$sVal}";
1758  }
1759 
1760  return $sURL;
1761  }
1762 
1768  protected function _getSeoRequestParams()
1769  {
1770  $sClass = $this->getClassName();
1771  $sFnc = $this->getFncName();
1772 
1773  // #921 S
1774  $aFnc = array('tobasket', 'login_noredirect', 'addVoucher');
1775  if (in_array($sFnc, $aFnc)) {
1776  $sFnc = '';
1777  }
1778 
1779  // #680
1780  $sURL = "cl={$sClass}";
1781  if ($sFnc) {
1782  $sURL .= "&amp;fnc={$sFnc}";
1783  }
1784  if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('page'))) {
1785  $sURL .= "&amp;page={$sVal}";
1786  }
1787 
1788  if ($sVal = basename(oxRegistry::getConfig()->getRequestParameter('tpl'))) {
1789  $sURL .= "&amp;tpl={$sVal}";
1790  }
1791 
1792  if ($sVal = oxRegistry::getConfig()->getRequestParameter('oxloadid')) {
1793  $sURL .= "&amp;oxloadid={$sVal}";
1794  }
1795 
1796  $iPgNr = (int) oxRegistry::getConfig()->getRequestParameter('pgNr');
1797  if ($iPgNr > 0) {
1798  $sURL .= "&amp;pgNr={$iPgNr}";
1799  }
1800 
1801  return $sURL;
1802  }
1803 
1809  public function showSearch()
1810  {
1811  $blShow = true;
1812  if ($this->getConfig()->getConfigParam('blDisableNavBars') && $this->getIsOrderStep()) {
1813  $blShow = false;
1814  }
1815 
1816  return (int) $blShow;
1817  }
1818 
1824  public function getRssLinks()
1825  {
1826  return $this->_aRssLinks;
1827  }
1828 
1834  public function getSortColumns()
1835  {
1836  if ($this->_aSortColumns === null) {
1837  $this->setSortColumns($this->getConfig()->getConfigParam('aSortCols'));
1838  }
1839 
1840  return $this->_aSortColumns;
1841  }
1842 
1843 
1849  public function setSortColumns($aSortColumns)
1850  {
1851  $this->_aSortColumns = $aSortColumns;
1852  }
1853 
1857  public function getEditTags()
1858  {
1859  }
1860 
1864  public function getRecommSearch()
1865  {
1866  }
1867 
1871  public function getPaymentList()
1872  {
1873  }
1874 
1880  public function getActiveRecommList()
1881  {
1882  if ($this->_oActiveRecommList === null) {
1883  $this->_oActiveRecommList = false;
1884  if ($sOxId = $this->getConfig()->getRequestParameter('recommid')) {
1885  $this->_oActiveRecommList = oxNew('oxrecommlist');
1886  $this->_oActiveRecommList->load($sOxId);
1887  }
1888  }
1889 
1891  }
1892 
1896  public function getAccessoires()
1897  {
1898  }
1899 
1903  public function getCrossSelling()
1904  {
1905  }
1906 
1910  public function getSimilarProducts()
1911  {
1912  }
1913 
1917  public function getAlsoBoughtTheseProducts()
1918  {
1919  }
1920 
1924  public function getArticleId()
1925  {
1926  }
1927 
1933  public function getTitle()
1934  {
1935  $oLang = oxRegistry::getLang();
1936  $sTranslationName = 'PAGE_TITLE_' . strtoupper($this->getConfig()->getActiveView()->getClassName());
1937  $sTranslated = $oLang->translateString($sTranslationName, oxRegistry::getLang()->getBaseLanguage(), false);
1938 
1939  return $sTranslationName == $sTranslated ? null : $sTranslated;
1940  }
1941 
1948  public function getActiveLangAbbr()
1949  {
1950  if (!isset($this->_sActiveLangAbbr)) {
1951  $languageService = oxRegistry::getLang();
1952  if ($this->getConfig()->getConfigParam('bl_perfLoadLanguages')) {
1953  $languages = $languageService->getLanguageArray();
1954  while (list($key, $language) = each($languages)) {
1955  if ($language->selected) {
1956  $this->_sActiveLangAbbr = $language->abbr;
1957  break;
1958  }
1959  }
1960  } else {
1961  // Performance
1962  // use oxid shop internal languageAbbr, this might be correct in the most cases but not guaranteed to be that
1963  // configured in the admin backend for that language
1964  $this->_sActiveLangAbbr = $languageService->getLanguageAbbr();
1965  }
1966  }
1967 
1968  return $this->_sActiveLangAbbr;
1969  }
1970 
1978  public function addGlobalParams($oShop = null)
1979  {
1980  $oViewConf = parent::addGlobalParams($oShop);
1981 
1982  $this->_setNrOfArtPerPage();
1983 
1984  return $oViewConf;
1985  }
1986 
1992  public function getAdditionalParams()
1993  {
1994  if ($this->_sAdditionalParams === null) {
1995  // #1018A
1996  $this->_sAdditionalParams = parent::getAdditionalParams();
1997  $this->_sAdditionalParams .= 'cl=' . $this->getConfig()->getTopActiveView()->getClassName();
1998 
1999  // #1834M - specialchar search
2000  $sSearchParamForLink = rawurlencode(oxRegistry::getConfig()->getRequestParameter('searchparam', true));
2001  if (isset($sSearchParamForLink)) {
2002  $this->_sAdditionalParams .= "&amp;searchparam={$sSearchParamForLink}";
2003  }
2004  if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchtag'))) {
2005  $this->_sAdditionalParams .= '&amp;searchtag=' . rawurlencode(rawurldecode($sVar));
2006  }
2007  if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchcnid'))) {
2008  $this->_sAdditionalParams .= '&amp;searchcnid=' . rawurlencode(rawurldecode($sVar));
2009  }
2010  if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchvendor'))) {
2011  $this->_sAdditionalParams .= '&amp;searchvendor=' . rawurlencode(rawurldecode($sVar));
2012  }
2013  if (($sVar = oxRegistry::getConfig()->getRequestParameter('searchmanufacturer'))) {
2014  $this->_sAdditionalParams .= '&amp;searchmanufacturer=' . rawurlencode(rawurldecode($sVar));
2015  }
2016  if (($sVar = oxRegistry::getConfig()->getRequestParameter('cnid'))) {
2017  $this->_sAdditionalParams .= '&amp;cnid=' . rawurlencode(rawurldecode($sVar));
2018  }
2019  if (($sVar = oxRegistry::getConfig()->getRequestParameter('mnid'))) {
2020  $this->_sAdditionalParams .= '&amp;mnid=' . rawurlencode(rawurldecode($sVar));
2021  }
2022  }
2023 
2025  }
2026 
2032  public function generatePageNavigationUrl()
2033  {
2034  return $this->getConfig()->getShopHomeURL() . $this->_getRequestParams(false);
2035  }
2036 
2046  protected function _addPageNrParam($sUrl, $iPage, $iLang = null)
2047  {
2048  if ($iPage) {
2049  if ((strpos($sUrl, 'pgNr='))) {
2050  $sUrl = preg_replace('/pgNr=[0-9]*/', 'pgNr=' . $iPage, $sUrl);
2051  } else {
2052  $sUrl .= ((strpos($sUrl, '?') === false) ? '?' : '&amp;') . 'pgNr=' . $iPage;
2053  }
2054  } else {
2055  $sUrl = preg_replace('/pgNr=[0-9]*/', '', $sUrl);
2056  $sUrl = preg_replace('/\&amp\;\&amp\;/', '&amp;', $sUrl);
2057  $sUrl = preg_replace('/\?\&amp\;/', '?', $sUrl);
2058  $sUrl = preg_replace('/\&amp\;$/', '', $sUrl);
2059  }
2060 
2061  return $sUrl;
2062  }
2063 
2067  public function getPageNavigation()
2068  {
2069 
2070  }
2071 
2079  public function getPageNavigationLimitedTop($iPositionCount = 7)
2080  {
2081  $this->_oPageNavigation = $this->generatePageNavigation($iPositionCount);
2082 
2083  return $this->_oPageNavigation;
2084  }
2085 
2093  public function getPageNavigationLimitedBottom($iPositionCount = 11)
2094  {
2095  $this->_oPageNavigation = $this->generatePageNavigation($iPositionCount);
2096 
2097  return $this->_oPageNavigation;
2098  }
2099 
2100 
2108  public function generatePageNavigation($iPositionCount = 0)
2109  {
2110  startProfile('generatePageNavigation');
2111 
2112  $pageNavigation = new stdClass();
2113 
2114  $pageNavigation->NrOfPages = $this->_iCntPages;
2115  $iActPage = $this->getActPage();
2116  $pageNavigation->actPage = $iActPage + 1;
2117  $sUrl = $this->generatePageNavigationUrl();
2118 
2119  if ($iPositionCount == 0 || ($iPositionCount >= $pageNavigation->NrOfPages)) {
2120  $iStartNo = 2;
2121  $iFinishNo = $pageNavigation->NrOfPages;
2122  } else {
2123  $iTmpVal = $iPositionCount - 3;
2124  $iTmpVal2 = floor(($iPositionCount - 4) / 2);
2125 
2126  // actual page is at the start
2127  if ($pageNavigation->actPage <= $iTmpVal) {
2128  $iStartNo = 2;
2129  $iFinishNo = $iTmpVal + 1;
2130  // actual page is at the end
2131  } elseif ($pageNavigation->actPage >= $pageNavigation->NrOfPages - $iTmpVal) {
2132  $iStartNo = $pageNavigation->NrOfPages - $iTmpVal;
2133  $iFinishNo = $pageNavigation->NrOfPages - 1;
2134  // actual page is in the middle
2135  } else {
2136  $iStartNo = $pageNavigation->actPage - $iTmpVal2;
2137  $iFinishNo = $pageNavigation->actPage + $iTmpVal2;
2138  }
2139  }
2140 
2141  if ($iActPage > 0) {
2142  $pageNavigation->previousPage = $this->_addPageNrParam($sUrl, $iActPage - 1);
2143  }
2144 
2145  if ($iActPage < $pageNavigation->NrOfPages - 1) {
2146  $pageNavigation->nextPage = $this->_addPageNrParam($sUrl, $iActPage + 1);
2147  }
2148 
2149  if ($pageNavigation->NrOfPages > 1) {
2150 
2151  for ($i = 1; $i < $pageNavigation->NrOfPages + 1; $i++) {
2152 
2153  if ($i == 1 || $i == $pageNavigation->NrOfPages || ($i >= $iStartNo && $i <= $iFinishNo)) {
2154  $page = new stdClass();
2155  $page->url = $this->_addPageNrParam($sUrl, $i - 1);
2156  $page->selected = ($i == $pageNavigation->actPage) ? 1 : 0;
2157  $pageNavigation->changePage[$i] = $page;
2158  }
2159  }
2160 
2161  // first/last one
2162  $pageNavigation->firstpage = $this->_addPageNrParam($sUrl, 0);
2163  $pageNavigation->lastpage = $this->_addPageNrParam($sUrl, $pageNavigation->NrOfPages - 1);
2164  }
2165 
2166  stopProfile('generatePageNavigation');
2167 
2168  return $pageNavigation;
2169  }
2170 
2177  public function render()
2178  {
2179  foreach (array_keys($this->_oaComponents) as $sComponentName) {
2180  $this->_aViewData[$sComponentName] = $this->_oaComponents[$sComponentName]->render();
2181  }
2182 
2183  parent::render();
2184 
2185  if ($this->getIsOrderStep()) {
2186 
2187  // disabling navigation during order ...
2188  if ($this->getConfig()->getConfigParam('blDisableNavBars')) {
2189  $this->_iNewsRealStatus = 1;
2190  $this->setShowNewsletter(0);
2191  }
2192  }
2193 
2194  return $this->_sThisTemplate;
2195  }
2196 
2202  public function getViewProduct()
2203  {
2204  return $this->getProduct();
2205  }
2206 
2212  public function setViewProduct($oProduct)
2213  {
2214  $this->_oProduct = $oProduct;
2215  }
2216 
2222  public function getViewProductList()
2223  {
2224  return $this->_aArticleList;
2225  }
2226 
2232  public function getActPage()
2233  {
2234  if ($this->_iActPage === null) {
2235  $this->_iActPage = ( int ) $this->getConfig()->getRequestParameter('pgNr');
2236  $this->_iActPage = ($this->_iActPage < 0) ? 0 : $this->_iActPage;
2237  }
2238 
2239  return $this->_iActPage;
2240  }
2241 
2249  public function getActTag()
2250  {
2251  if ($this->_oActTag === null) {
2252  $this->_oActTag = new stdClass();
2253  $this->_oActTag->sTag = $sTag = $this->getConfig()->getRequestParameter("searchtag", 1);
2254  $oSeoEncoderTag = oxRegistry::get("oxSeoEncoderTag");
2255 
2256  $sLink = false;
2257  if (oxRegistry::getUtils()->seoIsActive()) {
2258  $sLink = $oSeoEncoderTag->getTagUrl($sTag, oxRegistry::getLang()->getBaseLanguage());
2259  }
2260 
2261  $sConstructedUrl = $this->getConfig()->getShopHomeURL() . $oSeoEncoderTag->getStdTagUri($sTag, false);
2262  $this->_oActTag->link = $sLink ? $sLink : $sConstructedUrl;
2263  }
2264 
2265  return $this->_oActTag;
2266  }
2267 
2275  public function getActVendor()
2276  {
2277  // if active vendor is not set yet - trying to load it from request params
2278  // this may be useful when category component was unable to load active vendor
2279  // and we still need some object to mount navigation info
2280  if ($this->_oActVendor === null) {
2281  $this->_oActVendor = false;
2282  $sVendorId = $this->getConfig()->getRequestParameter('cnid');
2283  $sVendorId = $sVendorId ? str_replace('v_', '', $sVendorId) : $sVendorId;
2284  $oVendor = oxNew('oxVendor');
2285  if ($oVendor->load($sVendorId)) {
2286  $this->_oActVendor = $oVendor;
2287  }
2288  }
2289 
2290  return $this->_oActVendor;
2291  }
2292 
2300  public function getActManufacturer()
2301  {
2302  // if active Manufacturer is not set yet - trying to load it from request params
2303  // this may be useful when category component was unable to load active Manufacturer
2304  // and we still need some object to mount navigation info
2305  if ($this->_oActManufacturer === null) {
2306 
2307  $this->_oActManufacturer = false;
2308  $sManufacturerId = $this->getConfig()->getRequestParameter('mnid');
2309  $oManufacturer = oxNew('oxManufacturer');
2310  if ($oManufacturer->load($sManufacturerId)) {
2311  $this->_oActManufacturer = $oManufacturer;
2312  }
2313  }
2314 
2315  return $this->_oActManufacturer;
2316  }
2317 
2323  public function setActVendor($oVendor)
2324  {
2325  $this->_oActVendor = $oVendor;
2326  }
2327 
2333  public function setActManufacturer($oManufacturer)
2334  {
2335  $this->_oActManufacturer = $oManufacturer;
2336  }
2337 
2343  public function getActSearch()
2344  {
2345  if ($this->_oActSearch === null) {
2346  $this->_oActSearch = new stdClass();
2347  $sUrl = $this->getConfig()->getShopHomeURL();
2348  $this->_oActSearch->link = "{$sUrl}cl=search";
2349  }
2350 
2351  return $this->_oActSearch;
2352  }
2353 
2359  public function getCategoryTree()
2360  {
2361  return $this->_oCategoryTree;
2362  }
2363 
2369  public function setCategoryTree($oCatTree)
2370  {
2371  $this->_oCategoryTree = $oCatTree;
2372  }
2373 
2379  public function getManufacturerTree()
2380  {
2382  }
2383 
2389  public function setManufacturerTree($oManufacturerTree)
2390  {
2391  $this->_oManufacturerTree = $oManufacturerTree;
2392  }
2393 
2397  public function getAddUrlParams()
2398  {
2399  }
2400 
2409  public function getTop5ArticleList($iCount = null)
2410  {
2411  if ($this->_blTop5Action) {
2412  if ($this->_aTop5ArticleList === null) {
2413  $this->_aTop5ArticleList = false;
2414  $myConfig = $this->getConfig();
2415  if ($myConfig->getConfigParam('bl_perfLoadAktion')) {
2416  // top 5 articles
2417  $oArtList = oxNew('oxArticleList');
2418  $oArtList->loadTop5Articles($iCount);
2419  if ($oArtList->count()) {
2420  $this->_aTop5ArticleList = $oArtList;
2421  }
2422  }
2423  }
2424  }
2425 
2426  return $this->_aTop5ArticleList;
2427  }
2428 
2435  public function getBargainArticleList()
2436  {
2437  if ($this->_blBargainAction) {
2438  if ($this->_aBargainArticleList === null) {
2439  $this->_aBargainArticleList = array();
2440  if ($this->getConfig()->getConfigParam('bl_perfLoadAktion')) {
2441  $oArtList = oxNew('oxArticleList');
2442  $oArtList->loadActionArticles('OXBARGAIN');
2443  if ($oArtList->count()) {
2444  $this->_aBargainArticleList = $oArtList;
2445  }
2446  }
2447  }
2448  }
2449 
2451  }
2452 
2461  public function isLowOrderPrice()
2462  {
2463  if ($this->_blLowOrderPrice === null && ($oBasket = $this->getSession()->getBasket())) {
2464  $this->_blLowOrderPrice = $oBasket->isBelowMinOrderPrice();
2465  }
2466 
2467  return $this->_blLowOrderPrice;
2468  }
2469 
2477  public function getMinOrderPrice()
2478  {
2479  if ($this->_sMinOrderPrice === null && $this->isLowOrderPrice()) {
2480  $dMinOrderPrice = oxPrice::getPriceInActCurrency($this->getConfig()->getConfigParam('iMinOrderPrice'));
2481  $this->_sMinOrderPrice = oxRegistry::getLang()->formatCurrency($dMinOrderPrice);
2482  }
2483 
2484  return $this->_sMinOrderPrice;
2485  }
2486 
2492  public function getNewsRealStatus()
2493  {
2494  return $this->_iNewsRealStatus;
2495  }
2496 
2502  protected function _canRedirect()
2503  {
2504  foreach ($this->_aBlockRedirectParams as $sParam) {
2505  if ($this->getConfig()->getRequestParameter($sParam) !== null) {
2506  return false;
2507  }
2508  }
2509 
2510  return true;
2511  }
2512 
2516  public function getProduct()
2517  {
2518  }
2519 
2525  public function getManufacturerlist()
2526  {
2528  }
2529 
2535  public function setManufacturerlist($aList)
2536  {
2537  $this->_aManufacturerlist = $aList;
2538  }
2539 
2545  public function setRootVendor($oVendor)
2546  {
2547  $this->_oRootVendor = $oVendor;
2548  }
2549 
2555  public function getRootVendor()
2556  {
2557  return $this->_oRootVendor;
2558  }
2559 
2565  public function setRootManufacturer($oManufacturer)
2566  {
2567  $this->_oRootManufacturer = $oManufacturer;
2568  }
2569 
2575  public function getRootManufacturer()
2576  {
2578  }
2579 
2585  public function getVendorId()
2586  {
2587  if ($this->_sVendorId === null) {
2588  $this->_sVendorId = false;
2589  if (($oVendor = $this->getActVendor())) {
2590  $this->_sVendorId = $oVendor->getId();
2591  }
2592  }
2593 
2594  return $this->_sVendorId;
2595  }
2596 
2602  public function getManufacturerId()
2603  {
2604  if ($this->_sManufacturerId === null) {
2605  $this->_sManufacturerId = false;
2606  if (($oManufacturer = $this->getActManufacturer())) {
2607  $this->_sManufacturerId = $oManufacturer->getId();
2608  }
2609  }
2610 
2611  return $this->_sManufacturerId;
2612  }
2613 
2619  public function getCatMoreUrl()
2620  {
2621  return $this->getConfig()->getShopHomeURL() . 'cnid=oxmore';
2622  }
2623 
2629  public function getCatTreePath()
2630  {
2631  return $this->_sCatTreePath;
2632  }
2633 
2641  public function getContentByIdent($sIdent)
2642  {
2643  if (!isset($this->_aContents[$sIdent])) {
2644  $this->_aContents[$sIdent] = oxNew('oxContent');
2645  $this->_aContents[$sIdent]->loadByIdent($sIdent);
2646  }
2647 
2648  return $this->_aContents[$sIdent];
2649  }
2650 
2656  public function getContentCategory()
2657  {
2658  return false;
2659  }
2660 
2666  public function getMustFillFields()
2667  {
2668  if ($this->_aMustFillFields === null) {
2669  $this->_aMustFillFields = false;
2670 
2671  // passing must-be-filled-fields info
2672  $aMustFillFields = $this->getConfig()->getConfigParam('aMustFillFields');
2673  if (is_array($aMustFillFields)) {
2674  $this->_aMustFillFields = array_flip($aMustFillFields);
2675  }
2676  }
2677 
2678  return $this->_aMustFillFields;
2679  }
2680 
2688  public function isFieldRequired($sField)
2689  {
2690  if ($aMustFillFields = $this->getMustFillFields()) {
2691  if (isset($aMustFillFields[$sField])) {
2692  return true;
2693  }
2694  }
2695 
2696  return false;
2697  }
2698 
2704  public function getFormId()
2705  {
2706  if ($this->_sFormId === null) {
2707  $this->_sFormId = oxUtilsObject::getInstance()->generateUId();
2708  oxRegistry::getSession()->setVariable('sessionuformid', $this->_sFormId);
2709  }
2710 
2711  return $this->_sFormId;
2712  }
2713 
2719  public function canAcceptFormData()
2720  {
2721  if ($this->_blCanAcceptFormData === null) {
2722  $this->_blCanAcceptFormData = false;
2723 
2724  $sFormId = $this->getConfig()->getRequestParameter("uformid");
2725  $sSessionFormId = oxRegistry::getSession()->getVariable("sessionuformid");
2726 
2727  // testing if form and session ids matches
2728  if ($sFormId && $sFormId === $sSessionFormId) {
2729  $this->_blCanAcceptFormData = true;
2730  }
2731 
2732  // regenerating form data
2733  $this->getFormId();
2734  }
2735 
2736  return $this->_blCanAcceptFormData;
2737  }
2738 
2744  public function getPromoFinishedList()
2745  {
2746  if (isset($this->_oPromoFinishedList)) {
2747  return $this->_oPromoFinishedList;
2748  }
2749  $this->_oPromoFinishedList = oxNew('oxActionList');
2750  $this->_oPromoFinishedList->loadFinishedByCount(2);
2751 
2752  return $this->_oPromoFinishedList;
2753  }
2754 
2760  public function getPromoCurrentList()
2761  {
2762  if (isset($this->_oPromoCurrentList)) {
2763  return $this->_oPromoCurrentList;
2764  }
2765  $this->_oPromoCurrentList = oxNew('oxActionList');
2766  $this->_oPromoCurrentList->loadCurrent();
2767 
2768  return $this->_oPromoCurrentList;
2769  }
2770 
2776  public function getPromoFutureList()
2777  {
2778  if (isset($this->_oPromoFutureList)) {
2779  return $this->_oPromoFutureList;
2780  }
2781  $this->_oPromoFutureList = oxNew('oxActionList');
2782  $this->_oPromoFutureList->loadFutureByCount(2);
2783 
2784  return $this->_oPromoFutureList;
2785  }
2786 
2792  public function getShowPromotionList()
2793  {
2794  if (isset($this->_blShowPromotions)) {
2795  return $this->_blShowPromotions;
2796  }
2797  $this->_blShowPromotions = false;
2798  if (oxNew('oxActionList')->areAnyActivePromotions()) {
2799  $this->_blShowPromotions = (count($this->getPromoFinishedList()) + count($this->getPromoCurrentList()) +
2800  count($this->getPromoFutureList())) > 0;
2801  }
2802 
2803  return $this->_blShowPromotions;
2804  }
2805 
2811  public function isEnabledPrivateSales()
2812  {
2813  if ($this->_blEnabledPrivateSales === null) {
2814  $this->_blEnabledPrivateSales = (bool) $this->getConfig()->getConfigParam('blPsLoginEnabled');
2815  if ($this->_blEnabledPrivateSales && ($blCanPreview = oxRegistry::getUtils()->canPreview()) !== null) {
2816  $this->_blEnabledPrivateSales = !$blCanPreview;
2817  }
2818  }
2819 
2821  }
2822 
2828  public function getFieldValidationErrors()
2829  {
2830  return oxRegistry::get("oxInputValidator")->getFieldValidationErrors();
2831  }
2832 
2838  public function getBreadCrumb()
2839  {
2840  return null;
2841  }
2842 
2848  public function setRootCatChanged($blRootCatChanged)
2849  {
2850  $this->_blRootCatChanged = $blRootCatChanged;
2851  }
2852 
2858  public function isRootCatChanged()
2859  {
2860  return $this->_blRootCatChanged;
2861  }
2862 
2868  public function getInvoiceAddress()
2869  {
2870  if ($this->_aInvoiceAddress == null) {
2871  $aAddress = $this->getConfig()->getRequestParameter('invadr');
2872  if ($aAddress) {
2873  $this->_aInvoiceAddress = $aAddress;
2874  }
2875  }
2876 
2877  return $this->_aInvoiceAddress;
2878  }
2879 
2885  public function getDeliveryAddress()
2886  {
2887  if ($this->_aDeliveryAddress == null) {
2888  $oConfig = $this->getConfig();
2889  //do not show deladr if address was reloaded
2890  if (!$oConfig->getRequestParameter('reloadaddress')) {
2891  $this->_aDeliveryAddress = $oConfig->getRequestParameter('deladr');
2892  }
2893  }
2894 
2895  return $this->_aDeliveryAddress;
2896  }
2897 
2903  public function setDeliveryAddress($aDeliveryAddress)
2904  {
2905  $this->_aDeliveryAddress = $aDeliveryAddress;
2906  }
2907 
2913  public function setInvoiceAddress($aAddress)
2914  {
2915  $this->_aInvoiceAddress = $aAddress;
2916  }
2917 
2923  public function getActiveUsername()
2924  {
2925  if ($this->_sActiveUsername == null) {
2926  $this->_sActiveUsername = false;
2927  $sUsername = $this->getConfig()->getRequestParameter('lgn_usr');
2928  if ($sUsername) {
2929  $this->_sActiveUsername = $sUsername;
2930  } elseif ($oUser = $this->getUser()) {
2931  $this->_sActiveUsername = $oUser->oxuser__oxusername->value;
2932  }
2933  }
2934 
2935  return $this->_sActiveUsername;
2936  }
2937 
2943  public function getWishlistUserId()
2944  {
2945  return $this->getConfig()->getRequestParameter('wishid');
2946  }
2947 
2951  public function getSearchCatId()
2952  {
2953  }
2954 
2958  public function getSearchVendor()
2959  {
2960  }
2961 
2965  public function getSearchManufacturer()
2966  {
2967  }
2968 
2972  public function getLastProducts()
2973  {
2974 
2975  }
2976 
2982  public function getNewBasketItemMsgType()
2983  {
2984  return (int) $this->getConfig()->getConfigParam("iNewBasketItemMessage");
2985  }
2986 
2994  public function isActive($sName)
2995  {
2996  return $this->getConfig()->getConfigParam("bl" . $sName . "Enabled");
2997  }
2998 
3004  public function isFbWidgetVisible()
3005  {
3006  if ($this->_blFbWidgetsOn === null) {
3007  $oUtils = oxRegistry::get("oxUtilsServer");
3008 
3009  // reading ..
3010  $this->_blFbWidgetsOn = (bool) $oUtils->getOxCookie("fbwidgetson");
3011  }
3012 
3013  return $this->_blFbWidgetsOn;
3014  }
3015 
3021  public function isEnabledDownloadableFiles()
3022  {
3023  return (bool) $this->getConfig()->getConfigParam("blEnableDownloads");
3024  }
3025 
3031  public function showRememberMe()
3032  {
3033  return (bool) $this->getConfig()->getConfigParam('blShowRememberMe');
3034  }
3035 
3042  public function isVatIncluded()
3043  {
3044  $blResult = true;
3045  $oUser = $this->getUser();
3046  $oConfig = $this->getConfig();
3047 
3048  $blShowNetPriceParameter = $oConfig->getConfigParam('blShowNetPrice');
3049  $blPerfCalcVatOnlyForBasketOrderParameter = $oConfig->getConfigParam('bl_perfCalcVatOnlyForBasketOrder');
3050  if ($blShowNetPriceParameter || $blPerfCalcVatOnlyForBasketOrderParameter) {
3051  $blResult = false;
3052  } elseif ($oUser && $oUser->isPriceViewModeNetto()) {
3053  $blResult = false;
3054  }
3055 
3056  return $blResult;
3057  }
3058 
3064  public function isPriceCalculated()
3065  {
3066  return (bool) $this->getConfig()->getConfigParam('bl_perfLoadPrice');
3067  }
3068 
3074  public function showTags()
3075  {
3076  return (bool) $this->_blShowTagCloud && $this->getConfig()->getConfigParam("blShowTags");
3077  }
3078 
3084  public function getWishlistName()
3085  {
3086  if ($this->getUser()) {
3087  $sWishId = $this->getConfig()->getRequestParameter('wishid');
3088  $sUserId = ($sWishId) ? $sWishId : oxRegistry::getSession()->getVariable('wishid');
3089  if ($sUserId) {
3090  $oWishUser = oxNew('oxUser');
3091  if ($oWishUser->load($sUserId)) {
3092  return $oWishUser;
3093  }
3094  }
3095  }
3096 
3097  return false;
3098  }
3099 
3105  public function getWidgetLink()
3106  {
3107  return oxRegistry::getConfig()->getWidgetUrl();
3108  }
3109 }