00001 <?php
00002
00009 class Details extends oxUBase
00010 {
00016 protected $_aVariantList = null;
00017
00023 protected $_sThisTemplate = 'page/details/details.tpl';
00024
00030 protected $_oParentProd = null;
00031
00037 protected $_blCanRate = null;
00038
00043 protected $_blShowSorting = true;
00044
00049 protected $_blEditTags = null;
00050
00055 protected $_blCanEditTags = null;
00056
00061 protected $_aTags = null;
00062
00067 protected $_aUserRecommList = null;
00068
00073 protected $_oCaptcha = null;
00074
00079 protected $_aMediaFiles = null;
00080
00085 protected $_aLastProducts = null;
00086
00091 protected $_oVendor = null;
00092
00097 protected $_oManufacturer = null;
00098
00103 protected $_oCategory = null;
00104
00109 protected $_aAttributes = null;
00110
00115 protected $_sParentName = null;
00116
00121 protected $_sParentUrl = null;
00122
00127 protected $_aPicGallery = null;
00128
00133 protected $_aSelectLists = null;
00134
00139 protected $_aReviews = null;
00140
00145 protected $_oCrossSelling = null;
00146
00151 protected $_oSimilarProducts = null;
00152
00157 protected $_oRecommList = null;
00158
00163 protected $_oAccessoires = null;
00164
00169 protected $_aAlsoBoughtArts = null;
00170
00175 protected $_sSearchTitle = null;
00176
00182 protected $_blIsInitialized = false;
00183
00189 protected $_iLinkType = null;
00190
00196 protected $_blMdView = null;
00197
00202 protected $_dRatingValue = null;
00203
00208 protected $_iRatingCnt = null;
00209
00214 protected $_blTop5Action = false;
00215
00220 protected $_sBidPrice = null;
00221
00226 protected $_iPriceAlarmStatus = null;
00227
00232 protected $_sSearchParamForHtml = null;
00233
00239 protected $_aSimilarRecommListIds = null;
00240
00241
00249 protected function _getParentProduct( $sParentId )
00250 {
00251 if ( $sParentId && $this->_oParentProd === null ) {
00252 $this->_oParentProd = false;
00253 if ( ( $oParent = oxNewArticle( $sParentId ) ) ) {
00254 $this->_processProduct( $oParent );
00255 $this->_oParentProd = $oParent;
00256 }
00257 }
00258 return $this->_oParentProd;
00259 }
00260
00267 public function loadVariantInformation()
00268 {
00269 if ( $this->_aVariantList === null ) {
00270 $oProduct = $this->getProduct();
00271
00272
00273 if ( $oParent = $oProduct->getParentArticle() ) {
00274 $myConfig = $this->getConfig();
00275
00276 $oParent->setNoVariantLoading(false);
00277 $this->_aVariantList = $oParent->getFullVariants( false );
00278
00279
00280 if ( count( $this->_aVariantList ) && $myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
00281
00282 $oParent->aSelectlist = $oParent->getSelectLists();
00283 $this->_aVariantList = array_merge( array( $oParent ), $this->_aVariantList->getArray() );
00284 }
00285 } else {
00286
00287 $this->_aVariantList = $oProduct->getFullVariants( false );
00288 }
00289
00290
00291 foreach ( $this->_aVariantList as $oVariant ) {
00292 $this->_processProduct( $oVariant );
00293 }
00294
00295 }
00296
00297 return $this->_aVariantList;
00298 }
00299
00305 protected function _getAddUrlParams()
00306 {
00307 if ( $this->getListType() == "search" ) {
00308 return $this->getDynUrlParams();
00309 }
00310 }
00311
00319 protected function _processProduct( $oProduct )
00320 {
00321 $oProduct->setLinkType( $this->getLinkType() );
00322 if ( $sAddParams = $this->_getAddUrlParams() ) {
00323 $oProduct->appendLink( $sAddParams );
00324 }
00325 }
00326
00332 public function getViewId()
00333 {
00334 if ( isset( $this->_sViewId )) {
00335 return $this->_sViewId;
00336 }
00337
00338 $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|';
00339
00340
00341 return $this->_sViewId = $sViewId;
00342 }
00343
00344
00356 public function render()
00357 {
00358 $myConfig = $this->getConfig();
00359
00360 $oProduct = $this->getProduct();
00361
00362
00363 if ( $oProduct->oxarticles__oxtemplate->value ) {
00364 $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00365 }
00366
00367 if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00368 $this->_sThisTemplate = 'custom/'.basename ( $sTplName );
00369 }
00370
00371 parent::render();
00372
00373 $sPartial = oxConfig::getParameter('renderPartial');
00374 $this->addTplParam('renderPartial', $sPartial);
00375
00376 switch ($sPartial) {
00377 case "productInfo":
00378 return 'page/details/ajax/fullproductinfo.tpl';
00379 break;
00380 case "detailsMain":
00381 return 'page/details/ajax/productmain.tpl';
00382 break;
00383 default:
00384
00385 $oLocator = oxNew( 'oxlocator', $this->getListType() );
00386 $oLocator->setLocatorData( $oProduct, $this );
00387
00388 if ($myConfig->getConfigParam( 'bl_rssRecommLists' ) && $this->getSimilarRecommListIds()) {
00389 $oRss = oxNew('oxrssfeed');
00390 $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00391 }
00392
00393 return $this->_sThisTemplate;
00394 }
00395 }
00396
00408 protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00409 {
00410 if ( !$sMeta ) {
00411 $oProduct = $this->getProduct();
00412
00413 $sMeta = $oProduct->getLongDescription()->value;
00414 $sMeta = str_replace( array( '<br>', '<br />', '<br/>' ), "\n", $sMeta );
00415 $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00416 $sMeta = strip_tags( $sMeta );
00417 }
00418 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00419 }
00420
00431 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00432 {
00433 if ( !$sKeywords ) {
00434 $oProduct = $this->getProduct();
00435 $sKeywords = trim( $this->getTitle() );
00436
00437 if ( $oCatTree = $this->getCategoryTree() ) {
00438 foreach ( $oCatTree->getPath() as $oCat ) {
00439 $sKeywords .= ", " . trim( $oCat->oxcategories__oxtitle->value );
00440 }
00441 }
00442
00443
00444 if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00445 $sKeywords .= ", ". $sSearchKeys;
00446 }
00447
00448 $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00449 }
00450
00451 return $sKeywords;
00452 }
00453
00459 public function ratingIsActive()
00460 {
00461 $myConfig = $this->getConfig();
00462
00463 return $myConfig->getConfigParam( 'bl_perfLoadReviews' );
00464 }
00465
00471 public function canRate()
00472 {
00473 if ( $this->_blCanRate === null ) {
00474
00475 $this->_blCanRate = false;
00476 $myConfig = $this->getConfig();
00477
00478 if ( $this->ratingIsActive() && $oUser = $this->getUser() ) {
00479
00480 $oRating = oxNew( 'oxrating' );
00481 $this->_blCanRate = $oRating->allowRating( $oUser->getId(), 'oxarticle', $this->getProduct()->getId() );
00482 }
00483 }
00484
00485 return $this->_blCanRate;
00486 }
00487
00493 public function canChangeTags()
00494 {
00495 if ( $oUser = $this->getUser() ) {
00496
00497 return true;
00498 }
00499 return false;
00500 }
00501
00507 public function saveReview()
00508 {
00509 if ( $this->canAcceptFormData() &&
00510 ( $oUser = $this->getUser() ) && ( $oProduct = $this->getProduct() ) ) {
00511
00512 $dRating = oxConfig::getParameter( 'artrating' );
00513 if ( $dRating !== null ) {
00514 $dRating = (int) $dRating;
00515 }
00516
00517
00518 if ( $dRating !== null && $dRating >= 1 && $dRating <= 5 ) {
00519 $oRating = oxNew( 'oxrating' );
00520 if ( $oRating->allowRating( $oUser->getId(), 'oxarticle', $oProduct->getId() ) ) {
00521 $oRating->oxratings__oxuserid = new oxField( $oUser->getId() );
00522 $oRating->oxratings__oxtype = new oxField( 'oxarticle' );
00523 $oRating->oxratings__oxobjectid = new oxField( $oProduct->getId() );
00524 $oRating->oxratings__oxrating = new oxField( $dRating );
00525 $oRating->save();
00526 $oProduct->addToRatingAverage( $dRating );
00527 }
00528 }
00529
00530 if ( ( $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) ) ) ) {
00531 $oReview = oxNew( 'oxreview' );
00532 $oReview->oxreviews__oxobjectid = new oxField( $oProduct->getId() );
00533 $oReview->oxreviews__oxtype = new oxField( 'oxarticle' );
00534 $oReview->oxreviews__oxtext = new oxField( $sReviewText, oxField::T_RAW );
00535 $oReview->oxreviews__oxlang = new oxField( oxRegistry::getLang()->getBaseLanguage() );
00536 $oReview->oxreviews__oxuserid = new oxField( $oUser->getId() );
00537 $oReview->oxreviews__oxrating = new oxField( ( $dRating !== null ) ? $dRating : 0);
00538 $oReview->save();
00539 }
00540 }
00541 }
00542
00548 public function addToRecomm()
00549 {
00550 if (!$this->getViewConfig()->getShowListmania()) {
00551 return;
00552 }
00553
00554 $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00555 $sRecommList = oxConfig::getParameter( 'recomm' );
00556 $sArtId = $this->getProduct()->getId();
00557
00558 if ( $sArtId ) {
00559 $oRecomm = oxNew( 'oxrecommlist' );
00560 $oRecomm->load( $sRecommList);
00561 $oRecomm->addArticle( $sArtId, $sRecommText );
00562 }
00563 }
00564
00570 public function addTags()
00571 {
00572 $sTag = $this->getConfig()->getParameter('newTags', true );
00573 $sHighTag = $this->getConfig()->getParameter( 'highTags', true );
00574 if ( !$sTag && !$sHighTag) {
00575 return;
00576 }
00577 if ( $sHighTag ) {
00578 $sTag = getStr()->html_entity_decode( $sHighTag );
00579 }
00580
00581
00582 $aTags = array();
00583 $oProduct = $this->getProduct();
00584 $aTaggedProducts = oxSession::getVar("aTaggedProducts");
00585 if ( $aTaggedProducts ) {
00586 $aTags = $aTaggedProducts[$oProduct->getId()];
00587 }
00588 $blAddedTag = false;
00589
00590 if ( $aTags[$sTag] != 1 ) {
00591 $oProduct->addTag( $sTag );
00592 $aTags[$sTag] = 1;
00593 $aTaggedProducts[$oProduct->getId()] = $aTags;
00594 oxSession::setVar( 'aTaggedProducts', $aTaggedProducts);
00595 $blAddedTag = true;
00596 }
00597
00598 if ( oxConfig::getParameter( 'blAjax', true ) ) {
00599 oxRegistry::getUtils()->showMessageAndExit( $blAddedTag );
00600 }
00601 }
00602
00608 public function editTags()
00609 {
00610 if ( !$this->getUser() ) {
00611 return;
00612 }
00613 $oTagCloud = oxNew("oxTagCloud");
00614 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00615 $this->_blEditTags = true;
00616
00617
00618 if ( oxConfig::getParameter( 'blAjax', true ) ) {
00619 oxRegistry::getUtils()->setHeader( "Content-Type: text/html; charset=".oxRegistry::getLang()->translateString( 'charset' ) );
00620 $oActView = oxNew( 'oxubase' );
00621 $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
00622 $oSmarty->assign('oView', $this );
00623 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00624 oxRegistry::getUtils()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/editTags.tpl', $this->getViewId() ) );
00625 }
00626 }
00627
00633 public function cancelTags()
00634 {
00635 $oTagCloud = oxNew("oxTagCloud");
00636 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00637 $this->_blEditTags = false;
00638
00639
00640 if ( oxConfig::getParameter( 'blAjax', true ) ) {
00641 oxRegistry::getUtils()->setHeader( "Content-Type: text/html; charset=".oxRegistry::getLang()->translateString( 'charset' ) );
00642 $oActView = oxNew( 'oxubase' );
00643 $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
00644 $oSmarty->assign('oView', $this );
00645 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00646 oxRegistry::getUtils()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/tags.tpl', $this->getViewId() ) );
00647 }
00648 }
00649
00655 protected function _getSeoObjectId()
00656 {
00657 if ( $oProduct = $this->getProduct() ) {
00658 return $oProduct->getId();
00659 }
00660 }
00661
00667 public function getAttributes()
00668 {
00669 if ( $this->_aAttributes === null ) {
00670
00671 $aArtAttributes = $this->getProduct()->getAttributes();
00672
00673
00674 $this->_aAttributes = false;
00675
00676 if ( count( $aArtAttributes ) ) {
00677 foreach ( $aArtAttributes as $sKey => $oAttribute ) {
00678 $this->_aAttributes[$sKey] = new stdClass();
00679 $this->_aAttributes[$sKey]->title = $oAttribute->oxattribute__oxtitle->value;
00680 $this->_aAttributes[$sKey]->value = $oAttribute->oxattribute__oxvalue->value;
00681 }
00682 }
00683 }
00684 return $this->_aAttributes;
00685 }
00686
00687
00693 public function getEditTags()
00694 {
00695 return $this->_blEditTags;
00696 }
00697
00703 public function getTags()
00704 {
00705 return $this->_aTags;
00706 }
00707
00713 public function getTagCloudManager()
00714 {
00715 $oManager = oxNew( "oxTagCloud" );
00716 $oManager->setExtendedMode( true );
00717 $oManager->setProductId( $this->getProduct()->getId() );
00718 return $oManager;
00719 }
00720
00727 public function isEditableTags()
00728 {
00729 if ( $this->_blCanEditTags === null ) {
00730 $this->_blCanEditTags = false;
00731 if ( $this->getProduct() && $this->getUser()) {
00732 $this->_blCanEditTags = true;
00733 }
00734 }
00735 return $this->_blCanEditTags;
00736 }
00737
00743 public function getProduct()
00744 {
00745 $myConfig = $this->getConfig();
00746 $myUtils = oxRegistry::getUtils();
00747
00748 if ( $this->_oProduct === null ) {
00749
00750
00751
00752 $myConfig->setConfigParam( 'blLoadVariants', true );
00753
00754 $sOxid = oxConfig::getParameter( 'anid' );
00755
00756
00757 $this->_oProduct = oxNew( 'oxarticle' );
00758
00759 if ( !$this->_oProduct->load( $sOxid ) ) {
00760 $myUtils->redirect( $myConfig->getShopHomeURL() );
00761 $myUtils->showMessageAndExit( '' );
00762 }
00763
00764 $aVariantSelections = $this->_oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
00765 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
00766 $this->_oProduct = $aVariantSelections['oActiveVariant'];
00767 }
00768 }
00769
00770
00771 if ( !$this->_blIsInitialized ) {
00772
00773 $blContinue = true;
00774 if ( !$this->_oProduct->isVisible() ) {
00775 $blContinue = false;
00776 } elseif ( $this->_oProduct->oxarticles__oxparentid->value ) {
00777 $oParent = $this->_getParentProduct( $this->_oProduct->oxarticles__oxparentid->value );
00778 if ( !$oParent || !$oParent->isVisible() ) {
00779 $blContinue = false;
00780 }
00781 }
00782
00783 if ( !$blContinue ) {
00784 $myUtils->redirect( $myConfig->getShopHomeURL() );
00785 $myUtils->showMessageAndExit( '' );
00786 }
00787
00788 $this->_processProduct( $this->_oProduct );
00789 $this->_blIsInitialized = true;
00790 }
00791
00792 return $this->_oProduct;
00793 }
00794
00800 public function getLinkType()
00801 {
00802 if ( $this->_iLinkType === null ) {
00803 $sListType = oxConfig::getParameter( 'listtype' );
00804 if ( 'vendor' == $sListType ) {
00805 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00806 } elseif ( 'manufacturer' == $sListType ) {
00807 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00808 } elseif ( 'tag' == $sListType ) {
00809 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00810 } elseif ( 'recommlist' == $sListType ) {
00811 $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
00812 } else {
00813 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00814
00815
00816 if ( ( $oCat = $this->getActCategory() ) && $oCat->isPriceCategory() ) {
00817 $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00818 }
00819 }
00820 }
00821
00822 return $this->_iLinkType;
00823 }
00824
00830 public function getVariantList()
00831 {
00832 return $this->loadVariantInformation();
00833 }
00834
00841 public function getVariantListExceptCurrent()
00842 {
00843 $oList = $this->getVariantList();
00844 if (is_object($oList)) {
00845 $oList = clone $oList;
00846 }
00847
00848 $sOxid = $this->getProduct()->getId();
00849 if (isset($oList[$sOxid])) {
00850 unset($oList[$sOxid]);
00851 }
00852 return $oList;
00853 }
00854
00860 public function getCaptcha()
00861 {
00862 if ( $this->_oCaptcha === null ) {
00863 $this->_oCaptcha = oxNew('oxCaptcha');
00864 }
00865 return $this->_oCaptcha;
00866 }
00867
00873 public function getMediaFiles()
00874 {
00875 if ( $this->_aMediaFiles === null ) {
00876 $aMediaFiles = $this->getProduct()->getMediaUrls();
00877 $this->_aMediaFiles = count($aMediaFiles) ? $aMediaFiles : false;
00878 }
00879 return $this->_aMediaFiles;
00880 }
00881
00889 public function getLastProducts( $iCnt = 4 )
00890 {
00891 if ( $this->_aLastProducts === null ) {
00892
00893 $oProduct = $this->getProduct();
00894 $sArtId = $oProduct->oxarticles__oxparentid->value?$oProduct->oxarticles__oxparentid->value:$oProduct->getId();
00895
00896 $oHistoryArtList = oxNew( 'oxarticlelist' );
00897 $oHistoryArtList->loadHistoryArticles( $sArtId, $iCnt );
00898 $this->_aLastProducts = $oHistoryArtList;
00899 }
00900 return $this->_aLastProducts;
00901 }
00902
00908 public function getVendor()
00909 {
00910 if ( $this->_oVendor === null ) {
00911 $this->_oVendor = $this->getProduct()->getVendor( false );
00912 }
00913 return $this->_oVendor;
00914 }
00915
00921 public function getManufacturer()
00922 {
00923 if ( $this->_oManufacturer === null ) {
00924 $this->_oManufacturer = $this->getProduct()->getManufacturer( false );
00925 }
00926 return $this->_oManufacturer;
00927 }
00928
00934 public function getCategory()
00935 {
00936 if ( $this->_oCategory === null ) {
00937 $this->_oCategory = $this->getProduct()->getCategory();
00938 }
00939 return $this->_oCategory;
00940 }
00941
00947 public function drawParentUrl()
00948 {
00949 return $this->getProduct()->isVariant();
00950 }
00951
00957 public function getParentName()
00958 {
00959 if ( $this->_sParentName === null ) {
00960 $this->_sParentName = false;
00961 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00962 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00963 }
00964 }
00965 return $this->_sParentName;
00966 }
00967
00973 public function getParentUrl()
00974 {
00975 if ( $this->_sParentUrl === null ) {
00976 $this->_sParentUrl = false;
00977 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00978 $this->_sParentUrl = $oParent->getLink();
00979 }
00980 }
00981 return $this->_sParentUrl;
00982 }
00983
00989 public function getPictureGallery()
00990 {
00991 if ( $this->_aPicGallery === null ) {
00992
00993 $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
00994 }
00995 return $this->_aPicGallery;
00996 }
00997
01003 public function getActPictureId()
01004 {
01005 $aPicGallery = $this->getPictureGallery();
01006 return $aPicGallery['ActPicID'];
01007 }
01008
01014 public function getActPicture()
01015 {
01016 $aPicGallery = $this->getPictureGallery();
01017 return $aPicGallery['ActPic'];
01018 }
01019
01025 public function morePics()
01026 {
01027 $aPicGallery = $this->getPictureGallery();
01028 return $aPicGallery['MorePics'];
01029 }
01030
01036 public function getPictures()
01037 {
01038 $aPicGallery = $this->getPictureGallery();
01039 return $aPicGallery['Pics'];
01040 }
01041
01049 public function getArtPic( $sPicNr )
01050 {
01051 $aPicGallery = $this->getPictureGallery();
01052 return $aPicGallery['Pics'][$sPicNr];
01053 }
01054
01060 public function getIcons()
01061 {
01062 $aPicGallery = $this->getPictureGallery();
01063 return $aPicGallery['Icons'];
01064 }
01065
01071 public function showZoomPics()
01072 {
01073 $aPicGallery = $this->getPictureGallery();
01074 return $aPicGallery['ZoomPic'];
01075 }
01076
01082 public function getZoomPics()
01083 {
01084 $aPicGallery = $this->getPictureGallery();
01085 return $aPicGallery['ZoomPics'];
01086 }
01087
01093 public function getActZoomPic()
01094 {
01095 return 1;
01096 }
01097
01103 public function getSelectLists()
01104 {
01105 if ( $this->_aSelectLists === null ) {
01106 $this->_aSelectLists = false;
01107 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
01108 $this->_aSelectLists = $this->getProduct()->getSelectLists();
01109 }
01110 }
01111 return $this->_aSelectLists;
01112 }
01113
01119 public function getReviews()
01120 {
01121 if ( $this->_aReviews === null ) {
01122 $this->_aReviews = false;
01123 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
01124 $this->_aReviews = $this->getProduct()->getReviews();
01125 }
01126 }
01127 return $this->_aReviews;
01128 }
01129
01135 public function getCrossSelling()
01136 {
01137 if ( $this->_oCrossSelling === null ) {
01138 $this->_oCrossSelling = false;
01139 if ( $oProduct = $this->getProduct() ) {
01140 $this->_oCrossSelling = $oProduct->getCrossSelling();
01141 }
01142 }
01143 return $this->_oCrossSelling;
01144 }
01145
01151 public function getSimilarProducts()
01152 {
01153 if ( $this->_oSimilarProducts === null ) {
01154 $this->_oSimilarProducts = false;
01155 if ( $oProduct = $this->getProduct() ) {
01156 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
01157 }
01158 }
01159 return $this->_oSimilarProducts;
01160 }
01161
01167 public function getSimilarRecommListIds()
01168 {
01169 if ( $this->_aSimilarRecommListIds === null ) {
01170 $this->_aSimilarRecommListIds = false;
01171
01172 if ( $oProduct = $this->getProduct() ) {
01173 $this->_aSimilarRecommListIds = array( $oProduct->getId() );
01174 }
01175 }
01176 return $this->_aSimilarRecommListIds;
01177 }
01178
01184 public function getAccessoires()
01185 {
01186 if ( $this->_oAccessoires === null ) {
01187 $this->_oAccessoires = false;
01188 if ( $oProduct = $this->getProduct() ) {
01189 $this->_oAccessoires = $oProduct->getAccessoires();
01190 }
01191 }
01192 return $this->_oAccessoires;
01193 }
01194
01200 public function getAlsoBoughtTheseProducts()
01201 {
01202 if ( $this->_aAlsoBoughtArts === null ) {
01203 $this->_aAlsoBoughtArts = false;
01204 if ( $oProduct = $this->getProduct() ) {
01205 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
01206 }
01207 }
01208 return $this->_aAlsoBoughtArts;
01209 }
01210
01216 public function isPriceAlarm()
01217 {
01218
01219 $oProduct = $this->getProduct();
01220 if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
01221 return 0;
01222 }
01223 return 1;
01224 }
01225
01234 protected function _getSubject( $iLang )
01235 {
01236 return $this->getProduct();
01237 }
01238
01244 public function getSearchTitle()
01245 {
01246 return $this->_sSearchTitle;
01247 }
01248
01256 public function setSearchTitle( $sTitle )
01257 {
01258 $this->_sSearchTitle = $sTitle;
01259 }
01260
01268 public function setCatTreePath( $sActCatPath )
01269 {
01270 $this->_sCatTreePath = $sActCatPath;
01271 }
01272
01279 public function noIndex()
01280 {
01281 $sListType = oxConfig::getParameter( 'listtype' );
01282 if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
01283 return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01284 }
01285 return parent::noIndex();
01286 }
01287
01293 public function getTitle()
01294 {
01295 if ( $oProduct = $this->getProduct() ) {
01296 return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' );
01297 }
01298 }
01299
01300
01306 public function getTag()
01307 {
01308 return oxConfig::getParameter("searchtag", 1);
01309 }
01310
01316 public function getCanonicalUrl()
01317 {
01318 if ( ( $oProduct = $this->getProduct() ) ) {
01319 if ( $oProduct->oxarticles__oxparentid->value ) {
01320 $oProduct = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value );
01321 }
01322
01323 $oUtils = oxRegistry::get("oxUtilsUrl");
01324 if ( oxRegistry::getUtils()->seoIsActive() ) {
01325 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseSeoLink( $oProduct->getLanguage(), true ) );
01326 } else {
01327 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseStdLink( $oProduct->getLanguage() ) );
01328 }
01329 return $sUrl;
01330 }
01331 }
01332
01338 public function isMdVariantView()
01339 {
01340 if ( $this->_blMdView === null ) {
01341 $this->_blMdView = false;
01342 if ( $this->getConfig()->getConfigParam( 'blUseMultidimensionVariants' ) ) {
01343 $iMaxMdDepth = $this->getProduct()->getMdVariants()->getMaxDepth();
01344 $this->_blMdView = ($iMaxMdDepth > 1);
01345 }
01346 }
01347
01348 return $this->_blMdView;
01349 }
01350
01356 public function isPersParam()
01357 {
01358 $oProduct = $this->getProduct();
01359 return $oProduct->oxarticles__oxisconfigurable->value;
01360 }
01361
01367 public function getTagSeparator()
01368 {
01369 $sSepartor = $this->getConfig()->getConfigParam("sTagSeparator");
01370 return $sSepartor;
01371 }
01372
01378 public function getRatingValue()
01379 {
01380
01381 if ( $this->_dRatingValue === null ) {
01382 $this->_dRatingValue = (double) 0;
01383 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01384 $this->_dRatingValue = round( $oDetailsProduct->getArticleRatingAverage( $this->getConfig()->getConfigParam( 'blShowVariantReviews' ) ), 1);
01385 }
01386 }
01387
01388 return (double) $this->_dRatingValue;
01389 }
01390
01396 public function isReviewActive()
01397 {
01398 return $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' );
01399 }
01400
01406 public function getRatingCount()
01407 {
01408 if ( $this->_iRatingCnt === null ) {
01409 $this->_iRatingCnt = false;
01410 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01411 $this->_iRatingCnt = $oDetailsProduct->getArticleRatingCount( $this->getConfig()->getConfigParam( 'blShowVariantReviews' ) );
01412 }
01413 }
01414 return $this->_iRatingCnt;
01415 }
01416
01422 public function getBreadCrumb()
01423 {
01424 $aPaths = array();
01425
01426 if ( 'search' == oxConfig::getParameter( 'listtype' ) ) {
01427 $sSearchParam = $this->getSearchParamForHtml();
01428
01429 $aCatPath = array();
01430 $aCatPath['title'] = sprintf( oxRegistry::getLang()->translateString( 'searchResult', oxRegistry::getLang()->getBaseLanguage(), false ), $sSearchParam );
01431 $aCatPath['link'] = $this->getViewConfig()->getSelfLink() . 'stoken=' . oxSession::getVar('sess_stoken') . "&cl=search&searchparam=" . $sSearchParam;
01432
01433 $aPaths[] = $aCatPath;
01434
01435 } elseif ( 'tag' == oxConfig::getParameter( 'listtype' ) ) {
01436
01437 $aCatPath = array();
01438
01439 $aCatPath['title'] = oxRegistry::getLang()->translateString( 'TAGS', oxRegistry::getLang()->getBaseLanguage(), false );
01440 $aCatPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=tags' );
01441 $aPaths[] = $aCatPath;
01442
01443 $oStr = getStr();
01444 $aCatPath['title'] = $oStr->ucfirst(oxConfig::getParameter( 'searchtag' ));
01445 $aCatPath['link'] = oxRegistry::get("oxSeoEncoderTag")->getTagUrl( oxConfig::getParameter( 'searchtag' ) );
01446 $aPaths[] = $aCatPath;
01447
01448 } elseif ( 'recommlist' == oxConfig::getParameter( 'listtype' ) ) {
01449
01450 $aCatPath = array();
01451 $aCatPath['title'] = oxRegistry::getLang()->translateString( 'PAGE_RECOMMENDATIONS_PRODUCTS_TITLE', oxRegistry::getLang()->getBaseLanguage(), false );
01452 $aPaths[] = $aCatPath;
01453 } else {
01454
01455 $oCatTree = $this->getCatTreePath();
01456
01457 if ( $oCatTree ) {
01458
01459 foreach ( $oCatTree as $oCat ) {
01460 $aCatPath = array();
01461
01462 $aCatPath['link'] = $oCat->getLink();
01463 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
01464
01465 $aPaths[] = $aCatPath;
01466 }
01467 }
01468 }
01469
01470 return $aPaths;
01471 }
01472
01482 public function addme()
01483 {
01484 $myConfig = $this->getConfig();
01485 $myUtils = oxRegistry::getUtils();
01486
01487
01488 $sMac = oxConfig::getParameter( 'c_mac' );
01489 $sMacHash = oxConfig::getParameter( 'c_mach' );
01490 $oCaptcha = $this->getCaptcha();
01491 if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) {
01492 $this->_iPriceAlarmStatus = 2;
01493 return;
01494 }
01495
01496 $aParams = oxConfig::getParameter( 'pa' );
01497 if ( !isset( $aParams['email'] ) || !$myUtils->isValidEmail( $aParams['email'] ) ) {
01498 $this->_iPriceAlarmStatus = 0;
01499 return;
01500 }
01501 $aParams['aid'] = $this->getProduct()->getId();
01502 $oCur = $myConfig->getActShopCurrencyObject();
01503
01504 $dPrice = $myUtils->currency2Float( $aParams['price'] );
01505
01506 $oAlarm = oxNew( "oxpricealarm" );
01507 $oAlarm->oxpricealarm__oxuserid = new oxField( oxSession::getVar( 'usr' ));
01508 $oAlarm->oxpricealarm__oxemail = new oxField( $aParams['email']);
01509 $oAlarm->oxpricealarm__oxartid = new oxField( $aParams['aid']);
01510 $oAlarm->oxpricealarm__oxprice = new oxField( $myUtils->fRound( $dPrice, $oCur ));
01511 $oAlarm->oxpricealarm__oxshopid = new oxField( $myConfig->getShopId());
01512 $oAlarm->oxpricealarm__oxcurrency = new oxField( $oCur->name);
01513
01514 $oAlarm->oxpricealarm__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
01515
01516 $oAlarm->save();
01517
01518
01519 $oEmail = oxNew( 'oxemail' );
01520 $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification( $aParams, $oAlarm );
01521 }
01522
01528 public function getPriceAlarmStatus()
01529 {
01530 return $this->_iPriceAlarmStatus;
01531 }
01532
01538 public function getBidPrice()
01539 {
01540 if ( $this->_sBidPrice === null ) {
01541 $this->_sBidPrice = false;
01542
01543 $aParams = oxConfig::getParameter( 'pa' );
01544 $oCur = $this->getConfig()->getActShopCurrencyObject();
01545 $iPrice = oxRegistry::getUtils()->currency2Float( $aParams['price'] );
01546 $this->_sBidPrice = oxRegistry::getLang()->formatCurrency( $iPrice, $oCur );
01547 }
01548 return $this->_sBidPrice;
01549 }
01550
01556 public function getVariantSelections()
01557 {
01558
01559 $oProduct = $this->getProduct();
01560 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) ) {
01561 return $oParent->getVariantSelections( oxConfig::getParameter( "varselid" ), $oProduct->getId() );
01562 }
01563
01564 return $oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
01565 }
01566
01572 public function getPicturesProduct()
01573 {
01574 $aVariantSelections = $this->getVariantSelections();
01575 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
01576 return $aVariantSelections['oActiveVariant'];
01577 }
01578 return $this->getProduct();
01579 }
01580
01581
01587 public function isMoreTagsVisible()
01588 {
01589 return true;
01590 }
01591
01597 public function getSearchParamForHtml()
01598 {
01599 if ( $this->_sSearchParamForHtml === null ) {
01600 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' );
01601 }
01602 return $this->_sSearchParamForHtml;
01603 }
01604
01610 public function showRdfa()
01611 {
01612 return $this->getConfig()->getConfigParam( 'blRDFaEmbedding' );
01613 }
01614
01620 public function getRDFaNormalizedRating()
01621 {
01622 $myConfig = $this->getConfig();
01623 $iMin = $myConfig->getConfigParam("iRDFaMinRating");
01624 $iMax = $myConfig->getConfigParam("iRDFaMaxRating");
01625
01626 $oProduct = $this->getProduct();
01627 $iCount = $oProduct->oxarticles__oxratingcnt->value;
01628 if ( isset($iMin) && isset($iMax) && $iMax != '' && $iMin != '' && $iCount > 0 ) {
01629 $aNomalizedRating = array();
01630 $iValue = ((4*($oProduct->oxarticles__oxrating->value - $iMin)/($iMax - $iMin)))+1;
01631 $aNomalizedRating["count"] = $iCount;
01632 $aNomalizedRating["value"] = round($iValue, 2);
01633 return $aNomalizedRating;
01634 }
01635 return false;
01636 }
01637
01645 public function getRDFaValidityPeriod($sShopConfVar)
01646 {
01647 if ( $sShopConfVar ) {
01648 $aValidity = array();
01649 $iDays = $this->getConfig()->getConfigParam($sShopConfVar);
01650 $iFrom = oxRegistry::get("oxUtilsDate")->getTime();
01651
01652 $iThrough = $iFrom + ($iDays * 24 * 60 * 60);
01653 $aValidity["from"] = date('Y-m-d\TH:i:s', $iFrom)."Z";
01654 $aValidity["through"] = date('Y-m-d\TH:i:s', $iThrough)."Z";
01655
01656 return $aValidity;
01657 }
01658 return false;
01659 }
01660
01666 public function getRDFaBusinessFnc()
01667 {
01668 return $this->getConfig()->getConfigParam("sRDFaBusinessFnc");
01669 }
01670
01676 public function getRDFaCustomers()
01677 {
01678 return $this->getConfig()->getConfigParam("aRDFaCustomers");
01679 }
01680
01686 public function getRDFaVAT()
01687 {
01688 return $this->getConfig()->getConfigParam("iRDFaVAT");
01689 }
01690
01696 public function getRDFaGenericCondition()
01697 {
01698 return $this->getConfig()->getConfigParam("iRDFaCondition");
01699 }
01700
01706 public function getBundleArticle()
01707 {
01708 $oProduct = $this->getProduct();
01709 if ( $oProduct && $oProduct->oxarticles__oxbundleid->value ) {
01710 $oArticle = oxNew("oxarticle");
01711 $oArticle->load($oProduct->oxarticles__oxbundleid->value);
01712 return $oArticle;
01713 }
01714 return false;
01715 }
01716
01722 public function getRDFaPaymentMethods()
01723 {
01724 $iPrice = $this->getProduct()->getPrice()->getBruttoPrice();
01725 $oPayments = oxNew("oxpaymentlist");
01726 $oPayments->loadRDFaPaymentList($iPrice);
01727 return $oPayments;
01728 }
01729
01735 public function getRDFaDeliverySetMethods()
01736 {
01737 $oDelSets = oxNew("oxdeliverysetlist");
01738 $oDelSets->loadRDFaDeliverySetList();
01739 return $oDelSets;
01740 }
01741
01747 public function getProductsDeliveryList()
01748 {
01749 $oProduct = $this->getProduct();
01750 $oDelList = oxNew( "oxDeliveryList" );
01751 $oDelList->loadDeliveryListForProduct( $oProduct );
01752 return $oDelList;
01753 }
01754
01760 public function getRDFaDeliveryChargeSpecLoc()
01761 {
01762 return $this->getConfig()->getConfigParam("sRDFaDeliveryChargeSpecLoc");
01763 }
01764
01770 public function getRDFaPaymentChargeSpecLoc()
01771 {
01772 return $this->getConfig()->getConfigParam("sRDFaPaymentChargeSpecLoc");
01773 }
01774
01780 public function getRDFaBusinessEntityLoc()
01781 {
01782 return $this->getConfig()->getConfigParam("sRDFaBusinessEntityLoc");
01783 }
01784
01790 public function showRDFaProductStock()
01791 {
01792 return $this->getConfig()->getConfigParam("blShowRDFaProductStock");
01793 }
01794
01795 }