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
00241 protected function _getParentProduct( $sParentId )
00242 {
00243 if ( $sParentId && $this->_oParentProd === null ) {
00244 $this->_oParentProd = false;
00245 if ( ( $oParent = oxNewArticle( $sParentId ) ) ) {
00246 $this->_processProduct( $oParent );
00247 $this->_oParentProd = $oParent;
00248 }
00249 }
00250 return $this->_oParentProd;
00251 }
00252
00259 public function loadVariantInformation()
00260 {
00261 if ( $this->_aVariantList === null ) {
00262 $oProduct = $this->getProduct();
00263
00264
00265 if ( $oParent = $oProduct->getParentArticle() ) {
00266 $myConfig = $this->getConfig();
00267
00268 $this->_aVariantList = $oParent->getFullVariants( false );
00269
00270
00271 if ( count( $this->_aVariantList ) && $myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
00272
00273 $oParent->aSelectlist = $oParent->getSelectLists();
00274 $this->_aVariantList = array_merge( array( $oParent ), $this->_aVariantList->getArray() );
00275 }
00276 } else {
00277
00278 $this->_aVariantList = $oProduct->getFullVariants( false );
00279 }
00280
00281
00282 foreach ( $this->_aVariantList as $oVariant ) {
00283 $this->_processProduct( $oVariant );
00284 }
00285
00286 }
00287
00288 return $this->_aVariantList;
00289 }
00290
00296 protected function _getAddUrlParams()
00297 {
00298 if ( $this->getListType() == "search" ) {
00299 return $this->getDynUrlParams();
00300 }
00301 }
00302
00310 protected function _processProduct( $oProduct )
00311 {
00312 $oProduct->setLinkType( $this->getLinkType() );
00313 if ( $sAddParams = $this->_getAddUrlParams() ) {
00314 $oProduct->appendLink( $sAddParams );
00315 }
00316 }
00317
00323 public function getViewId()
00324 {
00325 if ( isset( $this->_sViewId )) {
00326 return $this->_sViewId;
00327 }
00328
00329 $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|';
00330
00331
00332 return $this->_sViewId = $sViewId;
00333 }
00334
00335
00347 public function render()
00348 {
00349 $myConfig = $this->getConfig();
00350
00351 $oProduct = $this->getProduct();
00352
00353
00354 if ( $oProduct->oxarticles__oxtemplate->value ) {
00355 $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00356 }
00357
00358 if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00359 $this->_sThisTemplate = basename ( $sTplName );
00360 }
00361
00362
00363 $oProduct->loadAmountPriceInfo();
00364
00365 parent::render();
00366
00367 $sPartial = oxConfig::getParameter('renderPartial');
00368 $this->addTplParam('sRenderPartial', $sPartial);
00369
00370 switch ($sPartial) {
00371 case "productInfo":
00372 return 'page/details/ajax/fullproductinfo.tpl';
00373 break;
00374 case "detailsMain":
00375 return 'page/details/ajax/productmain.tpl';
00376 break;
00377 default:
00378
00379 $oLocator = oxNew( 'oxlocator', $this->getListType() );
00380 $oLocator->setLocatorData( $oProduct, $this );
00381
00382 if ($myConfig->getConfigParam( 'bl_rssRecommLists' ) && $this->getSimilarRecommLists()) {
00383 $oRss = oxNew('oxrssfeed');
00384 $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00385 }
00386
00387 return $this->_sThisTemplate;
00388 }
00389 }
00390
00402 protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00403 {
00404 if ( !$sMeta ) {
00405 $oProduct = $this->getProduct();
00406
00407 $sMeta = $oProduct->getArticleLongDesc()->value;
00408 $sMeta = str_replace( array( '<br>', '<br />', '<br/>' ), "\n", $sMeta );
00409 $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00410 $sMeta = strip_tags( $sMeta );
00411 }
00412 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00413 }
00414
00425 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00426 {
00427 $myConfig = $this->getConfig();
00428
00429 if ( !$sKeywords ) {
00430 $oProduct = $this->getProduct();
00431 $aKeywords[] = trim( $this->getTitle() );
00432
00433 if ( $oCatTree = $this->getCategoryTree() ) {
00434 foreach ( $oCatTree->getPath() as $oCat ) {
00435 $aKeywords[] = trim( $oCat->oxcategories__oxtitle->value );
00436 }
00437 }
00438
00439 $sKeywords = implode( ", ", $aKeywords );
00440
00441 $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00442
00443
00444 if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00445 $sKeywords .= ", " . parent::_prepareMetaKeyword( $sSearchKeys, false );
00446 }
00447 }
00448
00449 return $sKeywords;
00450 }
00451
00457 public function canRate()
00458 {
00459 if ( $this->_blCanRate === null ) {
00460
00461 $this->_blCanRate = false;
00462 $myConfig = $this->getConfig();
00463
00464 if ( $myConfig->getConfigParam( 'bl_perfLoadReviews' ) &&
00465 $oUser = $this->getUser() ) {
00466
00467 $oRating = oxNew( 'oxrating' );
00468 $this->_blCanRate = $oRating->allowRating( $oUser->getId(), 'oxarticle', $this->getProduct()->getId() );
00469 }
00470 }
00471 return $this->_blCanRate;
00472 }
00473
00479 public function canChangeTags()
00480 {
00481 if ( $oUser = $this->getUser() ) {
00482
00483 return true;
00484 }
00485 return false;
00486 }
00487
00493 public function saveReview()
00494 {
00495 if ( $this->canAcceptFormData() &&
00496 ( $oUser = $this->getUser() ) && ( $oProduct = $this->getProduct() ) ) {
00497
00498 $dRating = oxConfig::getParameter( 'artrating' );
00499 if ( $dRating !== null ) {
00500 $dRating = (int) $dRating;
00501 }
00502
00503
00504 if ( $dRating !== null && $dRating >= 0 && $dRating <= 5 ) {
00505 $oRating = oxNew( 'oxrating' );
00506 if ( $oRating->allowRating( $oUser->getId(), 'oxarticle', $oProduct->getId() ) ) {
00507 $oRating->oxratings__oxuserid = new oxField( $oUser->getId() );
00508 $oRating->oxratings__oxtype = new oxField( 'oxarticle' );
00509 $oRating->oxratings__oxobjectid = new oxField( $oProduct->getId() );
00510 $oRating->oxratings__oxrating = new oxField( $dRating );
00511 $oRating->save();
00512 $oProduct->addToRatingAverage( $dRating );
00513 }
00514 }
00515
00516 if ( ( $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) ) ) ) {
00517 $oReview = oxNew( 'oxreview' );
00518 $oReview->oxreviews__oxobjectid = new oxField( $oProduct->getId() );
00519 $oReview->oxreviews__oxtype = new oxField( 'oxarticle' );
00520 $oReview->oxreviews__oxtext = new oxField( $sReviewText, oxField::T_RAW );
00521 $oReview->oxreviews__oxlang = new oxField( oxLang::getInstance()->getBaseLanguage() );
00522 $oReview->oxreviews__oxuserid = new oxField( $oUser->getId() );
00523 $oReview->oxreviews__oxrating = new oxField( ( $dRating !== null ) ? $dRating : null );
00524 $oReview->save();
00525 }
00526 }
00527 }
00528
00534 public function addToRecomm()
00535 {
00536 if (!$this->getViewConfig()->getShowListmania()) {
00537 return;
00538 }
00539
00540 $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00541 $sRecommList = oxConfig::getParameter( 'recomm' );
00542 $sArtId = $this->getProduct()->getId();
00543
00544 if ( $sArtId ) {
00545 $oRecomm = oxNew( 'oxrecommlist' );
00546 $oRecomm->load( $sRecommList);
00547 $oRecomm->addArticle( $sArtId, $sRecommText );
00548 }
00549 }
00550
00556 public function addTags()
00557 {
00558 $sTag = $this->getConfig()->getParameter('newTags', true );
00559 $sHighTag = $this->getConfig()->getParameter( 'highTags', true );
00560 if ( !$sTag && !$sHighTag) {
00561 return;
00562 }
00563 if ( $sHighTag ) {
00564 $sTag = getStr()->html_entity_decode( $sHighTag );
00565 }
00566
00567
00568 $aTags = array();
00569 $oProduct = $this->getProduct();
00570 $aTaggedProducts = oxSession::getVar("aTaggedProducts");
00571 if ( $aTaggedProducts ) {
00572 $aTags = $aTaggedProducts[$oProduct->getId()];
00573 }
00574 $blAddedTag = false;
00575
00576 if ( $aTags[$sTag] != 1 ) {
00577 $oProduct->addTag( $sTag );
00578 $aTags[$sTag] = 1;
00579 $aTaggedProducts[$oProduct->getId()] = $aTags;
00580 oxSession::setVar( 'aTaggedProducts', $aTaggedProducts);
00581 $blAddedTag = true;
00582 }
00583
00584 if ($this->getConfig()->getParameter('blAjax', true )) {
00585 die($blAddedTag);
00586 }
00587 }
00588
00594 public function editTags()
00595 {
00596 if ( !$this->getUser() ) {
00597 return;
00598 }
00599 $oTagCloud = oxNew("oxTagCloud");
00600 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00601 $this->_blEditTags = true;
00602
00603
00604 if ($this->getConfig()->getParameter('blAjax', true )) {
00605 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00606 $oActView = oxNew( 'oxubase' );
00607 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00608 $oSmarty->assign('oView', $this );
00609 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00610 die($oSmarty->fetch( 'page/details/inc/editTags.tpl', $this->getViewId() ));
00611 }
00612 }
00613
00619 public function cancelTags()
00620 {
00621 $oTagCloud = oxNew("oxTagCloud");
00622 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00623 $this->_blEditTags = false;
00624
00625
00626 if ($this->getConfig()->getParameter('blAjax', true )) {
00627 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00628 $oActView = oxNew( 'oxubase' );
00629 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00630 $oSmarty->assign('oView', $this );
00631 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00632 die($oSmarty->fetch( 'page/details/inc/tags.tpl', $this->getViewId() ));
00633 }
00634 }
00635
00641 protected function _getSeoObjectId()
00642 {
00643 if ( $oProduct = $this->getProduct() ) {
00644 return $oProduct->getId();
00645 }
00646 }
00647
00653 public function getAttributes()
00654 {
00655 if ( $this->_aAttributes === null ) {
00656
00657 $aArtAttributes = $this->getProduct()->getAttributes();
00658
00659
00660 $this->_aAttributes = false;
00661
00662 if ( count( $aArtAttributes ) ) {
00663 foreach ( $aArtAttributes as $sKey => $oAttribute ) {
00664 $this->_aAttributes[$sKey] = new stdClass();
00665 $this->_aAttributes[$sKey]->title = $oAttribute->oxattribute__oxtitle->value;
00666 $this->_aAttributes[$sKey]->value = $oAttribute->oxattribute__oxvalue->value;
00667 }
00668 }
00669 }
00670 return $this->_aAttributes;
00671 }
00672
00673
00679 public function getEditTags()
00680 {
00681 return $this->_blEditTags;
00682 }
00683
00689 public function getTags()
00690 {
00691 return $this->_aTags;
00692 }
00693
00699 public function getTagCloudManager()
00700 {
00701 $oManager = oxNew( "oxTagCloud" );
00702 $oManager->setExtendedMode( true );
00703 $oManager->setProductId( $this->getProduct()->getId() );
00704 return $oManager;
00705 }
00706
00713 public function isEditableTags()
00714 {
00715 if ( $this->_blCanEditTags === null ) {
00716 $this->_blCanEditTags = false;
00717 if ( $this->getProduct() && $this->getUser()) {
00718 $this->_blCanEditTags = true;
00719 }
00720 }
00721 return $this->_blCanEditTags;
00722 }
00723
00729 public function getProduct()
00730 {
00731 $myConfig = $this->getConfig();
00732 $myUtils = oxUtils::getInstance();
00733
00734 if ( $this->_oProduct === null ) {
00735
00736
00737
00738 $myConfig->setConfigParam( 'blLoadVariants', true );
00739
00740 $sOxid = oxConfig::getParameter( 'anid' );
00741
00742
00743 $this->_oProduct = oxNew( 'oxarticle' );
00744
00745
00746 if ( !$this->_oProduct->load( $sOxid ) ) {
00747 $myUtils->redirect( $myConfig->getShopHomeURL() );
00748 $myUtils->showMessageAndExit( '' );
00749 }
00750
00751 $aVariantSelections = $this->_oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
00752 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
00753 $this->_oProduct = $aVariantSelections['oActiveVariant'];
00754 }
00755 }
00756
00757
00758 if ( !$this->_blIsInitialized ) {
00759
00760 $blContinue = true;
00761 if ( !$this->_oProduct->isVisible() ) {
00762 $blContinue = false;
00763 } elseif ( $this->_oProduct->oxarticles__oxparentid->value ) {
00764 $oParent = $this->_getParentProduct( $this->_oProduct->oxarticles__oxparentid->value );
00765 if ( !$oParent || !$oParent->isVisible() ) {
00766 $blContinue = false;
00767 }
00768 }
00769
00770 if ( !$blContinue ) {
00771 $myUtils->redirect( $myConfig->getShopHomeURL() );
00772 $myUtils->showMessageAndExit( '' );
00773 }
00774
00775 $this->_processProduct( $this->_oProduct );
00776 $this->_blIsInitialized = true;
00777 }
00778
00779 return $this->_oProduct;
00780 }
00781
00787 public function getLinkType()
00788 {
00789 if ( $this->_iLinkType === null ) {
00790 $sListType = oxConfig::getParameter( 'listtype' );
00791 if ( 'vendor' == $sListType ) {
00792 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00793 } elseif ( 'manufacturer' == $sListType ) {
00794 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00795 } elseif ( 'tag' == $sListType ) {
00796 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00797 } elseif ( 'recommlist' == $sListType ) {
00798 $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
00799 } else {
00800 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00801
00802
00803 if ( ( $oCat = $this->getActCategory() ) && $oCat->isPriceCategory() ) {
00804 $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00805 }
00806 }
00807 }
00808
00809 return $this->_iLinkType;
00810 }
00811
00817 public function getVariantList()
00818 {
00819 return $this->loadVariantInformation();
00820 }
00821
00828 public function getVariantListExceptCurrent()
00829 {
00830 $oList = $this->getVariantList();
00831 if (is_object($oList)) {
00832 $oList = clone $oList;
00833 }
00834 $sOxid = $this->getProduct()->getId();
00835 if (isset($oList[$sOxid])) {
00836 unset($oList[$sOxid]);
00837 }
00838 return $oList;
00839 }
00840
00846 public function getCaptcha()
00847 {
00848 if ( $this->_oCaptcha === null ) {
00849 $this->_oCaptcha = oxNew('oxCaptcha');
00850 }
00851 return $this->_oCaptcha;
00852 }
00853
00859 public function getMediaFiles()
00860 {
00861 if ( $this->_aMediaFiles === null ) {
00862 $aMediaFiles = $this->getProduct()->getMediaUrls();
00863 $this->_aMediaFiles = count($aMediaFiles) ? $aMediaFiles : false;
00864 }
00865 return $this->_aMediaFiles;
00866 }
00867
00873 public function getLastProducts()
00874 {
00875 if ( $this->_aLastProducts === null ) {
00876
00877 $oProduct = $this->getProduct();
00878 $sArtId = $oProduct->oxarticles__oxparentid->value?$oProduct->oxarticles__oxparentid->value:$oProduct->getId();
00879
00880 $oHistoryArtList = oxNew( 'oxarticlelist' );
00881 $oHistoryArtList->loadHistoryArticles( $sArtId );
00882 $this->_aLastProducts = $oHistoryArtList;
00883 }
00884 return $this->_aLastProducts;
00885 }
00886
00892 public function getVendor()
00893 {
00894 if ( $this->_oVendor === null ) {
00895 $this->_oVendor = $this->getProduct()->getVendor( false );
00896 }
00897 return $this->_oVendor;
00898 }
00899
00905 public function getManufacturer()
00906 {
00907 if ( $this->_oManufacturer === null ) {
00908 $this->_oManufacturer = $this->getProduct()->getManufacturer( false );
00909 }
00910 return $this->_oManufacturer;
00911 }
00912
00918 public function getCategory()
00919 {
00920 if ( $this->_oCategory === null ) {
00921 $this->_oCategory = $this->getProduct()->getCategory();
00922 }
00923 return $this->_oCategory;
00924 }
00925
00931 public function drawParentUrl()
00932 {
00933 return $this->getProduct()->isVariant();
00934 }
00935
00941 public function getParentName()
00942 {
00943 if ( $this->_sParentName === null ) {
00944 $this->_sParentName = false;
00945 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00946 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00947 }
00948 }
00949 return $this->_sParentName;
00950 }
00951
00957 public function getParentUrl()
00958 {
00959 if ( $this->_sParentUrl === null ) {
00960 $this->_sParentUrl = false;
00961 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00962 $this->_sParentUrl = $oParent->getLink();
00963 }
00964 }
00965 return $this->_sParentUrl;
00966 }
00967
00973 public function getPictureGallery()
00974 {
00975 if ( $this->_aPicGallery === null ) {
00976
00977 $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
00978 }
00979 return $this->_aPicGallery;
00980 }
00981
00987 public function getActPictureId()
00988 {
00989 $aPicGallery = $this->getPictureGallery();
00990 return $aPicGallery['ActPicID'];
00991 }
00992
00998 public function getActPicture()
00999 {
01000 $aPicGallery = $this->getPictureGallery();
01001 return $aPicGallery['ActPic'];
01002 }
01003
01009 public function morePics()
01010 {
01011 $aPicGallery = $this->getPictureGallery();
01012 return $aPicGallery['MorePics'];
01013 }
01014
01020 public function getPictures()
01021 {
01022 $aPicGallery = $this->getPictureGallery();
01023 return $aPicGallery['Pics'];
01024 }
01025
01033 public function getArtPic( $sPicNr )
01034 {
01035 $aPicGallery = $this->getPictureGallery();
01036 return $aPicGallery['Pics'][$sPicNr];
01037 }
01038
01044 public function getIcons()
01045 {
01046 $aPicGallery = $this->getPictureGallery();
01047 return $aPicGallery['Icons'];
01048 }
01049
01055 public function showZoomPics()
01056 {
01057 $aPicGallery = $this->getPictureGallery();
01058 return $aPicGallery['ZoomPic'];
01059 }
01060
01066 public function getZoomPics()
01067 {
01068 $aPicGallery = $this->getPictureGallery();
01069 return $aPicGallery['ZoomPics'];
01070 }
01071
01077 public function getActZoomPic()
01078 {
01079 return 1;
01080 }
01081
01087 public function getSelectLists()
01088 {
01089 if ( $this->_aSelectLists === null ) {
01090 $this->_aSelectLists = false;
01091 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
01092 $this->_aSelectLists = $this->getProduct()->getSelectLists();
01093 }
01094 }
01095 return $this->_aSelectLists;
01096 }
01097
01103 public function getReviews()
01104 {
01105 if ( $this->_aReviews === null ) {
01106 $this->_aReviews = false;
01107 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
01108 $this->_aReviews = $this->getProduct()->getReviews();
01109 }
01110 }
01111 return $this->_aReviews;
01112 }
01113
01119 public function getCrossSelling()
01120 {
01121 if ( $this->_oCrossSelling === null ) {
01122 $this->_oCrossSelling = false;
01123 if ( $oProduct = $this->getProduct() ) {
01124 $this->_oCrossSelling = $oProduct->getCrossSelling();
01125 }
01126 }
01127 return $this->_oCrossSelling;
01128 }
01129
01135 public function getSimilarProducts()
01136 {
01137 if ( $this->_oSimilarProducts === null ) {
01138 $this->_oSimilarProducts = false;
01139 if ( $oProduct = $this->getProduct() ) {
01140 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
01141 }
01142 }
01143 return $this->_oSimilarProducts;
01144 }
01145
01151 public function getSimilarRecommLists()
01152 {
01153 if (!$this->getViewConfig()->getShowListmania()) {
01154 return false;
01155 }
01156
01157 if ( $this->_oRecommList === null ) {
01158 $this->_oRecommList = false;
01159 if ( $oProduct = $this->getProduct() ) {
01160 $oRecommList = oxNew('oxrecommlist');
01161 $this->_oRecommList = $oRecommList->getRecommListsByIds( array( $oProduct->getId() ) );
01162 }
01163 }
01164 return $this->_oRecommList;
01165 }
01166
01172 public function getAccessoires()
01173 {
01174 if ( $this->_oAccessoires === null ) {
01175 $this->_oAccessoires = false;
01176 if ( $oProduct = $this->getProduct() ) {
01177 $this->_oAccessoires = $oProduct->getAccessoires();
01178 }
01179 }
01180 return $this->_oAccessoires;
01181 }
01182
01188 public function getAlsoBoughtTheseProducts()
01189 {
01190 if ( $this->_aAlsoBoughtArts === null ) {
01191 $this->_aAlsoBoughtArts = false;
01192 if ( $oProduct = $this->getProduct() ) {
01193 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
01194 }
01195 }
01196 return $this->_aAlsoBoughtArts;
01197 }
01198
01204 public function isPriceAlarm()
01205 {
01206
01207 $oProduct = $this->getProduct();
01208 if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
01209 return 0;
01210 }
01211 return 1;
01212 }
01213
01222 protected function _getSubject( $iLang )
01223 {
01224 return $this->getProduct();
01225 }
01226
01232 public function getSearchTitle()
01233 {
01234 return $this->_sSearchTitle;
01235 }
01236
01244 public function setSearchTitle( $sTitle )
01245 {
01246 $this->_sSearchTitle = $sTitle;
01247 }
01248
01256 public function setCatTreePath( $sActCatPath )
01257 {
01258 $this->_sCatTreePath = $sActCatPath;
01259 }
01260
01267 public function noIndex()
01268 {
01269 $sListType = oxConfig::getParameter( 'listtype' );
01270 if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
01271 return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01272 }
01273 return parent::noIndex();
01274 }
01275
01281 public function getTitle()
01282 {
01283 if ( $oProduct = $this->getProduct() ) {
01284 return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' );
01285 }
01286 }
01287
01288
01294 public function getTag()
01295 {
01296 return oxConfig::getParameter("searchtag", 1);
01297 }
01298
01304 public function getCanonicalUrl()
01305 {
01306 if ( ( $oProduct = $this->getProduct() ) ) {
01307 $oUtils = oxUtilsUrl::getInstance();
01308 if ( oxUtils::getInstance()->seoIsActive() ) {
01309 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseSeoLink( $oProduct->getLanguage(), true ) );
01310 } else {
01311 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseStdLink( $oProduct->getLanguage() ) );
01312 }
01313 return $sUrl;
01314 }
01315 }
01316
01322 public function isMdVariantView()
01323 {
01324 if ( $this->_blMdView === null ) {
01325 $this->_blMdView = false;
01326 if ( $this->getConfig()->getConfigParam( 'blUseMultidimensionVariants' ) ) {
01327 $iMaxMdDepth = $this->getProduct()->getMdVariants()->getMaxDepth();
01328 $this->_blMdView = ($iMaxMdDepth > 1);
01329 }
01330 }
01331
01332 return $this->_blMdView;
01333 }
01334
01340 public function isPersParam()
01341 {
01342 $oProduct = $this->getProduct();
01343 return $oProduct->oxarticles__oxisconfigurable->value;
01344 }
01345
01351 public function getTagSeparator()
01352 {
01353 $sSepartor = $this->getConfig()->getConfigParam("sTagSeparator");
01354 return $sSepartor;
01355 }
01356
01362 public function getRatingValue()
01363 {
01364
01365 if ( $this->_dRatingValue === null ) {
01366 $this->_dRatingValue = (double) 0;
01367 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01368 $this->_dRatingValue = round( $oDetailsProduct->getArticleRatingAverage(), 1);
01369 }
01370 }
01371
01372 return (double) $this->_dRatingValue;
01373 }
01374
01380 public function isReviewActive()
01381 {
01382 return $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' );
01383 }
01384
01390 public function getRatingCount()
01391 {
01392 if ( $this->_iRatingCnt === null ) {
01393 $this->_iRatingCnt = false;
01394 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01395 $this->_iRatingCnt = $oDetailsProduct->oxarticles__oxratingcnt->value;
01396 }
01397 }
01398 return $this->_iRatingCnt;
01399 }
01400
01406 public function getBreadCrumb()
01407 {
01408 $aPaths = array();
01409
01410 if ( 'search' == oxConfig::getParameter( 'listtype' ) ) {
01411
01412 $aCatPath = array();
01413 $aCatPath['title'] = sprintf(oxLang::getInstance()->translateString( 'searchResult', oxLang::getInstance()->getBaseLanguage(), false ), oxConfig::getParameter( 'searchparam' ));
01414 $sLink = $this->getViewConfig()->getSelfLink() . 'stoken=' . oxSession::getVar('sess_stoken')
01415 . "&cl=search&searchparam=" . oxConfig::getParameter( 'searchparam' );
01416
01417 $aCatPath['link'] = $sLink;
01418
01419 $aPaths[] = $aCatPath;
01420
01421 } elseif ( 'tag' == oxConfig::getParameter( 'listtype' ) ) {
01422
01423 $aCatPath = array();
01424
01425 $aCatPath['title'] = oxLang::getInstance()->translateString( 'TAGS', oxLang::getInstance()->getBaseLanguage(), false );
01426 $aCatPath['link'] = oxSeoEncoder::getInstance()->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=tags' );
01427 $aPaths[] = $aCatPath;
01428
01429 $oStr = getStr();
01430 $aCatPath['title'] = $oStr->ucfirst(oxConfig::getParameter( 'searchtag' ));
01431 $aCatPath['link'] = oxSeoEncoderTag::getInstance()->getTagUrl( oxConfig::getParameter( 'searchtag' ) );
01432 $aPaths[] = $aCatPath;
01433
01434 } elseif ( 'recommlist' == oxConfig::getParameter( 'listtype' ) ) {
01435
01436 $aCatPath = array();
01437 $aCatPath['title'] = oxLang::getInstance()->translateString( 'PAGE_RECOMMENDATIONS_PRODUCTS_TITLE', oxLang::getInstance()->getBaseLanguage(), false );
01438 $aPaths[] = $aCatPath;
01439 } else {
01440
01441 $oCatTree = $this->getCatTreePath();
01442
01443 if ( $oCatTree ) {
01444
01445 foreach ( $oCatTree as $oCat ) {
01446 $aCatPath = array();
01447
01448 $aCatPath['link'] = $oCat->getLink();
01449 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
01450
01451 $aPaths[] = $aCatPath;
01452 }
01453 }
01454 }
01455
01456 return $aPaths;
01457 }
01458
01468 public function addme()
01469 {
01470 $myConfig = $this->getConfig();
01471 $myUtils = oxUtils::getInstance();
01472
01473
01474 $sMac = oxConfig::getParameter( 'c_mac' );
01475 $sMacHash = oxConfig::getParameter( 'c_mach' );
01476 $oCaptcha = $this->getCaptcha();
01477 if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) {
01478 $this->_iPriceAlarmStatus = 2;
01479 return;
01480 }
01481
01482 $aParams = oxConfig::getParameter( 'pa' );
01483 if ( !isset( $aParams['email'] ) || !$myUtils->isValidEmail( $aParams['email'] ) ) {
01484 $this->_iPriceAlarmStatus = 0;
01485 return;
01486 }
01487 $aParams['aid'] = $this->getProduct()->getId();
01488 $oCur = $myConfig->getActShopCurrencyObject();
01489
01490 $dPrice = $myUtils->currency2Float( $aParams['price'] );
01491
01492 $oAlarm = oxNew( "oxpricealarm" );
01493 $oAlarm->oxpricealarm__oxuserid = new oxField( oxSession::getVar( 'usr' ));
01494 $oAlarm->oxpricealarm__oxemail = new oxField( $aParams['email']);
01495 $oAlarm->oxpricealarm__oxartid = new oxField( $aParams['aid']);
01496 $oAlarm->oxpricealarm__oxprice = new oxField( $myUtils->fRound( $dPrice, $oCur ));
01497 $oAlarm->oxpricealarm__oxshopid = new oxField( $myConfig->getShopId());
01498 $oAlarm->oxpricealarm__oxcurrency = new oxField( $oCur->name);
01499
01500 $oAlarm->oxpricealarm__oxlang = new oxField(oxLang::getInstance()->getBaseLanguage());
01501
01502 $oAlarm->save();
01503
01504
01505 $oEmail = oxNew( 'oxemail' );
01506 $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification( $aParams, $oAlarm );
01507 }
01508
01514 public function getPriceAlarmStatus()
01515 {
01516 return $this->_iPriceAlarmStatus;
01517 }
01518
01524 public function getBidPrice()
01525 {
01526 if ( $this->_sBidPrice === null ) {
01527 $this->_sBidPrice = false;
01528
01529 $aParams = oxConfig::getParameter( 'pa' );
01530 $oCur = $this->getConfig()->getActShopCurrencyObject();
01531 $iPrice = oxUtils::getInstance()->currency2Float( $aParams['price'] );
01532 $this->_sBidPrice = oxLang::getInstance()->formatCurrency( $iPrice, $oCur );
01533 }
01534 return $this->_sBidPrice;
01535 }
01536
01542 public function getVariantSelections()
01543 {
01544
01545 $oProduct = $this->getProduct();
01546 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) ) {
01547 return $oParent->getVariantSelections( oxConfig::getParameter( "varselid" ), $oProduct->getId() );
01548 }
01549
01550 return $oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
01551 }
01552
01558 public function getPicturesProduct()
01559 {
01560 $aVariantSelections = $this->getVariantSelections();
01561 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
01562 return $aVariantSelections['oActiveVariant'];
01563 }
01564 return $this->getProduct();
01565 }
01566
01567
01573 public function isMoreTagsVisible()
01574 {
01575 return true;
01576 }
01577
01583 public function getSearchParamForHtml()
01584 {
01585 if ( $this->_sSearchParamForHtml === null ) {
01586 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' );
01587 }
01588 return $this->_sSearchParamForHtml;
01589 }
01590
01591 }