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 $oParent->setNoVariantLoading(false);
00269 $this->_aVariantList = $oParent->getFullVariants( false );
00270
00271
00272 if ( count( $this->_aVariantList ) && $myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
00273
00274 $oParent->enablePriceLoad();
00275 $oParent->aSelectlist = $oParent->getSelectLists();
00276 $this->_aVariantList = array_merge( array( $oParent ), $this->_aVariantList->getArray() );
00277 }
00278 } else {
00279
00280 $this->_aVariantList = $oProduct->getFullVariants( false );
00281 }
00282
00283
00284 foreach ( $this->_aVariantList as $oVariant ) {
00285 $this->_processProduct( $oVariant );
00286 }
00287
00288 }
00289
00290 return $this->_aVariantList;
00291 }
00292
00298 protected function _getAddUrlParams()
00299 {
00300 if ( $this->getListType() == "search" ) {
00301 return $this->getDynUrlParams();
00302 }
00303 }
00304
00312 protected function _processProduct( $oProduct )
00313 {
00314 $oProduct->setLinkType( $this->getLinkType() );
00315 if ( $sAddParams = $this->_getAddUrlParams() ) {
00316 $oProduct->appendLink( $sAddParams );
00317 }
00318 }
00319
00325 public function getViewId()
00326 {
00327 if ( isset( $this->_sViewId )) {
00328 return $this->_sViewId;
00329 }
00330
00331 $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|';
00332
00333
00334 return $this->_sViewId = $sViewId;
00335 }
00336
00337
00349 public function render()
00350 {
00351 $myConfig = $this->getConfig();
00352
00353 $oProduct = $this->getProduct();
00354
00355
00356 if ( $oProduct->oxarticles__oxtemplate->value ) {
00357 $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00358 }
00359
00360 if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00361 $this->_sThisTemplate = 'custom/'.basename ( $sTplName );
00362 }
00363
00364 parent::render();
00365
00366 $sPartial = oxConfig::getParameter('renderPartial');
00367 $this->addTplParam('sRenderPartial', $sPartial);
00368
00369 switch ($sPartial) {
00370 case "productInfo":
00371 return 'page/details/ajax/fullproductinfo.tpl';
00372 break;
00373 case "detailsMain":
00374 return 'page/details/ajax/productmain.tpl';
00375 break;
00376 default:
00377
00378 $oLocator = oxNew( 'oxlocator', $this->getListType() );
00379 $oLocator->setLocatorData( $oProduct, $this );
00380
00381 if ($myConfig->getConfigParam( 'bl_rssRecommLists' ) && $this->getSimilarRecommLists()) {
00382 $oRss = oxNew('oxrssfeed');
00383 $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00384 }
00385
00386 return $this->_sThisTemplate;
00387 }
00388 }
00389
00401 protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00402 {
00403 if ( !$sMeta ) {
00404 $oProduct = $this->getProduct();
00405
00406 if ( oxConfig::getInstance()->getConfigParam( 'bl_perfParseLongDescinSmarty' ) ) {
00407 $sMeta = $oProduct->getLongDesc();
00408 } else {
00409 $sMeta = $oProduct->getLongDescription()->value;
00410 }
00411 if ( $sMeta == '' ) {
00412 $sMeta = $oProduct->oxarticles__oxshortdesc->value;
00413 }
00414 $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00415 }
00416 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00417 }
00418
00429 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00430 {
00431 if ( !$sKeywords ) {
00432 $oProduct = $this->getProduct();
00433 $sKeywords = trim( $this->getTitle() );
00434
00435 if ( $oCatTree = $this->getCategoryTree() ) {
00436 foreach ( $oCatTree->getPath() as $oCat ) {
00437 $sKeywords .= ", " . trim( $oCat->oxcategories__oxtitle->value );
00438 }
00439 }
00440
00441
00442 if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00443 $sKeywords .= ", ". $sSearchKeys;
00444 }
00445
00446 $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00447 }
00448
00449 return $sKeywords;
00450 }
00451
00457 public function ratingIsActive()
00458 {
00459 $myConfig = $this->getConfig();
00460
00461 return $myConfig->getConfigParam( 'bl_perfLoadReviews' );
00462 }
00463
00469 public function canRate()
00470 {
00471 if ( $this->_blCanRate === null ) {
00472
00473 $this->_blCanRate = false;
00474 $myConfig = $this->getConfig();
00475
00476 if ( $this->ratingIsActive() && $oUser = $this->getUser() ) {
00477
00478 $oRating = oxNew( 'oxrating' );
00479 $this->_blCanRate = $oRating->allowRating( $oUser->getId(), 'oxarticle', $this->getProduct()->getId() );
00480 }
00481 }
00482
00483 return $this->_blCanRate;
00484 }
00485
00491 public function canChangeTags()
00492 {
00493 if ( $oUser = $this->getUser() ) {
00494
00495 return true;
00496 }
00497 return false;
00498 }
00499
00505 public function saveReview()
00506 {
00507 if ( $this->canAcceptFormData() &&
00508 ( $oUser = $this->getUser() ) && ( $oProduct = $this->getProduct() ) ) {
00509
00510 $dRating = oxConfig::getParameter( 'artrating' );
00511 if ( $dRating !== null ) {
00512 $dRating = (int) $dRating;
00513 }
00514
00515
00516 if ( $dRating !== null && $dRating >= 1 && $dRating <= 5 ) {
00517 $oRating = oxNew( 'oxrating' );
00518 if ( $oRating->allowRating( $oUser->getId(), 'oxarticle', $oProduct->getId() ) ) {
00519 $oRating->oxratings__oxuserid = new oxField( $oUser->getId() );
00520 $oRating->oxratings__oxtype = new oxField( 'oxarticle' );
00521 $oRating->oxratings__oxobjectid = new oxField( $oProduct->getId() );
00522 $oRating->oxratings__oxrating = new oxField( $dRating );
00523 $oRating->save();
00524 $oProduct->addToRatingAverage( $dRating );
00525 }
00526 }
00527
00528 if ( ( $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) ) ) ) {
00529 $oReview = oxNew( 'oxreview' );
00530 $oReview->oxreviews__oxobjectid = new oxField( $oProduct->getId() );
00531 $oReview->oxreviews__oxtype = new oxField( 'oxarticle' );
00532 $oReview->oxreviews__oxtext = new oxField( $sReviewText, oxField::T_RAW );
00533 $oReview->oxreviews__oxlang = new oxField( oxLang::getInstance()->getBaseLanguage() );
00534 $oReview->oxreviews__oxuserid = new oxField( $oUser->getId() );
00535 $oReview->oxreviews__oxrating = new oxField( ( $dRating !== null ) ? $dRating : 0);
00536 $oReview->save();
00537 }
00538 }
00539 }
00540
00546 public function addToRecomm()
00547 {
00548 if (!$this->getViewConfig()->getShowListmania()) {
00549 return;
00550 }
00551
00552 $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00553 $sRecommList = oxConfig::getParameter( 'recomm' );
00554 $sArtId = $this->getProduct()->getId();
00555
00556 if ( $sArtId ) {
00557 $oRecomm = oxNew( 'oxrecommlist' );
00558 $oRecomm->load( $sRecommList);
00559 $oRecomm->addArticle( $sArtId, $sRecommText );
00560 }
00561 }
00562
00568 public function addTags()
00569 {
00570 $sTag = $this->getConfig()->getParameter('newTags', true );
00571 $sHighTag = $this->getConfig()->getParameter( 'highTags', true );
00572 if ( !$sTag && !$sHighTag) {
00573 return;
00574 }
00575 if ( $sHighTag ) {
00576 $sTag = getStr()->html_entity_decode( $sHighTag );
00577 }
00578
00579
00580 $aTags = array();
00581 $oProduct = $this->getProduct();
00582 $aTaggedProducts = oxSession::getVar("aTaggedProducts");
00583 if ( $aTaggedProducts ) {
00584 $aTags = $aTaggedProducts[$oProduct->getId()];
00585 }
00586 $blAddedTag = false;
00587
00588 if ( $aTags[$sTag] != 1 ) {
00589 $oProduct->addTag( $sTag );
00590 $aTags[$sTag] = 1;
00591 $aTaggedProducts[$oProduct->getId()] = $aTags;
00592 oxSession::setVar( 'aTaggedProducts', $aTaggedProducts);
00593 $blAddedTag = true;
00594 }
00595
00596 if ($this->getConfig()->getParameter('blAjax', true )) {
00597 oxUtils::getInstance()->showMessageAndExit( $blAddedTag );
00598 }
00599 }
00600
00606 public function editTags()
00607 {
00608 if ( !$this->getUser() ) {
00609 return;
00610 }
00611 $oTagCloud = oxNew("oxTagCloud");
00612 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00613 $this->_blEditTags = true;
00614
00615
00616 if ($this->getConfig()->getParameter('blAjax', true )) {
00617 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00618 $oActView = oxNew( 'oxubase' );
00619 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00620 $oSmarty->assign('oView', $this );
00621 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00622 oxUtils::getInstance()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/editTags.tpl', $this->getViewId() ) );
00623 }
00624 }
00625
00631 public function cancelTags()
00632 {
00633 $oTagCloud = oxNew("oxTagCloud");
00634 $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00635 $this->_blEditTags = false;
00636
00637
00638 if ($this->getConfig()->getParameter('blAjax', true )) {
00639 oxUtils::getInstance()->setHeader( "Content-Type: text/html; charset=".oxLang::getInstance()->translateString( 'charset' ) );
00640 $oActView = oxNew( 'oxubase' );
00641 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00642 $oSmarty->assign('oView', $this );
00643 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00644 oxUtils::getInstance()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/tags.tpl', $this->getViewId() ) );
00645 }
00646 }
00647
00653 protected function _getSeoObjectId()
00654 {
00655 if ( $oProduct = $this->getProduct() ) {
00656 return $oProduct->getId();
00657 }
00658 }
00659
00665 public function getAttributes()
00666 {
00667 if ( $this->_aAttributes === null ) {
00668
00669 $aArtAttributes = $this->getProduct()->getAttributes();
00670
00671
00672 $this->_aAttributes = false;
00673
00674 if ( count( $aArtAttributes ) ) {
00675 foreach ( $aArtAttributes as $sKey => $oAttribute ) {
00676 $this->_aAttributes[$sKey] = new stdClass();
00677 $this->_aAttributes[$sKey]->title = $oAttribute->oxattribute__oxtitle->value;
00678 $this->_aAttributes[$sKey]->value = $oAttribute->oxattribute__oxvalue->value;
00679 }
00680 }
00681 }
00682 return $this->_aAttributes;
00683 }
00684
00685
00691 public function getEditTags()
00692 {
00693 return $this->_blEditTags;
00694 }
00695
00701 public function getTags()
00702 {
00703 return $this->_aTags;
00704 }
00705
00711 public function getTagCloudManager()
00712 {
00713 $oManager = oxNew( "oxTagCloud" );
00714 $oManager->setExtendedMode( true );
00715 $oManager->setProductId( $this->getProduct()->getId() );
00716 return $oManager;
00717 }
00718
00725 public function isEditableTags()
00726 {
00727 if ( $this->_blCanEditTags === null ) {
00728 $this->_blCanEditTags = false;
00729 if ( $this->getProduct() && $this->getUser()) {
00730 $this->_blCanEditTags = true;
00731 }
00732 }
00733 return $this->_blCanEditTags;
00734 }
00735
00741 public function getProduct()
00742 {
00743 $myConfig = $this->getConfig();
00744 $myUtils = oxUtils::getInstance();
00745
00746 if ( $this->_oProduct === null ) {
00747
00748
00749
00750 $myConfig->setConfigParam( 'blLoadVariants', true );
00751
00752 $sOxid = oxConfig::getParameter( 'anid' );
00753
00754
00755 $this->_oProduct = oxNew( 'oxarticle' );
00756
00757
00758 if ( !$this->_oProduct->load( $sOxid ) ) {
00759 $myUtils->redirect( $myConfig->getShopHomeURL() );
00760 $myUtils->showMessageAndExit( '' );
00761 }
00762
00763 $aVariantSelections = $this->_oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
00764 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
00765 $this->_oProduct = $aVariantSelections['oActiveVariant'];
00766 }
00767 }
00768
00769
00770 if ( !$this->_blIsInitialized ) {
00771
00772 $blContinue = true;
00773 if ( !$this->_oProduct->isVisible() ) {
00774 $blContinue = false;
00775 } elseif ( $this->_oProduct->oxarticles__oxparentid->value ) {
00776 $oParent = $this->_getParentProduct( $this->_oProduct->oxarticles__oxparentid->value );
00777 if ( !$oParent || !$oParent->isVisible() ) {
00778 $blContinue = false;
00779 }
00780 }
00781
00782 if ( !$blContinue ) {
00783 $myUtils->redirect( $myConfig->getShopHomeURL() );
00784 $myUtils->showMessageAndExit( '' );
00785 }
00786
00787 $this->_processProduct( $this->_oProduct );
00788 $this->_blIsInitialized = true;
00789 }
00790
00791 return $this->_oProduct;
00792 }
00793
00799 public function getLinkType()
00800 {
00801 if ( $this->_iLinkType === null ) {
00802 $sListType = oxConfig::getParameter( 'listtype' );
00803 if ( 'vendor' == $sListType ) {
00804 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00805 } elseif ( 'manufacturer' == $sListType ) {
00806 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00807 } elseif ( 'tag' == $sListType ) {
00808 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00809 } elseif ( 'recommlist' == $sListType ) {
00810 $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
00811 } else {
00812 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00813
00814
00815 if ( ( $oCat = $this->getActCategory() ) && $oCat->isPriceCategory() ) {
00816 $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00817 }
00818 }
00819 }
00820
00821 return $this->_iLinkType;
00822 }
00823
00829 public function getVariantList()
00830 {
00831 return $this->loadVariantInformation();
00832 }
00833
00840 public function getVariantListExceptCurrent()
00841 {
00842 $oList = $this->getVariantList();
00843 if (is_object($oList)) {
00844 $oList = clone $oList;
00845 }
00846
00847 $sOxid = $this->getProduct()->getId();
00848 if (isset($oList[$sOxid])) {
00849 unset($oList[$sOxid]);
00850 }
00851 return $oList;
00852 }
00853
00859 public function getCaptcha()
00860 {
00861 if ( $this->_oCaptcha === null ) {
00862 $this->_oCaptcha = oxNew('oxCaptcha');
00863 }
00864 return $this->_oCaptcha;
00865 }
00866
00872 public function getMediaFiles()
00873 {
00874 if ( $this->_aMediaFiles === null ) {
00875 $aMediaFiles = $this->getProduct()->getMediaUrls();
00876 $this->_aMediaFiles = count($aMediaFiles) ? $aMediaFiles : false;
00877 }
00878 return $this->_aMediaFiles;
00879 }
00880
00888 public function getLastProducts( $iCnt = 4 )
00889 {
00890 if ( $this->_aLastProducts === null ) {
00891
00892 $oProduct = $this->getProduct();
00893 $sArtId = $oProduct->oxarticles__oxparentid->value?$oProduct->oxarticles__oxparentid->value:$oProduct->getId();
00894
00895 $oHistoryArtList = oxNew( 'oxarticlelist' );
00896 $oHistoryArtList->loadHistoryArticles( $sArtId, $iCnt );
00897 $this->_aLastProducts = $oHistoryArtList;
00898 }
00899 return $this->_aLastProducts;
00900 }
00901
00907 public function getVendor()
00908 {
00909 if ( $this->_oVendor === null ) {
00910 $this->_oVendor = $this->getProduct()->getVendor( false );
00911 }
00912 return $this->_oVendor;
00913 }
00914
00920 public function getManufacturer()
00921 {
00922 if ( $this->_oManufacturer === null ) {
00923 $this->_oManufacturer = $this->getProduct()->getManufacturer( false );
00924 }
00925 return $this->_oManufacturer;
00926 }
00927
00933 public function getCategory()
00934 {
00935 if ( $this->_oCategory === null ) {
00936 $this->_oCategory = $this->getProduct()->getCategory();
00937 }
00938 return $this->_oCategory;
00939 }
00940
00946 public function drawParentUrl()
00947 {
00948 return $this->getProduct()->isVariant();
00949 }
00950
00956 public function getParentName()
00957 {
00958 if ( $this->_sParentName === null ) {
00959 $this->_sParentName = false;
00960 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00961 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00962 }
00963 }
00964 return $this->_sParentName;
00965 }
00966
00972 public function getParentUrl()
00973 {
00974 if ( $this->_sParentUrl === null ) {
00975 $this->_sParentUrl = false;
00976 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00977 $this->_sParentUrl = $oParent->getLink();
00978 }
00979 }
00980 return $this->_sParentUrl;
00981 }
00982
00988 public function getPictureGallery()
00989 {
00990 if ( $this->_aPicGallery === null ) {
00991
00992 $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
00993 }
00994 return $this->_aPicGallery;
00995 }
00996
01002 public function getActPictureId()
01003 {
01004 $aPicGallery = $this->getPictureGallery();
01005 return $aPicGallery['ActPicID'];
01006 }
01007
01013 public function getActPicture()
01014 {
01015 $aPicGallery = $this->getPictureGallery();
01016 return $aPicGallery['ActPic'];
01017 }
01018
01024 public function morePics()
01025 {
01026 $aPicGallery = $this->getPictureGallery();
01027 return $aPicGallery['MorePics'];
01028 }
01029
01035 public function getPictures()
01036 {
01037 $aPicGallery = $this->getPictureGallery();
01038 return $aPicGallery['Pics'];
01039 }
01040
01048 public function getArtPic( $sPicNr )
01049 {
01050 $aPicGallery = $this->getPictureGallery();
01051 return $aPicGallery['Pics'][$sPicNr];
01052 }
01053
01059 public function getIcons()
01060 {
01061 $aPicGallery = $this->getPictureGallery();
01062 return $aPicGallery['Icons'];
01063 }
01064
01070 public function showZoomPics()
01071 {
01072 $aPicGallery = $this->getPictureGallery();
01073 return $aPicGallery['ZoomPic'];
01074 }
01075
01081 public function getZoomPics()
01082 {
01083 $aPicGallery = $this->getPictureGallery();
01084 return $aPicGallery['ZoomPics'];
01085 }
01086
01092 public function getActZoomPic()
01093 {
01094 return 1;
01095 }
01096
01102 public function getSelectLists()
01103 {
01104 if ( $this->_aSelectLists === null ) {
01105 $this->_aSelectLists = false;
01106 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
01107 $this->_aSelectLists = $this->getProduct()->getSelectLists();
01108 }
01109 }
01110 return $this->_aSelectLists;
01111 }
01112
01118 public function getReviews()
01119 {
01120 if ( $this->_aReviews === null ) {
01121 $this->_aReviews = false;
01122 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
01123 $this->_aReviews = $this->getProduct()->getReviews();
01124 }
01125 }
01126 return $this->_aReviews;
01127 }
01128
01134 public function getCrossSelling()
01135 {
01136 if ( $this->_oCrossSelling === null ) {
01137 $this->_oCrossSelling = false;
01138 if ( $oProduct = $this->getProduct() ) {
01139 $this->_oCrossSelling = $oProduct->getCrossSelling();
01140 }
01141 }
01142 return $this->_oCrossSelling;
01143 }
01144
01150 public function getSimilarProducts()
01151 {
01152 if ( $this->_oSimilarProducts === null ) {
01153 $this->_oSimilarProducts = false;
01154 if ( $oProduct = $this->getProduct() ) {
01155 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
01156 }
01157 }
01158 return $this->_oSimilarProducts;
01159 }
01160
01166 public function getSimilarRecommLists()
01167 {
01168 if (!$this->getViewConfig()->getShowListmania()) {
01169 return false;
01170 }
01171
01172 if ( $this->_oRecommList === null ) {
01173 $this->_oRecommList = false;
01174 if ( $oProduct = $this->getProduct() ) {
01175 $oRecommList = oxNew('oxrecommlist');
01176 $this->_oRecommList = $oRecommList->getRecommListsByIds( array( $oProduct->getId() ) );
01177 }
01178 }
01179 return $this->_oRecommList;
01180 }
01181
01187 public function getAccessoires()
01188 {
01189 if ( $this->_oAccessoires === null ) {
01190 $this->_oAccessoires = false;
01191 if ( $oProduct = $this->getProduct() ) {
01192 $this->_oAccessoires = $oProduct->getAccessoires();
01193 }
01194 }
01195 return $this->_oAccessoires;
01196 }
01197
01203 public function getAlsoBoughtTheseProducts()
01204 {
01205 if ( $this->_aAlsoBoughtArts === null ) {
01206 $this->_aAlsoBoughtArts = false;
01207 if ( $oProduct = $this->getProduct() ) {
01208 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
01209 }
01210 }
01211 return $this->_aAlsoBoughtArts;
01212 }
01213
01219 public function isPriceAlarm()
01220 {
01221
01222 $oProduct = $this->getProduct();
01223 if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
01224 return 0;
01225 }
01226 return 1;
01227 }
01228
01237 protected function _getSubject( $iLang )
01238 {
01239 return $this->getProduct();
01240 }
01241
01247 public function getSearchTitle()
01248 {
01249 return $this->_sSearchTitle;
01250 }
01251
01259 public function setSearchTitle( $sTitle )
01260 {
01261 $this->_sSearchTitle = $sTitle;
01262 }
01263
01271 public function setCatTreePath( $sActCatPath )
01272 {
01273 $this->_sCatTreePath = $sActCatPath;
01274 }
01275
01282 public function noIndex()
01283 {
01284 $sListType = oxConfig::getParameter( 'listtype' );
01285 if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
01286 return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01287 }
01288 return parent::noIndex();
01289 }
01290
01296 public function getTitle()
01297 {
01298 if ( $oProduct = $this->getProduct() ) {
01299 return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' );
01300 }
01301 }
01302
01303
01309 public function getTag()
01310 {
01311 return oxConfig::getParameter("searchtag", 1);
01312 }
01313
01319 public function getCanonicalUrl()
01320 {
01321 if ( ( $oProduct = $this->getProduct() ) ) {
01322 if ( $oProduct->oxarticles__oxparentid->value ) {
01323 $oProduct = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value );
01324 }
01325
01326 $oUtils = oxUtilsUrl::getInstance();
01327 if ( oxUtils::getInstance()->seoIsActive() ) {
01328 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseSeoLink( $oProduct->getLanguage(), true ) );
01329 } else {
01330 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseStdLink( $oProduct->getLanguage() ) );
01331 }
01332 return $sUrl;
01333 }
01334 }
01335
01341 public function isMdVariantView()
01342 {
01343 if ( $this->_blMdView === null ) {
01344 $this->_blMdView = false;
01345 if ( $this->getConfig()->getConfigParam( 'blUseMultidimensionVariants' ) ) {
01346 $iMaxMdDepth = $this->getProduct()->getMdVariants()->getMaxDepth();
01347 $this->_blMdView = ($iMaxMdDepth > 1);
01348 }
01349 }
01350
01351 return $this->_blMdView;
01352 }
01353
01359 public function isPersParam()
01360 {
01361 $oProduct = $this->getProduct();
01362 return $oProduct->oxarticles__oxisconfigurable->value;
01363 }
01364
01370 public function getTagSeparator()
01371 {
01372 $sSepartor = $this->getConfig()->getConfigParam("sTagSeparator");
01373 return $sSepartor;
01374 }
01375
01381 public function getRatingValue()
01382 {
01383
01384 if ( $this->_dRatingValue === null ) {
01385 $this->_dRatingValue = (double) 0;
01386 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01387 $this->_dRatingValue = round( $oDetailsProduct->getArticleRatingAverage( $this->getConfig()->getConfigParam( 'blShowVariantReviews' ) ), 1);
01388 }
01389 }
01390
01391 return (double) $this->_dRatingValue;
01392 }
01393
01399 public function isReviewActive()
01400 {
01401 return $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' );
01402 }
01403
01409 public function getRatingCount()
01410 {
01411 if ( $this->_iRatingCnt === null ) {
01412 $this->_iRatingCnt = false;
01413 if ( $this->isReviewActive() && ( $oDetailsProduct = $this->getProduct() ) ) {
01414 $this->_iRatingCnt = $oDetailsProduct->getArticleRatingCount( $this->getConfig()->getConfigParam( 'blShowVariantReviews' ) );
01415 }
01416 }
01417 return $this->_iRatingCnt;
01418 }
01419
01425 public function getBreadCrumb()
01426 {
01427 $aPaths = array();
01428
01429 if ( 'search' == oxConfig::getParameter( 'listtype' ) ) {
01430 $sSearchParam = $this->getSearchParamForHtml();
01431
01432 $aCatPath = array();
01433 $aCatPath['title'] = sprintf( oxLang::getInstance()->translateString( 'searchResult', oxLang::getInstance()->getBaseLanguage(), false ), $sSearchParam );
01434 $aCatPath['link'] = $this->getViewConfig()->getSelfLink() . 'stoken=' . oxSession::getVar('sess_stoken') . "&cl=search&searchparam=" . $sSearchParam;
01435
01436 $aPaths[] = $aCatPath;
01437
01438 } elseif ( 'tag' == oxConfig::getParameter( 'listtype' ) ) {
01439
01440 $aCatPath = array();
01441
01442 $aCatPath['title'] = oxLang::getInstance()->translateString( 'TAGS', oxLang::getInstance()->getBaseLanguage(), false );
01443 $aCatPath['link'] = oxSeoEncoder::getInstance()->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=tags' );
01444 $aPaths[] = $aCatPath;
01445
01446 $oStr = getStr();
01447 $aCatPath['title'] = $oStr->ucfirst(oxConfig::getParameter( 'searchtag' ));
01448 $aCatPath['link'] = oxSeoEncoderTag::getInstance()->getTagUrl( oxConfig::getParameter( 'searchtag' ) );
01449 $aPaths[] = $aCatPath;
01450
01451 } elseif ( 'recommlist' == oxConfig::getParameter( 'listtype' ) ) {
01452
01453 $aCatPath = array();
01454 $aCatPath['title'] = oxLang::getInstance()->translateString( 'PAGE_RECOMMENDATIONS_PRODUCTS_TITLE', oxLang::getInstance()->getBaseLanguage(), false );
01455 $aPaths[] = $aCatPath;
01456 } else {
01457
01458 $oCatTree = $this->getCatTreePath();
01459
01460 if ( $oCatTree ) {
01461
01462 foreach ( $oCatTree as $oCat ) {
01463 $aCatPath = array();
01464
01465 $aCatPath['link'] = $oCat->getLink();
01466 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
01467
01468 $aPaths[] = $aCatPath;
01469 }
01470 }
01471 }
01472
01473 return $aPaths;
01474 }
01475
01485 public function addme()
01486 {
01487 $myConfig = $this->getConfig();
01488 $myUtils = oxUtils::getInstance();
01489
01490
01491 $sMac = oxConfig::getParameter( 'c_mac' );
01492 $sMacHash = oxConfig::getParameter( 'c_mach' );
01493 $oCaptcha = $this->getCaptcha();
01494 if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) {
01495 $this->_iPriceAlarmStatus = 2;
01496 return;
01497 }
01498
01499 $aParams = oxConfig::getParameter( 'pa' );
01500 if ( !isset( $aParams['email'] ) || !$myUtils->isValidEmail( $aParams['email'] ) ) {
01501 $this->_iPriceAlarmStatus = 0;
01502 return;
01503 }
01504 $aParams['aid'] = $this->getProduct()->getId();
01505 $oCur = $myConfig->getActShopCurrencyObject();
01506
01507 $dPrice = $myUtils->currency2Float( $aParams['price'] );
01508
01509 $oAlarm = oxNew( "oxpricealarm" );
01510 $oAlarm->oxpricealarm__oxuserid = new oxField( oxSession::getVar( 'usr' ));
01511 $oAlarm->oxpricealarm__oxemail = new oxField( $aParams['email']);
01512 $oAlarm->oxpricealarm__oxartid = new oxField( $aParams['aid']);
01513 $oAlarm->oxpricealarm__oxprice = new oxField( $myUtils->fRound( $dPrice, $oCur ));
01514 $oAlarm->oxpricealarm__oxshopid = new oxField( $myConfig->getShopId());
01515 $oAlarm->oxpricealarm__oxcurrency = new oxField( $oCur->name);
01516
01517 $oAlarm->oxpricealarm__oxlang = new oxField(oxLang::getInstance()->getBaseLanguage());
01518
01519 $oAlarm->save();
01520
01521
01522 $oEmail = oxNew( 'oxemail' );
01523 $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification( $aParams, $oAlarm );
01524 }
01525
01531 public function getPriceAlarmStatus()
01532 {
01533 return $this->_iPriceAlarmStatus;
01534 }
01535
01541 public function getBidPrice()
01542 {
01543 if ( $this->_sBidPrice === null ) {
01544 $this->_sBidPrice = false;
01545
01546 $aParams = oxConfig::getParameter( 'pa' );
01547 $oCur = $this->getConfig()->getActShopCurrencyObject();
01548 $iPrice = oxUtils::getInstance()->currency2Float( $aParams['price'] );
01549 $this->_sBidPrice = oxLang::getInstance()->formatCurrency( $iPrice, $oCur );
01550 }
01551 return $this->_sBidPrice;
01552 }
01553
01559 public function getVariantSelections()
01560 {
01561
01562 $oProduct = $this->getProduct();
01563 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) ) {
01564 return $oParent->getVariantSelections( oxConfig::getParameter( "varselid" ), $oProduct->getId() );
01565 }
01566
01567 return $oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
01568 }
01569
01575 public function getPicturesProduct()
01576 {
01577 $aVariantSelections = $this->getVariantSelections();
01578 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
01579 return $aVariantSelections['oActiveVariant'];
01580 }
01581 return $this->getProduct();
01582 }
01583
01584
01590 public function isMoreTagsVisible()
01591 {
01592 return true;
01593 }
01594
01600 public function getSearchParamForHtml()
01601 {
01602 if ( $this->_sSearchParamForHtml === null ) {
01603 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' );
01604 }
01605 return $this->_sSearchParamForHtml;
01606 }
01607
01613 public function showRdfa()
01614 {
01615 return $this->getConfig()->getConfigParam( 'blRDFaEmbedding' );
01616 }
01617
01623 public function getRDFaNormalizedRating()
01624 {
01625 $myConfig = $this->getConfig();
01626 $iMin = $myConfig->getConfigParam("iRDFaMinRating");
01627 $iMax = $myConfig->getConfigParam("iRDFaMaxRating");
01628
01629 $oProduct = $this->getProduct();
01630 $iCount = $oProduct->oxarticles__oxratingcnt->value;
01631 if ( isset($iMin) && isset($iMax) && $iMax != '' && $iMin != '' && $iCount > 0 ) {
01632 $aNomalizedRating = array();
01633 $iValue = ((4*($oProduct->oxarticles__oxrating->value - $iMin)/($iMax - $iMin)))+1;
01634 $aNomalizedRating["count"] = $iCount;
01635 $aNomalizedRating["value"] = round($iValue, 2);
01636 return $aNomalizedRating;
01637 }
01638 return false;
01639 }
01640
01648 public function getRDFaValidityPeriod($sShopConfVar)
01649 {
01650 if ( $sShopConfVar ) {
01651 $aValidity = array();
01652 $iDays = $this->getConfig()->getConfigParam($sShopConfVar);
01653 $iFrom = oxUtilsDate::getInstance()->getTime();
01654
01655 $iThrough = $iFrom + ($iDays * 24 * 60 * 60);
01656 $aValidity["from"] = date('Y-m-d\TH:i:s', $iFrom)."Z";
01657 $aValidity["through"] = date('Y-m-d\TH:i:s', $iThrough)."Z";
01658
01659 return $aValidity;
01660 }
01661 return false;
01662 }
01663
01669 public function getRDFaBusinessFnc()
01670 {
01671 return $this->getConfig()->getConfigParam("sRDFaBusinessFnc");
01672 }
01673
01679 public function getRDFaCustomers()
01680 {
01681 return $this->getConfig()->getConfigParam("aRDFaCustomers");
01682 }
01683
01689 public function getRDFaVAT()
01690 {
01691 return $this->getConfig()->getConfigParam("iRDFaVAT");
01692 }
01693
01699 public function getRDFaGenericCondition()
01700 {
01701 return $this->getConfig()->getConfigParam("iRDFaCondition");
01702 }
01703
01709 public function getBundleArticle()
01710 {
01711 $oProduct = $this->getProduct();
01712 if ( $oProduct && $oProduct->oxarticles__oxbundleid->value ) {
01713 $oArticle = oxNew("oxarticle");
01714 $oArticle->load($oProduct->oxarticles__oxbundleid->value);
01715 return $oArticle;
01716 }
01717 return false;
01718 }
01719
01725 public function getRDFaPaymentMethods()
01726 {
01727 $iPrice = $this->getProduct()->getPrice()->getBruttoPrice();
01728 $oPayments = oxNew("oxpaymentlist");
01729 $oPayments->loadRDFaPaymentList($iPrice);
01730 return $oPayments;
01731 }
01732
01738 public function getRDFaDeliverySetMethods()
01739 {
01740 $oDelSets = oxNew("oxdeliverysetlist");
01741 $oDelSets->loadRDFaDeliverySetList();
01742 return $oDelSets;
01743 }
01744
01750 public function getProductsDeliveryList()
01751 {
01752 $oProduct = $this->getProduct();
01753 $oDelList = oxNew( "oxDeliveryList" );
01754 $oDelList->loadDeliveryListForProduct( $oProduct );
01755 return $oDelList;
01756 }
01757
01763 public function getRDFaDeliveryChargeSpecLoc()
01764 {
01765 return $this->getConfig()->getConfigParam("sRDFaDeliveryChargeSpecLoc");
01766 }
01767
01773 public function getRDFaPaymentChargeSpecLoc()
01774 {
01775 return $this->getConfig()->getConfigParam("sRDFaPaymentChargeSpecLoc");
01776 }
01777
01783 public function getRDFaBusinessEntityLoc()
01784 {
01785 return $this->getConfig()->getConfigParam("sRDFaBusinessEntityLoc");
01786 }
01787
01793 public function showRDFaProductStock()
01794 {
01795 return $this->getConfig()->getConfigParam("blShowRDFaProductStock");
01796 }
01797
01798 }