OXID eShop CE  4.10.2
 All Classes Namespaces Files Functions Variables Pages
details.php
Go to the documentation of this file.
1 <?php
2 
9 class Details extends oxUBase
10 {
11 
17  protected $_sThisTemplate = 'page/details/details.tpl';
18 
24  protected $_oParentProd = null;
25 
33  protected $_blEditTags = null;
34 
42  protected $_aTags = null;
43 
51  protected $_oCaptcha = null;
52 
58  protected $_sParentName = null;
59 
65  protected $_sParentUrl = null;
66 
72  protected $_aPicGallery = null;
73 
79  protected $_aSelectLists = null;
80 
86  protected $_aReviews = null;
87 
93  protected $_oCrossSelling = null;
94 
100  protected $_oSimilarProducts = null;
101 
107  protected $_oAccessoires = null;
108 
114  protected $_aAlsoBoughtArts = null;
115 
121  protected $_sSearchTitle = null;
122 
129  protected $_blIsInitialized = false;
130 
136  protected $_iLinkType = null;
137 
143  protected $_sBidPrice = null;
144 
150  protected $_iPriceAlarmStatus = null;
151 
157  protected $_sSearchParamForHtml = null;
158 
166  protected $_aSimilarRecommListIds = null;
167 
168 
174  protected $_blShowSorting = true;
175 
183  protected function _getParentProduct($sParentId)
184  {
185  if ($sParentId && $this->_oParentProd === null) {
186  $this->_oParentProd = false;
187  $oProduct = oxNew('oxArticle');
188  if (($oProduct->load($sParentId))) {
189  $this->_processProduct($oProduct);
190  $this->_oParentProd = $oProduct;
191  }
192  }
193 
194  return $this->_oParentProd;
195  }
196 
202  protected function _getAddUrlParams()
203  {
204  if ($this->getListType() == "search") {
205  return $this->getDynUrlParams();
206  }
207  }
208 
217  public function getNavigationParams()
218  {
219  $aParams = parent::getNavigationParams();
220 
221  $aVarSelParams = oxRegistry::getConfig()->getRequestParameter('varselid');
222  $aSelectListParams = oxRegistry::getConfig()->getRequestParameter('sel');
223  if (!$aVarSelParams && !$aSelectListParams) {
224  return $aParams;
225  }
226 
227  if ($aVarSelParams) {
228  foreach ($aVarSelParams as $iKey => $sValue) {
229  $aParams["varselid[$iKey]"] = $sValue;
230  }
231  }
232 
233  if ($aSelectListParams) {
234  foreach ($aSelectListParams as $iKey => $sValue) {
235  $aParams["sel[$iKey]"] = $sValue;
236  }
237  }
238 
239  return $aParams;
240  }
241 
242 
248  protected function _processProduct($oProduct)
249  {
250  $oProduct->setLinkType($this->getLinkType());
251  if ($sAddParams = $this->_getAddUrlParams()) {
252  $oProduct->appendLink($sAddParams);
253  }
254  }
255 
261  public function getViewId()
262  {
263  if (isset($this->_sViewId)) {
264  return $this->_sViewId;
265  }
266 
267  $sViewId = parent::getViewId() . '|' . $this->getConfig()->getRequestParameter('anid') . '|';
268 
269 
270  return $this->_sViewId = $sViewId;
271  }
272 
273 
285  public function render()
286  {
287  $myConfig = $this->getConfig();
288 
289  $oProduct = $this->getProduct();
290 
291  // assign template name
292  if ($oProduct->oxarticles__oxtemplate->value) {
293  $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
294  }
295 
296  if (($sTplName = oxRegistry::getConfig()->getRequestParameter('tpl'))) {
297  $this->_sThisTemplate = 'custom/' . basename($sTplName);
298  }
299 
300  parent::render();
301 
302  $sPartial = $this->getConfig()->getRequestParameter('renderPartial');
303  $this->addTplParam('renderPartial', $sPartial);
304 
305  switch ($sPartial) {
306  case "productInfo":
307  return 'page/details/ajax/fullproductinfo.tpl';
308  break;
309  case "detailsMain":
310  return 'page/details/ajax/productmain.tpl';
311  break;
312  default:
313  // can not be removed, as it is used for breadcrumb loading
314  $oLocator = oxNew('oxLocator', $this->getListType());
315  $oLocator->setLocatorData($oProduct, $this);
316 
317  // @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
318  if ($myConfig->getConfigParam('bl_rssRecommLists') && $this->getSimilarRecommListIds()) {
319  $oRss = oxNew('oxRssFeed');
320  $sTitle = $oRss->getRecommListsTitle($oProduct);
321  $sUrl = $oRss->getRecommListsUrl($oProduct);
322  $this->addRssFeed($sTitle, $sUrl, 'recommlists');
323  }
324  // END deprecated
325 
326  return $this->_sThisTemplate;
327  }
328  }
329 
341  protected function _prepareMetaDescription($sMeta, $iLength = 200, $blDescTag = false)
342  {
343  if (!$sMeta) {
344  $oProduct = $this->getProduct();
345 
346  if ($this->getConfig()->getConfigParam('bl_perfParseLongDescinSmarty')) {
347  $sMeta = $oProduct->getLongDesc();
348  } else {
349  $sMeta = $oProduct->getLongDescription()->value;
350  }
351  if ($sMeta == '') {
352  $sMeta = $oProduct->oxarticles__oxshortdesc->value;
353  }
354  $sMeta = $oProduct->oxarticles__oxtitle->value . ' - ' . $sMeta;
355  }
356 
357  return parent::_prepareMetaDescription($sMeta, $iLength, $blDescTag);
358  }
359 
370  protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
371  {
372  if (!$sKeywords) {
373  $oProduct = $this->getProduct();
374  $sKeywords = trim($this->getTitle());
375 
376  if ($oCatTree = $this->getCategoryTree()) {
377  foreach ($oCatTree->getPath() as $oCat) {
378  $sKeywords .= ", " . trim($oCat->oxcategories__oxtitle->value);
379  }
380  }
381 
382  //adding search keys info
383  if ($sSearchKeys = trim($oProduct->oxarticles__oxsearchkeys->value)) {
384  $sKeywords .= ", " . $sSearchKeys;
385  }
386 
387  $sKeywords = parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
388  }
389 
390  return $sKeywords;
391  }
392 
398  public function saveReview()
399  {
400  if (!oxRegistry::getSession()->checkSessionChallenge()) {
401  return;
402  }
403 
404  if ($this->canAcceptFormData() &&
405  ($oUser = $this->getUser()) && ($oProduct = $this->getProduct())
406  ) {
407 
408  $dRating = $this->getConfig()->getRequestParameter('artrating');
409  if ($dRating !== null) {
410  $dRating = (int) $dRating;
411  }
412 
413  //save rating
414  if ($dRating !== null && $dRating >= 1 && $dRating <= 5) {
415  $oRating = oxNew('oxrating');
416  if ($oRating->allowRating($oUser->getId(), 'oxarticle', $oProduct->getId())) {
417  $oRating->oxratings__oxuserid = new oxField($oUser->getId());
418  $oRating->oxratings__oxtype = new oxField('oxarticle');
419  $oRating->oxratings__oxobjectid = new oxField($oProduct->getId());
420  $oRating->oxratings__oxrating = new oxField($dRating);
421  $oRating->save();
422  $oProduct->addToRatingAverage($dRating);
423  }
424  }
425 
426  if (($sReviewText = trim(( string ) $this->getConfig()->getRequestParameter('rvw_txt', true)))) {
427  $oReview = oxNew('oxReview');
428  $oReview->oxreviews__oxobjectid = new oxField($oProduct->getId());
429  $oReview->oxreviews__oxtype = new oxField('oxarticle');
430  $oReview->oxreviews__oxtext = new oxField($sReviewText, oxField::T_RAW);
431  $oReview->oxreviews__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
432  $oReview->oxreviews__oxuserid = new oxField($oUser->getId());
433  $oReview->oxreviews__oxrating = new oxField(($dRating !== null) ? $dRating : 0);
434  $oReview->save();
435  }
436  }
437  }
438 
446  public function addToRecomm()
447  {
448  if (!oxRegistry::getSession()->checkSessionChallenge()) {
449  return;
450  }
451 
452  if (!$this->getViewConfig()->getShowListmania()) {
453  return;
454  }
455 
456  $sRecommText = trim(( string ) $this->getConfig()->getRequestParameter('recomm_txt'));
457  $sRecommList = $this->getConfig()->getRequestParameter('recomm');
458  $sArtId = $this->getProduct()->getId();
459 
460  if ($sArtId) {
461  $oRecomm = oxNew('oxrecommlist');
462  $oRecomm->load($sRecommList);
463  $oRecomm->addArticle($sArtId, $sRecommText);
464  }
465  }
466 
474  public function addTags()
475  {
476  if (!oxRegistry::getSession()->checkSessionChallenge()) {
477  return;
478  }
479 
480  $sTags = $this->getConfig()->getRequestParameter('newTags', true);
481  $sHighTag = $this->getConfig()->getRequestParameter('highTags', true);
482  if (!$sTags && !$sHighTag) {
483  return;
484  }
485  if ($sHighTag) {
486  $sTags = getStr()->html_entity_decode($sHighTag);
487  }
488  $oProduct = $this->getProduct();
489 
490  // set current user added tags for this article for later checking
491  $aTaggedProducts = oxRegistry::getSession()->getVariable("aTaggedProducts");
492  $aAddedTags = $aTaggedProducts ? $aTaggedProducts[$oProduct->getId()] : array();
493 
494  $oArticleTagList = oxNew("oxArticleTagList");
495  $oArticleTagList->load($oProduct->getId());
496  $sSeparator = $oArticleTagList->get()->getSeparator();
497  $aTags = array_unique(explode($sSeparator, $sTags));
498 
499  $aResult = $this->_addTagsToList($oArticleTagList, $aTags, $aAddedTags);
500 
501  if (!empty($aResult['tags'])) {
502  $oArticleTagList->save();
503  foreach ($aResult['tags'] as $sTag) {
504  $aAddedTags[$sTag] = 1;
505  }
506  $aTaggedProducts[$oProduct->getId()] = $aAddedTags;
507  oxRegistry::getSession()->setVariable('aTaggedProducts', $aTaggedProducts);
508  }
509  // for ajax call
510  if ($this->getConfig()->getRequestParameter('blAjax', true)) {
511  oxRegistry::getUtils()->showMessageAndExit(json_encode($aResult));
512  }
513  }
514 
526  protected function _addTagsToList($oArticleTagList, $aTags, $aAddedTags)
527  {
528  $aResult = array('tags' => array(), 'invalid' => array(), 'inlist' => array());
529 
530  foreach ($aTags as $sTag) {
531  $oTag = oxNew("oxtag", $sTag);
532  if ($aAddedTags[$oTag->get()] != 1) {
533  if ($oTag->isValid()) {
534  $oArticleTagList->addTag($oTag);
535  $aResult['tags'][] = $oTag->get();
536  } else {
537  $aResult['invalid'][] = $oTag->get();
538  }
539  } else {
540  $aResult['inlist'][] = $oTag->get();
541  }
542  }
543 
544  return $aResult;
545  }
546 
554  public function editTags()
555  {
556  if (!$this->getUser()) {
557  return;
558  }
559  $oArticleTagList = oxNew("oxArticleTagList");
560  $oArticleTagList->load($this->getProduct()->getId());
561  $oTagSet = $oArticleTagList->get();
562  $this->_aTags = $oTagSet->get();
563  $this->_blEditTags = true;
564 
565  // for ajax call
566  if ($this->getConfig()->getRequestParameter('blAjax', true)) {
567  $sCharset = oxRegistry::getLang()->translateString('charset');
568  oxRegistry::getUtils()->setHeader("Content-Type: text/html; charset=" . $sCharset);
569  $oActView = oxNew('oxubase');
570  $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
571  $oSmarty->assign('oView', $this);
572  $oSmarty->assign('oViewConf', $this->getViewConfig());
573  oxRegistry::getUtils()->showMessageAndExit(
574  $oSmarty->fetch('page/details/inc/editTags.tpl', $this->getViewId())
575  );
576  }
577  }
578 
584  public function cancelTags()
585  {
586  $oArticleTagList = oxNew("oxArticleTagList");
587  $oArticleTagList->load($this->getProduct()->getId());
588  $oTagSet = $oArticleTagList->get();
589  $this->_aTags = $oTagSet->get();
590  $this->_blEditTags = false;
591 
592  // for ajax call
593  if (oxRegistry::getConfig()->getRequestParameter('blAjax', true)) {
594  $sCharset = oxRegistry::getLang()->translateString('charset');
595  oxRegistry::getUtils()->setHeader("Content-Type: text/html; charset=" . $sCharset);
596  $oActView = oxNew('oxubase');
597  $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
598  $oSmarty->assign('oView', $this);
599  $oSmarty->assign('oViewConf', $this->getViewConfig());
600  oxRegistry::getUtils()->showMessageAndExit(
601  $oSmarty->fetch('page/details/inc/tags.tpl', $this->getViewId())
602  );
603  }
604  }
605 
611  protected function _getSeoObjectId()
612  {
613  if ($oProduct = $this->getProduct()) {
614  return $oProduct->getId();
615  }
616  }
617 
625  public function getEditTags()
626  {
627  return $this->_blEditTags;
628  }
629 
637  public function getTags()
638  {
639  return $this->_aTags;
640  }
641 
647  public function getProduct()
648  {
649  $oConfig = $this->getConfig();
650  $oUtils = oxRegistry::getUtils();
651 
652  if ($this->_oProduct === null) {
653 
654  //this option is only for lists and we must reset value
655  //as blLoadVariants = false affect "ab price" functionality
656  $oConfig->setConfigParam('blLoadVariants', true);
657 
658  $sOxid = $this->getConfig()->getRequestParameter('anid');
659 
660  // object is not yet loaded
661  $this->_oProduct = oxNew('oxarticle');
662 
663  if (!$this->_oProduct->load($sOxid)) {
664  $oUtils->redirect($oConfig->getShopHomeURL());
665  $oUtils->showMessageAndExit('');
666  }
667 
668  $sVarSelIdParameter = $this->getConfig()->getRequestParameter("varselid");
669  $aVariantSelections = $this->_oProduct->getVariantSelections($sVarSelIdParameter);
670  if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
671  $this->_oProduct = $aVariantSelections['oActiveVariant'];
672  }
673  }
674 
675  // additional checks
676  if (!$this->_blIsInitialized) {
678  }
679 
680  return $this->_oProduct;
681  }
682 
686  protected function _additionalChecksForArticle()
687  {
688  $oConfig = $this->getConfig();
689  $oUtils = oxRegistry::getUtils();
690 
691  $blContinue = true;
692  if (!$this->_oProduct->isVisible()) {
693  $blContinue = false;
694  } elseif ($this->_oProduct->oxarticles__oxparentid->value) {
695  $oParent = $this->_getParentProduct($this->_oProduct->oxarticles__oxparentid->value);
696  if (!$oParent || !$oParent->isVisible()) {
697  $blContinue = false;
698  }
699  }
700 
701  if (!$blContinue) {
702  $oUtils->redirect($oConfig->getShopHomeURL());
703  $oUtils->showMessageAndExit('');
704  }
705 
706  $this->_processProduct($this->_oProduct);
707  $this->_blIsInitialized = true;
708  }
709 
715  public function getLinkType()
716  {
717  if ($this->_iLinkType === null) {
718  $sListType = $this->getConfig()->getRequestParameter('listtype');
719  if ('vendor' == $sListType) {
720  $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
721  } elseif ('manufacturer' == $sListType) {
722  $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
723  // @deprecated v5.3 (2016-05-04); Tags will be moved to own module.
724  } elseif ('tag' == $sListType) {
725  $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
726  // END deprecated
727  // @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
728  } elseif ('recommlist' == $sListType) {
729  $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
730  // END deprecated
731  } else {
732  $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
733 
734  // price category has own type..
735  if (($oCat = $this->getActiveCategory()) && $oCat->isPriceCategory()) {
736  $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
737  }
738  }
739  }
740 
741  return $this->_iLinkType;
742  }
743 
749  public function drawParentUrl()
750  {
751  return $this->getProduct()->isVariant();
752  }
753 
761  public function getParentName()
762  {
763  if ($this->_sParentName === null) {
764  $this->_sParentName = false;
765  if (($oParent = $this->_getParentProduct($this->getProduct()->oxarticles__oxparentid->value))) {
766  $this->_sParentName = $oParent->oxarticles__oxtitle->value;
767  }
768  }
769 
770  return $this->_sParentName;
771  }
772 
780  public function getParentUrl()
781  {
782  if ($this->_sParentUrl === null) {
783  $this->_sParentUrl = false;
784  if (($oParent = $this->_getParentProduct($this->getProduct()->oxarticles__oxparentid->value))) {
785  $this->_sParentUrl = $oParent->getLink();
786  }
787  }
788 
789  return $this->_sParentUrl;
790  }
791 
797  public function getPictureGallery()
798  {
799  if ($this->_aPicGallery === null) {
800  //get picture gallery
801  $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
802  }
803 
804  return $this->_aPicGallery;
805  }
806 
812  public function getActPictureId()
813  {
814  $aPicGallery = $this->getPictureGallery();
815 
816  return $aPicGallery['ActPicID'];
817  }
818 
824  public function getActPicture()
825  {
826  $aPicGallery = $this->getPictureGallery();
827 
828  return $aPicGallery['ActPic'];
829  }
830 
836  public function getPictures()
837  {
838  $aPicGallery = $this->getPictureGallery();
839 
840  return $aPicGallery['Pics'];
841  }
842 
850  public function getArtPic($sPicNr)
851  {
852  $aPicGallery = $this->getPictureGallery();
853 
854  return $aPicGallery['Pics'][$sPicNr];
855  }
856 
862  public function getSelectLists()
863  {
864  if ($this->_aSelectLists === null) {
865  $this->_aSelectLists = false;
866  if ($this->getConfig()->getConfigParam('bl_perfLoadSelectLists')) {
867  $this->_aSelectLists = $this->getProduct()->getSelectLists();
868  }
869  }
870 
871  return $this->_aSelectLists;
872  }
873 
879  public function getReviews()
880  {
881  if ($this->_aReviews === null) {
882  $this->_aReviews = false;
883  if ($this->getConfig()->getConfigParam('bl_perfLoadReviews')) {
884  $this->_aReviews = $this->getProduct()->getReviews();
885  }
886  }
887 
888  return $this->_aReviews;
889  }
890 
896  public function getCrossSelling()
897  {
898  if ($this->_oCrossSelling === null) {
899  $this->_oCrossSelling = false;
900  if ($oProduct = $this->getProduct()) {
901  $this->_oCrossSelling = $oProduct->getCrossSelling();
902  }
903  }
904 
905  return $this->_oCrossSelling;
906  }
907 
913  public function getSimilarProducts()
914  {
915  if ($this->_oSimilarProducts === null) {
916  $this->_oSimilarProducts = false;
917  if ($oProduct = $this->getProduct()) {
918  $this->_oSimilarProducts = $oProduct->getSimilarProducts();
919  }
920  }
921 
923  }
924 
932  public function getSimilarRecommListIds()
933  {
934  if ($this->_aSimilarRecommListIds === null) {
935  $this->_aSimilarRecommListIds = false;
936 
937  if ($oProduct = $this->getProduct()) {
938  $this->_aSimilarRecommListIds = array($oProduct->getId());
939  }
940  }
941 
943  }
944 
950  public function getAccessoires()
951  {
952  if ($this->_oAccessoires === null) {
953  $this->_oAccessoires = false;
954  if ($oProduct = $this->getProduct()) {
955  $this->_oAccessoires = $oProduct->getAccessoires();
956  }
957  }
958 
959  return $this->_oAccessoires;
960  }
961 
967  public function getAlsoBoughtTheseProducts()
968  {
969  if ($this->_aAlsoBoughtArts === null) {
970  $this->_aAlsoBoughtArts = false;
971  if ($oProduct = $this->getProduct()) {
972  $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
973  }
974  }
975 
977  }
978 
984  public function isPriceAlarm()
985  {
986  // #419 disabling price alarm if article has fixed price
987  $oProduct = $this->getProduct();
988  if (isset($oProduct->oxarticles__oxblfixedprice->value) && $oProduct->oxarticles__oxblfixedprice->value) {
989  return 0;
990  }
991 
992  return 1;
993  }
994 
1003  protected function _getSubject($iLang)
1004  {
1005  return $this->getProduct();
1006  }
1007 
1013  public function getSearchTitle()
1014  {
1015  return $this->_sSearchTitle;
1016  }
1017 
1023  public function setSearchTitle($sTitle)
1024  {
1025  $this->_sSearchTitle = $sTitle;
1026  }
1027 
1033  public function setCatTreePath($sActCatPath)
1034  {
1035  $this->_sCatTreePath = $sActCatPath;
1036  }
1037 
1044  public function noIndex()
1045  {
1046  $sListType = $this->getConfig()->getRequestParameter('listtype');
1047  if ($sListType && ('vendor' == $sListType || 'manufacturer' == $sListType)) {
1048  return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
1049  }
1050 
1051  return parent::noIndex();
1052  }
1053 
1059  public function getTitle()
1060  {
1061  if ($oProduct = $this->getProduct()) {
1062  // @deprecated v5.3 (2016-05-04); Tags will be moved to own module.
1063  $sTag = $this->getTag();
1064  $sTitleField = 'oxarticles__oxtitle';
1065  $sVarSelField = 'oxarticles__oxvarselect';
1066 
1067  $sVarSelValue = $oProduct->$sVarSelField->value ? ' ' . $oProduct->$sVarSelField->value : '';
1068  $sTagValue = !empty($sTag) ? ' - ' . $sTag : '';
1069 
1070  return $oProduct->$sTitleField->value . $sVarSelValue . $sTagValue;
1071  // END deprecated
1072  }
1073  }
1074 
1080  public function getMetaDescription()
1081  {
1082  $sMeta = parent::getMetaDescription();
1083 
1084  // @deprecated v5.3 (2016-05-04); Tags will be moved to own module.
1085  if ($sTag = $this->getTag()) {
1086  $sMeta = $sTag . ' - ' . $sMeta;
1087  }
1088  // END deprecated
1089 
1090  return $sMeta;
1091  }
1092 
1100  public function getTag()
1101  {
1102  return oxRegistry::getConfig()->getRequestParameter("searchtag");
1103  }
1104 
1110  public function getCanonicalUrl()
1111  {
1112  if (($oProduct = $this->getProduct())) {
1113  if ($oProduct->oxarticles__oxparentid->value) {
1114  $oProduct = $this->_getParentProduct($oProduct->oxarticles__oxparentid->value);
1115  }
1116 
1117  $oUtils = oxRegistry::get("oxUtilsUrl");
1118  if (oxRegistry::getUtils()->seoIsActive()) {
1119  $sUrl = $oUtils->prepareCanonicalUrl($oProduct->getBaseSeoLink($oProduct->getLanguage(), true));
1120  } else {
1121  $sUrl = $oUtils->prepareCanonicalUrl($oProduct->getBaseStdLink($oProduct->getLanguage()));
1122  }
1123 
1124  return $sUrl;
1125  }
1126  }
1127 
1133  public function getBreadCrumb()
1134  {
1135  if ('search' == $this->getListType()) {
1136  $aPaths = $this->_getSearchBreadCrumb();
1137  // @deprecated v5.3 (2016-05-04); Tags will be moved to own module.
1138  } elseif ('tag' == $this->getListType()) {
1139  $aPaths = $this->_getTagBreadCrumb();
1140  // END deprecated
1141  // @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
1142  } elseif ('recommlist' == $this->getListType()) {
1143  $aPaths = $this->_getRecommendationListBredCrumb();
1144  // END deprecated
1145  } elseif ('vendor' == $this->getListType()) {
1146  $aPaths = $this->_getVendorBreadCrumb();
1147  } else {
1148  $aPaths = $this->_getCategoryBreadCrumb();
1149  }
1150 
1151  return $aPaths;
1152  }
1153 
1161  public function getCaptcha()
1162  {
1163  if ($this->_oCaptcha === null) {
1164  $this->_oCaptcha = oxNew('oxCaptcha');
1165  }
1166 
1167  return $this->_oCaptcha;
1168  }
1169 
1179  public function addme()
1180  {
1181  $myConfig = $this->getConfig();
1182  $myUtils = oxRegistry::getUtils();
1183 
1184  //control captcha
1185  $sMac = $this->getConfig()->getRequestParameter('c_mac');
1186  $sMacHash = $this->getConfig()->getRequestParameter('c_mach');
1187  $oCaptcha = $this->getCaptcha();
1188  if (!$oCaptcha->pass($sMac, $sMacHash)) {
1189  $this->_iPriceAlarmStatus = 2;
1190 
1191  return;
1192  }
1193 
1194  $aParams = $this->getConfig()->getRequestParameter('pa');
1195  if (!isset($aParams['email']) || !$myUtils->isValidEmail($aParams['email'])) {
1196  $this->_iPriceAlarmStatus = 0;
1197 
1198  return;
1199  }
1200  $aParams['aid'] = $this->getProduct()->getId();
1201  $oCur = $myConfig->getActShopCurrencyObject();
1202  // convert currency to default
1203  $dPrice = $myUtils->currency2Float($aParams['price']);
1204 
1205  $oAlarm = oxNew("oxPriceAlarm");
1206  $oAlarm->oxpricealarm__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr'));
1207  $oAlarm->oxpricealarm__oxemail = new oxField($aParams['email']);
1208  $oAlarm->oxpricealarm__oxartid = new oxField($aParams['aid']);
1209  $oAlarm->oxpricealarm__oxprice = new oxField($myUtils->fRound($dPrice, $oCur));
1210  $oAlarm->oxpricealarm__oxshopid = new oxField($myConfig->getShopId());
1211  $oAlarm->oxpricealarm__oxcurrency = new oxField($oCur->name);
1212 
1213  $oAlarm->oxpricealarm__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
1214 
1215  $oAlarm->save();
1216 
1217  // Send Email
1218  $oEmail = oxNew('oxEmail');
1219  $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification($aParams, $oAlarm);
1220  }
1221 
1227  public function getPriceAlarmStatus()
1228  {
1230  }
1231 
1237  public function getBidPrice()
1238  {
1239  if ($this->_sBidPrice === null) {
1240  $this->_sBidPrice = false;
1241 
1242  $aParams = $this->getConfig()->getRequestParameter('pa');
1243  $oCur = $this->getConfig()->getActShopCurrencyObject();
1244  $iPrice = oxRegistry::getUtils()->currency2Float($aParams['price']);
1245  $this->_sBidPrice = oxRegistry::getLang()->formatCurrency($iPrice, $oCur);
1246  }
1247 
1248  return $this->_sBidPrice;
1249  }
1250 
1256  public function getVariantSelections()
1257  {
1258  // finding parent
1259  $oProduct = $this->getProduct();
1260  $sVarSelParameter = $this->getConfig()->getRequestParameter("varselid");
1261  $sParentIdField = 'oxarticles__oxparentid';
1262  if (($oParent = $this->_getParentProduct($oProduct->$sParentIdField->value))) {
1263  return $oParent->getVariantSelections($sVarSelParameter, $oProduct->getId());
1264  }
1265 
1266  return $oProduct->getVariantSelections($sVarSelParameter);
1267  }
1268 
1274  public function getPicturesProduct()
1275  {
1276  $aVariantSelections = $this->getVariantSelections();
1277  if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
1278  return $aVariantSelections['oActiveVariant'];
1279  }
1280 
1281  return $this->getProduct();
1282  }
1283 
1289  public function getSearchParamForHtml()
1290  {
1291  if ($this->_sSearchParamForHtml === null) {
1292  $this->_sSearchParamForHtml = $this->getConfig()->getRequestParameter('searchparam');
1293  }
1294 
1296  }
1297 
1303  public function showRdfa()
1304  {
1305  return $this->getConfig()->getConfigParam('blRDFaEmbedding');
1306  }
1307 
1313  public function getRDFaNormalizedRating()
1314  {
1315  $myConfig = $this->getConfig();
1316  $iMin = $myConfig->getConfigParam("iRDFaMinRating");
1317  $iMax = $myConfig->getConfigParam("iRDFaMaxRating");
1318 
1319  $oProduct = $this->getProduct();
1320  $iCount = $oProduct->oxarticles__oxratingcnt->value;
1321  if (isset($iMin) && isset($iMax) && $iMax != '' && $iMin != '' && $iCount > 0) {
1322  $aNormalizedRating = array();
1323  $iValue = ((4 * ($oProduct->oxarticles__oxrating->value - $iMin) / ($iMax - $iMin))) + 1;
1324  $aNormalizedRating["count"] = $iCount;
1325  $aNormalizedRating["value"] = round($iValue, 2);
1326 
1327  return $aNormalizedRating;
1328  }
1329 
1330  return false;
1331  }
1332 
1340  public function getRDFaValidityPeriod($sShopConfVar)
1341  {
1342  if ($sShopConfVar) {
1343  $aValidity = array();
1344  $iDays = $this->getConfig()->getConfigParam($sShopConfVar);
1345  $iFrom = oxRegistry::get("oxUtilsDate")->getTime();
1346 
1347  $iThrough = $iFrom + ($iDays * 24 * 60 * 60);
1348  $aValidity["from"] = date('Y-m-d\TH:i:s', $iFrom) . "Z";
1349  $aValidity["through"] = date('Y-m-d\TH:i:s', $iThrough) . "Z";
1350 
1351  return $aValidity;
1352  }
1353 
1354  return false;
1355  }
1356 
1362  public function getRDFaBusinessFnc()
1363  {
1364  return $this->getConfig()->getConfigParam("sRDFaBusinessFnc");
1365  }
1366 
1372  public function getRDFaCustomers()
1373  {
1374  return $this->getConfig()->getConfigParam("aRDFaCustomers");
1375  }
1376 
1382  public function getRDFaVAT()
1383  {
1384  return $this->getConfig()->getConfigParam("iRDFaVAT");
1385  }
1386 
1392  public function getRDFaGenericCondition()
1393  {
1394  return $this->getConfig()->getConfigParam("iRDFaCondition");
1395  }
1396 
1402  public function getBundleArticle()
1403  {
1404  $oProduct = $this->getProduct();
1405  if ($oProduct && $oProduct->oxarticles__oxbundleid->value) {
1406  $oArticle = oxNew("oxArticle");
1407  $oArticle->load($oProduct->oxarticles__oxbundleid->value);
1408 
1409  return $oArticle;
1410  }
1411 
1412  return false;
1413  }
1414 
1415 
1421  public function getRDFaPaymentMethods()
1422  {
1423  $iPrice = $this->getProduct()->getPrice()->getBruttoPrice();
1424  $oPayments = oxNew("oxPaymentList");
1425  $oPayments->loadRDFaPaymentList($iPrice);
1426 
1427  return $oPayments;
1428  }
1429 
1435  public function getRDFaDeliverySetMethods()
1436  {
1437  $oDelSets = oxNew("oxDeliverySetList");
1438  $oDelSets->loadRDFaDeliverySetList();
1439 
1440  return $oDelSets;
1441  }
1442 
1448  public function getProductsDeliveryList()
1449  {
1450  $oProduct = $this->getProduct();
1451  $oDelList = oxNew("oxDeliveryList");
1452  $oDelList->loadDeliveryListForProduct($oProduct);
1453 
1454  return $oDelList;
1455  }
1456 
1463  {
1464  return $this->getConfig()->getConfigParam("sRDFaDeliveryChargeSpecLoc");
1465  }
1466 
1473  {
1474  return $this->getConfig()->getConfigParam("sRDFaPaymentChargeSpecLoc");
1475  }
1476 
1482  public function getRDFaBusinessEntityLoc()
1483  {
1484  return $this->getConfig()->getConfigParam("sRDFaBusinessEntityLoc");
1485  }
1486 
1492  public function showRDFaProductStock()
1493  {
1494  return $this->getConfig()->getConfigParam("blShowRDFaProductStock");
1495  }
1496 
1504  public function canChangeTags()
1505  {
1506  if ($oUser = $this->getUser()) {
1507 
1508  return true;
1509  }
1510 
1511  return false;
1512  }
1513 
1521  public function getTagCloudManager()
1522  {
1524  $oTagList = oxNew("oxArticleTagList");
1525  //$oTagList->load($this->getProduct()->getId());
1526  $oTagList->setArticleId($this->getProduct()->getId());
1527  $oTagCloud = oxNew("oxTagCloud");
1528  $oTagCloud->setTagList($oTagList);
1529  $oTagCloud->setExtendedMode(true);
1530 
1531  return $oTagCloud;
1532  }
1533 
1539  public function showZoomPics()
1540  {
1541  $aPicGallery = $this->getPictureGallery();
1542 
1543  return $aPicGallery['ZoomPic'];
1544  }
1545 
1551  public function isReviewActive()
1552  {
1553  return $this->getConfig()->getConfigParam('bl_perfLoadReviews');
1554  }
1555 
1561  public function getDefaultSorting()
1562  {
1563  $aSorting = parent::getDefaultSorting();
1564  $oCategory = $this->getActiveCategory();
1565 
1566  if ($this->getListType() != 'search' && $oCategory && $oCategory instanceof oxCategory) {
1567  if ($sSortBy = $oCategory->getDefaultSorting()) {
1568  $sSortDir = ($oCategory->getDefaultSortingMode()) ? "desc" : "asc";
1569  $aSorting = array('sortby' => $sSortBy, 'sortdir' => $sSortDir);
1570  }
1571  }
1572 
1573  return $aSorting;
1574  }
1575 
1581  public function getSortingParameters()
1582  {
1583  $aSorting = $this->getSorting($this->getSortIdent());
1584  if (!is_array($aSorting)) {
1585  return null;
1586  }
1587 
1588  return implode('|', $aSorting);
1589  }
1590 
1596  protected function _getVendorBreadCrumb()
1597  {
1598  $aPaths = array();
1599  $aCatPath = array();
1600 
1601  $oCat = oxNew('oxVendor');
1602  $oCat->load('root');
1603 
1604  $aCatPath['link'] = $oCat->getLink();
1605  $aCatPath['title'] = $oCat->oxvendor__oxtitle->value;
1606  $aPaths[] = $aCatPath;
1607 
1608  $oCat = $this->getActVendor();
1609  if (is_a($oCat, 'oxVendor')) {
1610  $aCatPath['link'] = $oCat->getLink();
1611  $aCatPath['title'] = $oCat->oxvendor__oxtitle->value;
1612  $aPaths[] = $aCatPath;
1613  }
1614 
1615  return $aPaths;
1616  }
1617 
1625  protected function _getRecommendationListBredCrumb()
1626  {
1627  $aPaths = array();
1628  $aCatPath = array();
1629  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
1630  $aCatPath['title'] = oxRegistry::getLang()->translateString('LISTMANIA', $iBaseLanguage, false);
1631  $aPaths[] = $aCatPath;
1632 
1633  return $aPaths;
1634  }
1635 
1643  protected function _getTagBreadCrumb()
1644  {
1645  $aPaths = array();
1646 
1647  $aCatPath = array();
1648 
1649  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
1650  $sSelfLink = $this->getViewConfig()->getSelfLink();
1651 
1652  $aCatPath['title'] = oxRegistry::getLang()->translateString('TAGS', $iBaseLanguage, false);
1653  $aCatPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl($sSelfLink . 'cl=tags');
1654  $aPaths[] = $aCatPath;
1655 
1656  $sSearchTagParameter = oxRegistry::getConfig()->getRequestParameter('searchtag');
1657  $oStr = getStr();
1658  $aCatPath['title'] = $oStr->ucfirst($sSearchTagParameter);
1659  $aCatPath['link'] = oxRegistry::get("oxSeoEncoderTag")->getTagUrl($sSearchTagParameter);
1660  $aPaths[] = $aCatPath;
1661 
1662  return $aPaths;
1663  }
1664 
1670  protected function _getSearchBreadCrumb()
1671  {
1672  $aPaths = array();
1673  $aCatPath = array();
1674 
1675  $iBaseLanguage = oxRegistry::getLang()->getBaseLanguage();
1676  $sTranslatedString = oxRegistry::getLang()->translateString('SEARCH_RESULT', $iBaseLanguage, false);
1677  $sSelfLink = $this->getViewConfig()->getSelfLink();
1678  $sSessionToken = oxRegistry::getSession()->getVariable('sess_stoken');
1679 
1680  $aCatPath['title'] = sprintf($sTranslatedString, $this->getSearchParamForHtml());
1681  $aCatPath['link'] = $sSelfLink . 'stoken=' . $sSessionToken . "&amp;cl=search&amp;".
1682  "searchparam=" . $this->getSearchParamForHtml();
1683 
1684  $aPaths[] = $aCatPath;
1685 
1686  return $aPaths;
1687  }
1688 
1694  protected function _getCategoryBreadCrumb()
1695  {
1696  $aPaths = array();
1697 
1698  $oCatTree = $this->getCatTreePath();
1699 
1700  if ($oCatTree) {
1701 
1702  foreach ($oCatTree as $oCat) {
1703  $aCatPath = array();
1704 
1705  $aCatPath['link'] = $oCat->getLink();
1706  $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
1707 
1708  $aPaths[] = $aCatPath;
1709  }
1710 
1711  return $aPaths;
1712  }
1713 
1714  return $aPaths;
1715  }
1716 }