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
00235 protected function _getParentProduct( $sParentId )
00236 {
00237 if ( $sParentId && $this->_oParentProd === null ) {
00238 $this->_oParentProd = false;
00239 if ( ( $oParent = oxNewArticle( $sParentId ) ) ) {
00240 $this->_processProduct( $oParent );
00241 $this->_oParentProd = $oParent;
00242 }
00243 }
00244 return $this->_oParentProd;
00245 }
00246
00253 public function loadVariantInformation()
00254 {
00255 if ( $this->_aVariantList === null ) {
00256 $oProduct = $this->getProduct();
00257
00258
00259 $this->_aVariantList = $oProduct->getVariants( false );
00260
00261
00262 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) && count( $this->_aVariantList ) == 0 ) {
00263 $myConfig = $this->getConfig();
00264
00265 $this->_aVariantList = $oParent->getVariants( false );
00266
00267
00268 if ( $myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
00269
00270 $oParent->aSelectlist = $oParent->getSelectLists();
00271 $this->_aVariantList = array_merge( array( $oParent ), $this->_aVariantList->getArray() );
00272 }
00273 }
00274
00275
00276 foreach ( $this->_aVariantList as $oVariant ) {
00277 $this->_processProduct( $oVariant );
00278 }
00279
00280 }
00281
00282 return $this->_aVariantList;
00283 }
00284
00290 protected function _getAddUrlParams()
00291 {
00292 if ( $this->getListType() == "search" ) {
00293 return $this->getDynUrlParams();
00294 }
00295 }
00296
00304 protected function _processProduct( $oProduct )
00305 {
00306 $oProduct->setLinkType( $this->getLinkType() );
00307 if ( $sAddParams = $this->_getAddUrlParams() ) {
00308 $oProduct->appendLink( $sAddParams );
00309 }
00310 }
00311
00317 public function getViewId()
00318 {
00319 if ( isset( $this->_sViewId )) {
00320 return $this->_sViewId;
00321 }
00322
00323 $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|';
00324
00325
00326 return $this->_sViewId = $sViewId;
00327 }
00328
00329
00336 public function init()
00337 {
00338 parent::init();
00339
00340 $oProduct = $this->getProduct();
00341
00342
00343 if ( $oProduct->oxarticles__oxtemplate->value ) {
00344 $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00345 }
00346
00347 if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00348 $this->_sThisTemplate = basename ( $sTplName );
00349 }
00350 }
00351
00363 public function render()
00364 {
00365 $myConfig = $this->getConfig();
00366
00367 $oProduct = $this->getProduct();
00368
00369
00370 $oProduct->loadAmountPriceInfo();
00371
00372 parent::render();
00373
00374 $sPartial = oxConfig::getParameter('renderPartial');
00375 $this->addTplParam('sRenderPartial', $sPartial);
00376
00377 switch ($sPartial) {
00378 case "productInfo":
00379 return 'page/details/ajax/fullproductinfo.tpl';
00380 break;
00381 case "detailsMain":
00382 return 'page/details/ajax/productmain.tpl';
00383 break;
00384 default:
00385
00386 $oLocator = oxNew( 'oxlocator', $this->getListType() );
00387 $oLocator->setLocatorData( $oProduct, $this );
00388
00389 if ($myConfig->getConfigParam( 'bl_rssRecommLists' ) && $this->getSimilarRecommLists()) {
00390 $oRss = oxNew('oxrssfeed');
00391 $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00392 }
00393
00394 return $this->_sThisTemplate;
00395 }
00396 }
00397
00409 protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00410 {
00411 if ( !$sMeta ) {
00412 $oProduct = $this->getProduct();
00413
00414 $sMeta = $oProduct->getArticleLongDesc()->value;
00415 $sMeta = str_replace( array( '<br>', '<br />', '<br/>' ), "\n", $sMeta );
00416 $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00417 $sMeta = strip_tags( $sMeta );
00418 }
00419 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00420 }
00421
00432 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00433 {
00434 $myConfig = $this->getConfig();
00435
00436 if ( !$sKeywords ) {
00437 $oProduct = $this->getProduct();
00438 $aKeywords[] = trim( $this->getTitle() );
00439
00440 if ( $oCatTree = $this->getCategoryTree() ) {
00441 foreach ( $oCatTree->getPath() as $oCat ) {
00442 $aKeywords[] = trim( $oCat->oxcategories__oxtitle->value );
00443 }
00444 }
00445
00446 $sKeywords = implode( ", ", $aKeywords );
00447
00448 $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00449
00450
00451 if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00452 $sKeywords .= ", " . parent::_prepareMetaKeyword( $sSearchKeys, false );
00453 }
00454 }
00455
00456 return $sKeywords;
00457 }
00458
00464 public function canRate()
00465 {
00466 if ( $this->_blCanRate === null ) {
00467
00468 $this->_blCanRate = false;
00469 $myConfig = $this->getConfig();
00470
00471 if ( $myConfig->getConfigParam( 'bl_perfLoadReviews' ) &&
00472 $oUser = $this->getUser() ) {
00473
00474 $oRating = oxNew( 'oxrating' );
00475 $this->_blCanRate = $oRating->allowRating( $oUser->getId(), 'oxarticle', $this->getProduct()->getId() );
00476 }
00477 }
00478 return $this->_blCanRate;
00479 }
00480
00486 public function canChangeTags()
00487 {
00488 if ( $oUser = $this->getUser() ) {
00489
00490 return true;
00491 }
00492 return false;
00493 }
00494
00500 public function saveReview()
00501 {
00502 if ( $this->canAcceptFormData() &&
00503 ( $oUser = $this->getUser() ) && ( $oProduct = $this->getProduct() ) ) {
00504
00505 $dRating = oxConfig::getParameter( 'artrating' );
00506 if ( $dRating !== null ) {
00507 $dRating = (int) $dRating;
00508 }
00509
00510
00511 if ( $dRating !== null && $dRating >= 0 && $dRating <= 5 ) {
00512 $oRating = oxNew( 'oxrating' );
00513 if ( $oRating->allowRating( $oUser->getId(), 'oxarticle', $oProduct->getId() ) ) {
00514 $oRating->oxratings__oxuserid = new oxField( $oUser->getId() );
00515 $oRating->oxratings__oxtype = new oxField( 'oxarticle' );
00516 $oRating->oxratings__oxobjectid = new oxField( $oProduct->getId() );
00517 $oRating->oxratings__oxrating = new oxField( $dRating );
00518 $oRating->save();
00519 $oProduct->addToRatingAverage( $dRating );
00520 }
00521 }
00522
00523 if ( ( $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) ) ) ) {
00524 $oReview = oxNew( 'oxreview' );
00525 $oReview->oxreviews__oxobjectid = new oxField( $oProduct->getId() );
00526 $oReview->oxreviews__oxtype = new oxField( 'oxarticle' );
00527 $oReview->oxreviews__oxtext = new oxField( $sReviewText, oxField::T_RAW );
00528 $oReview->oxreviews__oxlang = new oxField( oxLang::getInstance()->getBaseLanguage() );
00529 $oReview->oxreviews__oxuserid = new oxField( $oUser->getId() );
00530 $oReview->oxreviews__oxrating = new oxField( ( $dRating !== null ) ? $dRating : null );
00531 $oReview->save();
00532 }
00533 }
00534 }
00535
00541 public function addToRecomm()
00542 {
00543 if (!$this->getViewConfig()->getShowListmania()) {
00544 return;
00545 }
00546
00547 $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00548 $sRecommList = oxConfig::getParameter( 'recomm' );
00549 $sArtId = $this->getProduct()->getId();
00550
00551 if ( $sArtId ) {
00552 $oRecomm = oxNew( 'oxrecommlist' );
00553 $oRecomm->load( $sRecommList);
00554 $oRecomm->addArticle( $sArtId, $sRecommText );
00555 }
00556 }
00557
00563 public function addTags()
00564 {
00565 $sTag = $this->getConfig()->getParameter('newTags', true );
00566 $sHighTag = $this->getConfig()->getParameter( 'highTags', true );
00567 if ( !$sTag && !$sHighTag) {
00568 return;
00569 }
00570 if ( $sHighTag ) {
00571 $sTag = getStr()->html_entity_decode( $sHighTag );
00572 }
00573
00574
00575 $aTags = array();
00576 $oProduct = $this->getProduct();
00577 $aTaggedProducts = oxSession::getVar("aTaggedProducts");
00578 if ( $aTaggedProducts ) {
00579 $aTags = $aTaggedProducts[$oProduct->getId()];
00580 }
00581 $blAddedTag = false;
00582
00583 if ( $aTags[$sTag] != 1 ) {
00584 $oProduct->addTag( $sTag );
00585 $aTags[$sTag] = 1;
00586 $aTaggedProducts[$oProduct->getId()] = $aTags;
00587 oxSession::setVar( 'aTaggedProducts', $aTaggedProducts);
00588 $blAddedTag = true;
00589 }
00590
00591 if ($this->getConfig()->getParameter('blAjax', true )) {
00592 die($blAddedTag);
00593 }
00594 }
00595
00601 public function editTags()
00602 {
00603 if ( !$this->getUser() ) {
00604 return;
00605 }
00606 $oTagCloud = oxNew("oxTagCloud");
00607 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00608 $this->_blEditTags = true;
00609
00610
00611 if ($this->getConfig()->getParameter('blAjax', true )) {
00612 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00613 $oActView = oxNew( 'oxubase' );
00614 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00615 $oSmarty->assign('oView', $this );
00616 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00617 die($oSmarty->fetch( 'page/details/inc/editTags.tpl', $this->getViewId() ));
00618 }
00619 }
00620
00626 public function cancelTags()
00627 {
00628 $oTagCloud = oxNew("oxTagCloud");
00629 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00630 $this->_blEditTags = false;
00631
00632
00633 if ($this->getConfig()->getParameter('blAjax', true )) {
00634 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00635 $oActView = oxNew( 'oxubase' );
00636 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00637 $oSmarty->assign('oView', $this );
00638 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00639 die($oSmarty->fetch( 'page/details/inc/tags.tpl', $this->getViewId() ));
00640 }
00641 }
00642
00648 protected function _getSeoObjectId()
00649 {
00650 if ( $oProduct = $this->getProduct() ) {
00651 return $oProduct->getId();
00652 }
00653 }
00654
00660 public function getAttributes()
00661 {
00662 if ( $this->_aAttributes === null ) {
00663
00664 $aArtAttributes = $this->getProduct()->getAttributes();
00665
00666
00667 $this->_aAttributes = false;
00668
00669 if ( count( $aArtAttributes ) ) {
00670 foreach ( $aArtAttributes as $sKey => $oAttribute ) {
00671 $this->_aAttributes[$sKey] = new stdClass();
00672 $this->_aAttributes[$sKey]->title = $oAttribute->oxattribute__oxtitle->value;
00673 $this->_aAttributes[$sKey]->value = $oAttribute->oxattribute__oxvalue->value;
00674 }
00675 }
00676 }
00677 return $this->_aAttributes;
00678 }
00679
00680
00686 public function getEditTags()
00687 {
00688 return $this->_blEditTags;
00689 }
00690
00696 public function getTags()
00697 {
00698 return $this->_aTags;
00699 }
00700
00706 public function getTagCloudManager()
00707 {
00708 $oManager = oxNew( "oxTagCloud" );
00709 $oManager->setExtendedMode( true );
00710 $oManager->setProductId( $this->getProduct()->getId() );
00711 return $oManager;
00712 }
00713
00720 public function isEditableTags()
00721 {
00722 if ( $this->_blCanEditTags === null ) {
00723 $this->_blCanEditTags = false;
00724 if ( $this->getProduct() && $this->getUser()) {
00725 $this->_blCanEditTags = true;
00726 }
00727 }
00728 return $this->_blCanEditTags;
00729 }
00730
00736 public function getProduct()
00737 {
00738 $myConfig = $this->getConfig();
00739 $myUtils = oxUtils::getInstance();
00740
00741 if ( $this->_oProduct === null ) {
00742
00743
00744
00745 $myConfig->setConfigParam( 'blLoadVariants', true );
00746
00747 $sOxid = oxConfig::getParameter( 'anid' );
00748
00749
00750 $this->_oProduct = oxNew( 'oxarticle' );
00751
00752
00753 if ( !$this->_oProduct->load( $sOxid ) ) {
00754 $myUtils->redirect( $myConfig->getShopHomeURL() );
00755 $myUtils->showMessageAndExit( '' );
00756 }
00757
00758 $aVariantSelections = $this->_oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
00759 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
00760 $this->_oProduct = $aVariantSelections['oActiveVariant'];
00761 }
00762 }
00763
00764
00765 if ( !$this->_blIsInitialized ) {
00766
00767 $blContinue = true;
00768 if ( !$this->_oProduct->isVisible() ) {
00769 $blContinue = false;
00770 } elseif ( $this->_oProduct->oxarticles__oxparentid->value ) {
00771 $oParent = $this->_getParentProduct( $this->_oProduct->oxarticles__oxparentid->value );
00772 if ( !$oParent || !$oParent->isVisible() ) {
00773 $blContinue = false;
00774 }
00775 }
00776
00777 if ( !$blContinue ) {
00778 $myUtils->redirect( $myConfig->getShopHomeURL() );
00779 $myUtils->showMessageAndExit( '' );
00780 }
00781
00782 $this->_processProduct( $this->_oProduct );
00783 $this->_blIsInitialized = true;
00784 }
00785
00786 return $this->_oProduct;
00787 }
00788
00794 public function getLinkType()
00795 {
00796 if ( $this->_iLinkType === null ) {
00797 $sListType = oxConfig::getParameter( 'listtype' );
00798 if ( 'vendor' == $sListType ) {
00799 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00800 } elseif ( 'manufacturer' == $sListType ) {
00801 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00802 } elseif ( 'tag' == $sListType ) {
00803 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00804 } elseif ( 'recommlist' == $sListType ) {
00805 $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
00806 } else {
00807 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00808
00809
00810 if ( ( $oCat = $this->getActCategory() ) && $oCat->isPriceCategory() ) {
00811 $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00812 }
00813 }
00814 }
00815
00816 return $this->_iLinkType;
00817 }
00818
00824 public function getVariantList()
00825 {
00826 return $this->loadVariantInformation();
00827 }
00828
00835 public function getVariantListExceptCurrent()
00836 {
00837 $oList = $this->getVariantList();
00838 if (is_object($oList)) {
00839 $oList = clone $oList;
00840 }
00841 $sOxid = $this->getProduct()->getId();
00842 if (isset($oList[$sOxid])) {
00843 unset($oList[$sOxid]);
00844 }
00845 return $oList;
00846 }
00847
00853 public function getCaptcha()
00854 {
00855 if ( $this->_oCaptcha === null ) {
00856 $this->_oCaptcha = oxNew('oxCaptcha');
00857 }
00858 return $this->_oCaptcha;
00859 }
00860
00866 public function getMediaFiles()
00867 {
00868 if ( $this->_aMediaFiles === null ) {
00869 $aMediaFiles = $this->getProduct()->getMediaUrls();
00870 $this->_aMediaFiles = count($aMediaFiles) ? $aMediaFiles : false;
00871 }
00872 return $this->_aMediaFiles;
00873 }
00874
00880 public function getLastProducts()
00881 {
00882 if ( $this->_aLastProducts === null ) {
00883
00884 $oProduct = $this->getProduct();
00885 $sArtId = $oProduct->oxarticles__oxparentid->value?$oProduct->oxarticles__oxparentid->value:$oProduct->getId();
00886
00887 $oHistoryArtList = oxNew( 'oxarticlelist' );
00888 $oHistoryArtList->loadHistoryArticles( $sArtId );
00889 $this->_aLastProducts = $oHistoryArtList;
00890 }
00891 return $this->_aLastProducts;
00892 }
00893
00899 public function getVendor()
00900 {
00901 if ( $this->_oVendor === null ) {
00902 $this->_oVendor = $this->getProduct()->getVendor( false );
00903 }
00904 return $this->_oVendor;
00905 }
00906
00912 public function getManufacturer()
00913 {
00914 if ( $this->_oManufacturer === null ) {
00915 $this->_oManufacturer = $this->getProduct()->getManufacturer( false );
00916 }
00917 return $this->_oManufacturer;
00918 }
00919
00925 public function getCategory()
00926 {
00927 if ( $this->_oCategory === null ) {
00928 $this->_oCategory = $this->getProduct()->getCategory();
00929 }
00930 return $this->_oCategory;
00931 }
00932
00938 public function drawParentUrl()
00939 {
00940 return $this->getProduct()->isVariant();
00941 }
00942
00948 public function getParentName()
00949 {
00950 if ( $this->_sParentName === null ) {
00951 $this->_sParentName = false;
00952 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00953 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00954 }
00955 }
00956 return $this->_sParentName;
00957 }
00958
00964 public function getParentUrl()
00965 {
00966 if ( $this->_sParentUrl === null ) {
00967 $this->_sParentUrl = false;
00968 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00969 $this->_sParentUrl = $oParent->getLink();
00970 }
00971 }
00972 return $this->_sParentUrl;
00973 }
00974
00980 public function getPictureGallery()
00981 {
00982 if ( $this->_aPicGallery === null ) {
00983
00984 $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
00985 }
00986 return $this->_aPicGallery;
00987 }
00988
00994 public function getActPictureId()
00995 {
00996 $aPicGallery = $this->getPictureGallery();
00997 return $aPicGallery['ActPicID'];
00998 }
00999
01005 public function getActPicture()
01006 {
01007 $aPicGallery = $this->getPictureGallery();
01008 return $aPicGallery['ActPic'];
01009 }
01010
01016 public function morePics()
01017 {
01018 $aPicGallery = $this->getPictureGallery();
01019 return $aPicGallery['MorePics'];
01020 }
01021
01027 public function getPictures()
01028 {
01029 $aPicGallery = $this->getPictureGallery();
01030 return $aPicGallery['Pics'];
01031 }
01032
01040 public function getArtPic( $sPicNr )
01041 {
01042 $aPicGallery = $this->getPictureGallery();
01043 return $aPicGallery['Pics'][$sPicNr];
01044 }
01045
01051 public function getIcons()
01052 {
01053 $aPicGallery = $this->getPictureGallery();
01054 return $aPicGallery['Icons'];
01055 }
01056
01062 public function showZoomPics()
01063 {
01064 $aPicGallery = $this->getPictureGallery();
01065 return $aPicGallery['ZoomPic'];
01066 }
01067
01073 public function getZoomPics()
01074 {
01075 $aPicGallery = $this->getPictureGallery();
01076 return $aPicGallery['ZoomPics'];
01077 }
01078
01084 public function getActZoomPic()
01085 {
01086 return 1;
01087 }
01088
01094 public function getSelectLists()
01095 {
01096 if ( $this->_aSelectLists === null ) {
01097 $this->_aSelectLists = false;
01098 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
01099 $this->_aSelectLists = $this->getProduct()->getSelectLists();
01100 }
01101 }
01102 return $this->_aSelectLists;
01103 }
01104
01110 public function getReviews()
01111 {
01112 if ( $this->_aReviews === null ) {
01113 $this->_aReviews = false;
01114 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
01115 $this->_aReviews = $this->getProduct()->getReviews();
01116 }
01117 }
01118 return $this->_aReviews;
01119 }
01120
01126 public function getCrossSelling()
01127 {
01128 if ( $this->_oCrossSelling === null ) {
01129 $this->_oCrossSelling = false;
01130 if ( $oProduct = $this->getProduct() ) {
01131 $this->_oCrossSelling = $oProduct->getCrossSelling();
01132 }
01133 }
01134 return $this->_oCrossSelling;
01135 }
01136
01142 public function getSimilarProducts()
01143 {
01144 if ( $this->_oSimilarProducts === null ) {
01145 $this->_oSimilarProducts = false;
01146 if ( $oProduct = $this->getProduct() ) {
01147 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
01148 }
01149 }
01150 return $this->_oSimilarProducts;
01151 }
01152
01158 public function getSimilarRecommLists()
01159 {
01160 if (!$this->getViewConfig()->getShowListmania()) {
01161 return false;
01162 }
01163
01164 if ( $this->_oRecommList === null ) {
01165 $this->_oRecommList = false;
01166 if ( $oProduct = $this->getProduct() ) {
01167 $oRecommList = oxNew('oxrecommlist');
01168 $this->_oRecommList = $oRecommList->getRecommListsByIds( array( $oProduct->getId() ) );
01169 }
01170 }
01171 return $this->_oRecommList;
01172 }
01173
01179 public function getAccessoires()
01180 {
01181 if ( $this->_oAccessoires === null ) {
01182 $this->_oAccessoires = false;
01183 if ( $oProduct = $this->getProduct() ) {
01184 $this->_oAccessoires = $oProduct->getAccessoires();
01185 }
01186 }
01187 return $this->_oAccessoires;
01188 }
01189
01195 public function getAlsoBoughtTheseProducts()
01196 {
01197 if ( $this->_aAlsoBoughtArts === null ) {
01198 $this->_aAlsoBoughtArts = false;
01199 if ( $oProduct = $this->getProduct() ) {
01200 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
01201 }
01202 }
01203 return $this->_aAlsoBoughtArts;
01204 }
01205
01211 public function isPriceAlarm()
01212 {
01213
01214 $oProduct = $this->getProduct();
01215 if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
01216 return 0;
01217 }
01218 return 1;
01219 }
01220
01229 protected function _getSubject( $iLang )
01230 {
01231 return $this->getProduct();
01232 }
01233
01239 public function getSearchTitle()
01240 {
01241 return $this->_sSearchTitle;
01242 }
01243
01251 public function setSearchTitle( $sTitle )
01252 {
01253 $this->_sSearchTitle = $sTitle;
01254 }
01255
01263 public function setCatTreePath( $sActCatPath )
01264 {
01265 $this->_sCatTreePath = $sActCatPath;
01266 }
01267
01274 public function noIndex()
01275 {
01276 $sListType = oxConfig::getParameter( 'listtype' );
01277 if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
01278 return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01279 }
01280 return parent::noIndex();
01281 }
01282
01288 public function getTitle()
01289 {
01290 if ( $oProduct = $this->getProduct() ) {
01291 return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' );
01292 }
01293 }
01294
01295
01301 public function getTag()
01302 {
01303 return oxConfig::getParameter("searchtag", 1);
01304 }
01305
01311 public function getCanonicalUrl()
01312 {
01313 if ( ( $oProduct = $this->getProduct() ) ) {
01314 $oUtils = oxUtilsUrl::getInstance();
01315 if ( oxUtils::getInstance()->seoIsActive() ) {
01316 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseSeoLink( $oProduct->getLanguage(), true ) );
01317 } else {
01318 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseStdLink( $oProduct->getLanguage() ) );
01319 }
01320 return $sUrl;
01321 }
01322 }
01323
01329 public function isMdVariantView()
01330 {
01331 if ( $this->_blMdView === null ) {
01332 $this->_blMdView = false;
01333 if ( $this->getConfig()->getConfigParam( 'blUseMultidimensionVariants' ) ) {
01334 $iMaxMdDepth = $this->getProduct()->getMdVariants()->getMaxDepth();
01335 $this->_blMdView = ($iMaxMdDepth > 1);
01336 }
01337 }
01338
01339 return $this->_blMdView;
01340 }
01341
01347 public function isPersParam()
01348 {
01349 $oProduct = $this->getProduct();
01350 return $oProduct->oxarticles__oxisconfigurable->value;
01351 }
01352
01358 public function getTagSeparator()
01359 {
01360 $sSepartor = $this->getConfig()->getConfigParam("sTagSeparator");
01361 return $sSepartor;
01362 }
01363
01369 public function getRatingValue()
01370 {
01371
01372 if ( $this->_dRatingValue === null ) {
01373 $this->_dRatingValue = (double) 0;
01374 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01375 $this->_dRatingValue = round( $oDetailsProduct->getArticleRatingAverage(), 1);
01376 }
01377 }
01378
01379 return (double) $this->_dRatingValue;
01380 }
01381
01387 public function isReviewActive()
01388 {
01389 return $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' );
01390 }
01391
01397 public function getRatingCount()
01398 {
01399 if ( $this->_iRatingCnt === null ) {
01400 $this->_iRatingCnt = false;
01401 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01402 $this->_iRatingCnt = $oDetailsProduct->oxarticles__oxratingcnt->value;
01403 }
01404 }
01405 return $this->_iRatingCnt;
01406 }
01407
01413 public function getBreadCrumb()
01414 {
01415 $aPaths = array();
01416
01417 if ( 'search' == oxConfig::getParameter( 'listtype' ) ) {
01418
01419 $aCatPath = array();
01420 $aCatPath['title'] = sprintf(oxLang::getInstance()->translateString( 'searchResult', oxLang::getInstance()->getBaseLanguage(), false ), oxConfig::getParameter( 'searchparam' ));
01421 $aPaths[] = $aCatPath;
01422
01423 } elseif ( 'tag' == oxConfig::getParameter( 'listtype' ) ) {
01424
01425 $aCatPath = array();
01426 $aCatPath['title'] = oxLang::getInstance()->translateString( 'TAGS', oxLang::getInstance()->getBaseLanguage(), false );
01427 $aPaths[] = $aCatPath;
01428
01429 $oStr = getStr();
01430 $aCatPath['title'] = $oStr->ucfirst(oxConfig::getParameter( 'searchtag' ));
01431 $aPaths[] = $aCatPath;
01432
01433 } elseif ( 'recommlist' == oxConfig::getParameter( 'listtype' ) ) {
01434
01435 $aCatPath = array();
01436 $aCatPath['title'] = oxLang::getInstance()->translateString( 'PAGE_RECOMMENDATIONS_PRODUCTS_TITLE', oxLang::getInstance()->getBaseLanguage(), false );
01437 $aPaths[] = $aCatPath;
01438 } else {
01439
01440 $oCatTree = $this->getCatTreePath();
01441
01442 if ( $oCatTree ) {
01443
01444 foreach ( $oCatTree as $oCat ) {
01445 $aCatPath = array();
01446
01447 $aCatPath['link'] = $oCat->getLink();
01448 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
01449
01450 $aPaths[] = $aCatPath;
01451 }
01452 }
01453 }
01454
01455 return $aPaths;
01456 }
01457
01467 public function addme()
01468 {
01469 $myConfig = $this->getConfig();
01470 $myUtils = oxUtils::getInstance();
01471
01472
01473 $sMac = oxConfig::getParameter( 'c_mac' );
01474 $sMacHash = oxConfig::getParameter( 'c_mach' );
01475 $oCaptcha = oxNew('oxCaptcha');
01476 if (!$oCaptcha->pass($sMac, $sMacHash)) {
01477 $this->_iPriceAlarmStatus = 2;
01478 return;
01479 }
01480
01481 $aParams = oxConfig::getParameter( 'pa' );
01482 if ( !isset( $aParams['email'] ) || !$myUtils->isValidEmail( $aParams['email'] ) ) {
01483 $this->_iPriceAlarmStatus = 0;
01484 return;
01485 }
01486 $aParams['aid'] = $this->getProduct()->getId();
01487 $oCur = $myConfig->getActShopCurrencyObject();
01488
01489 $dPrice = $myUtils->currency2Float( $aParams['price'] );
01490
01491 $oAlarm = oxNew( "oxpricealarm" );
01492 $oAlarm->oxpricealarm__oxuserid = new oxField( oxSession::getVar( 'usr' ));
01493 $oAlarm->oxpricealarm__oxemail = new oxField( $aParams['email']);
01494 $oAlarm->oxpricealarm__oxartid = new oxField( $aParams['aid']);
01495 $oAlarm->oxpricealarm__oxprice = new oxField( $myUtils->fRound( $dPrice, $oCur ));
01496 $oAlarm->oxpricealarm__oxshopid = new oxField( $myConfig->getShopId());
01497 $oAlarm->oxpricealarm__oxcurrency = new oxField( $oCur->name);
01498
01499 $oAlarm->oxpricealarm__oxlang = new oxField(oxLang::getInstance()->getBaseLanguage());
01500
01501 $oAlarm->save();
01502
01503
01504 $oEmail = oxNew( 'oxemail' );
01505 $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification( $aParams, $oAlarm );
01506 }
01507
01513 public function getPriceAlarmStatus()
01514 {
01515 return $this->_iPriceAlarmStatus;
01516 }
01517
01523 public function getBidPrice()
01524 {
01525 if ( $this->_sBidPrice === null ) {
01526 $this->_sBidPrice = false;
01527
01528 $aParams = oxConfig::getParameter( 'pa' );
01529 $oCur = $this->getConfig()->getActShopCurrencyObject();
01530 $iPrice = oxUtils::getInstance()->currency2Float( $aParams['price'] );
01531 $this->_sBidPrice = oxLang::getInstance()->formatCurrency( $iPrice, $oCur );
01532 }
01533 return $this->_sBidPrice;
01534 }
01535
01541 public function getVariantSelections()
01542 {
01543
01544 $oProduct = $this->getProduct();
01545 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) ) {
01546 return $oParent->getVariantSelections( oxConfig::getParameter( "varselid" ), $oProduct->getId() );
01547 }
01548
01549 return $oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
01550 }
01551
01557 public function getPicturesProduct()
01558 {
01559 $aVariantSelections = $this->getVariantSelections();
01560 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
01561 return $aVariantSelections['oActiveVariant'];
01562 }
01563 return $this->getProduct();
01564 }
01565 }