00001 <?php
00002
00009 class Details extends oxUBase
00010 {
00016 protected $_sThisTemplate = 'page/details/details.tpl';
00017
00023 protected $_oParentProd = null;
00024
00029 protected $_blEditTags = null;
00030
00035 protected $_aTags = null;
00036
00041 protected $_oCaptcha = null;
00042
00047 protected $_sParentName = null;
00048
00053 protected $_sParentUrl = null;
00054
00059 protected $_aPicGallery = null;
00060
00065 protected $_aSelectLists = null;
00066
00071 protected $_aReviews = null;
00072
00077 protected $_oCrossSelling = null;
00078
00083 protected $_oSimilarProducts = null;
00084
00089 protected $_oAccessoires = null;
00090
00095 protected $_aAlsoBoughtArts = null;
00096
00101 protected $_sSearchTitle = null;
00102
00108 protected $_blIsInitialized = false;
00109
00115 protected $_iLinkType = null;
00116
00121 protected $_sBidPrice = null;
00122
00127 protected $_iPriceAlarmStatus = null;
00128
00133 protected $_sSearchParamForHtml = null;
00134
00140 protected $_aSimilarRecommListIds = null;
00141
00142
00147 protected $_blShowSorting = true;
00148
00156 protected function _getParentProduct( $sParentId )
00157 {
00158 if ( $sParentId && $this->_oParentProd === null ) {
00159 $this->_oParentProd = false;
00160 $oProduct = oxNew( 'oxArticle' );
00161 if ( ( $oProduct->load( $sParentId ) ) ) {
00162 $this->_processProduct( $oProduct );
00163 $this->_oParentProd = $oProduct;
00164 }
00165 }
00166 return $this->_oParentProd;
00167 }
00168
00174 protected function _getAddUrlParams()
00175 {
00176 if ( $this->getListType() == "search" ) {
00177 return $this->getDynUrlParams();
00178 }
00179 }
00180
00189 public function getNavigationParams()
00190 {
00191 $aParams = parent::getNavigationParams();
00192
00193 $aVarselParams = oxRegistry::getConfig()->getRequestParameter( 'varselid' );
00194 $aSelectListParams = oxRegistry::getConfig()->getRequestParameter( 'sel' );
00195 if ( !$aVarselParams && !$aSelectListParams ) {
00196 return $aParams;
00197 }
00198
00199 if ( $aVarselParams ) {
00200 foreach ( $aVarselParams as $iKey => $sValue ) {
00201 $aParams["varselid[$iKey]"] = $sValue;
00202 }
00203 }
00204
00205 if ( $aSelectListParams ) {
00206 foreach ( $aSelectListParams as $iKey => $sValue ) {
00207 $aParams["sel[$iKey]"] = $sValue;
00208 }
00209 }
00210 return $aParams;
00211 }
00212
00213
00221 protected function _processProduct( $oProduct )
00222 {
00223 $oProduct->setLinkType( $this->getLinkType() );
00224 if ( $sAddParams = $this->_getAddUrlParams() ) {
00225 $oProduct->appendLink( $sAddParams );
00226 }
00227 }
00228
00234 public function getViewId()
00235 {
00236 if ( isset( $this->_sViewId )) {
00237 return $this->_sViewId;
00238 }
00239
00240 $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|';
00241
00242
00243 return $this->_sViewId = $sViewId;
00244 }
00245
00246
00258 public function render()
00259 {
00260 $myConfig = $this->getConfig();
00261
00262 $oProduct = $this->getProduct();
00263
00264
00265 if ( $oProduct->oxarticles__oxtemplate->value ) {
00266 $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00267 }
00268
00269 if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00270 $this->_sThisTemplate = 'custom/'.basename ( $sTplName );
00271 }
00272
00273 parent::render();
00274
00275 $sPartial = oxConfig::getParameter('renderPartial');
00276 $this->addTplParam('renderPartial', $sPartial);
00277
00278 switch ($sPartial) {
00279 case "productInfo":
00280 return 'page/details/ajax/fullproductinfo.tpl';
00281 break;
00282 case "detailsMain":
00283 return 'page/details/ajax/productmain.tpl';
00284 break;
00285 default:
00286
00287 $oLocator = oxNew( 'oxLocator', $this->getListType() );
00288 $oLocator->setLocatorData( $oProduct, $this );
00289
00290 if ($myConfig->getConfigParam( 'bl_rssRecommLists' ) && $this->getSimilarRecommListIds()) {
00291 $oRss = oxNew('oxrssfeed');
00292 $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00293 }
00294
00295 return $this->_sThisTemplate;
00296 }
00297 }
00298
00310 protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00311 {
00312 if ( !$sMeta ) {
00313 $oProduct = $this->getProduct();
00314
00315 if ( $this->getConfig()->getConfigParam( 'bl_perfParseLongDescinSmarty' ) ) {
00316 $sMeta = $oProduct->getLongDesc();
00317 } else {
00318 $sMeta = $oProduct->getLongDescription()->value;
00319 }
00320 if ( $sMeta == '' ) {
00321 $sMeta = $oProduct->oxarticles__oxshortdesc->value;
00322 }
00323 $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00324 }
00325 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00326 }
00327
00338 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00339 {
00340 if ( !$sKeywords ) {
00341 $oProduct = $this->getProduct();
00342 $sKeywords = trim( $this->getTitle() );
00343
00344 if ( $oCatTree = $this->getCategoryTree() ) {
00345 foreach ( $oCatTree->getPath() as $oCat ) {
00346 $sKeywords .= ", " . trim( $oCat->oxcategories__oxtitle->value );
00347 }
00348 }
00349
00350
00351 if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00352 $sKeywords .= ", ". $sSearchKeys;
00353 }
00354
00355 $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00356 }
00357
00358 return $sKeywords;
00359 }
00360
00366 public function saveReview()
00367 {
00368 if ( $this->canAcceptFormData() &&
00369 ( $oUser = $this->getUser() ) && ( $oProduct = $this->getProduct() ) ) {
00370
00371 $dRating = oxConfig::getParameter( 'artrating' );
00372 if ( $dRating !== null ) {
00373 $dRating = (int) $dRating;
00374 }
00375
00376
00377 if ( $dRating !== null && $dRating >= 1 && $dRating <= 5 ) {
00378 $oRating = oxNew( 'oxrating' );
00379 if ( $oRating->allowRating( $oUser->getId(), 'oxarticle', $oProduct->getId() ) ) {
00380 $oRating->oxratings__oxuserid = new oxField( $oUser->getId() );
00381 $oRating->oxratings__oxtype = new oxField( 'oxarticle' );
00382 $oRating->oxratings__oxobjectid = new oxField( $oProduct->getId() );
00383 $oRating->oxratings__oxrating = new oxField( $dRating );
00384 $oRating->save();
00385 $oProduct->addToRatingAverage( $dRating );
00386 }
00387 }
00388
00389 if ( ( $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) ) ) ) {
00390 $oReview = oxNew( 'oxreview' );
00391 $oReview->oxreviews__oxobjectid = new oxField( $oProduct->getId() );
00392 $oReview->oxreviews__oxtype = new oxField( 'oxarticle' );
00393 $oReview->oxreviews__oxtext = new oxField( $sReviewText, oxField::T_RAW );
00394 $oReview->oxreviews__oxlang = new oxField( oxRegistry::getLang()->getBaseLanguage() );
00395 $oReview->oxreviews__oxuserid = new oxField( $oUser->getId() );
00396 $oReview->oxreviews__oxrating = new oxField( ( $dRating !== null ) ? $dRating : 0);
00397 $oReview->save();
00398 }
00399 }
00400 }
00401
00407 public function addToRecomm()
00408 {
00409 if (!$this->getViewConfig()->getShowListmania()) {
00410 return;
00411 }
00412
00413 $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00414 $sRecommList = oxConfig::getParameter( 'recomm' );
00415 $sArtId = $this->getProduct()->getId();
00416
00417 if ( $sArtId ) {
00418 $oRecomm = oxNew( 'oxrecommlist' );
00419 $oRecomm->load( $sRecommList);
00420 $oRecomm->addArticle( $sArtId, $sRecommText );
00421 }
00422 }
00423
00429 public function addTags()
00430 {
00431 $sTags = $this->getConfig()->getRequestParameter('newTags', true );
00432 $sHighTag = $this->getConfig()->getRequestParameter( 'highTags', true );
00433 if ( !$sTags && !$sHighTag) {
00434 return;
00435 }
00436 if ( $sHighTag ) {
00437 $sTags = getStr()->html_entity_decode( $sHighTag );
00438 }
00439 $oProduct = $this->getProduct();
00440
00441
00442 $aTaggedProducts = oxRegistry::getSession()->getVariable("aTaggedProducts");
00443 $aAddedTags = $aTaggedProducts? $aTaggedProducts[$oProduct->getId()] : array();
00444
00445 $oArticleTagList = oxNew( "oxarticletaglist" );
00446 $oArticleTagList->load( $oProduct->getId() );
00447 $sSeparator = $oArticleTagList->get()->getSeparator();
00448 $aTags = array_unique( explode( $sSeparator, $sTags ) );
00449
00450 $aResult = $this->_addTagsToList( $oArticleTagList, $aTags, $aAddedTags);
00451
00452 if ( !empty( $aResult['tags'] ) ) {
00453 $oArticleTagList->save();
00454 foreach ( $aResult['tags'] as $sTag) {
00455 $aAddedTags[ $sTag ] = 1;
00456 }
00457 $aTaggedProducts[$oProduct->getId()] = $aAddedTags;
00458 oxRegistry::getSession()->setVariable( 'aTaggedProducts', $aTaggedProducts);
00459 }
00460
00461 if ( $this->getConfig()->getRequestParameter( 'blAjax', true ) ) {
00462 oxRegistry::getUtils()->showMessageAndExit( json_encode( $aResult ) );
00463 }
00464 }
00465
00475 protected function _addTagsToList( $oArticleTagList, $aTags, $aAddedTags)
00476 {
00477 $aResult = array( 'tags' => array(), 'invalid' => array(), 'inlist' => array() );
00478
00479 foreach ( $aTags as $sTag ) {
00480 $oTag = oxNew( "oxtag", $sTag );
00481 if ( $aAddedTags[$oTag->get()] != 1 ) {
00482 if ( $oTag->isValid() ) {
00483 $oArticleTagList->addTag( $oTag );
00484 $aResult['tags'][] = $oTag->get();
00485 } else {
00486 $aResult['invalid'][] = $oTag->get();
00487 }
00488 } else {
00489 $aResult['inlist'][] = $oTag->get();
00490 }
00491 }
00492
00493 return $aResult;
00494 }
00495
00501 public function editTags()
00502 {
00503 if ( !$this->getUser() ) {
00504 return;
00505 }
00506 $oArticleTagList = oxNew("oxArticleTagList");
00507 $oArticleTagList->load( $this->getProduct()->getId() );
00508 $oTagSet = $oArticleTagList->get();
00509 $this->_aTags = $oTagSet->get();
00510 $this->_blEditTags = true;
00511
00512
00513 if ( $this->getConfig()->getRequestParameter( 'blAjax', true ) ) {
00514 oxRegistry::getUtils()->setHeader( "Content-Type: text/html; charset=".oxRegistry::getLang()->translateString( 'charset' ) );
00515 $oActView = oxNew( 'oxubase' );
00516 $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
00517 $oSmarty->assign('oView', $this );
00518 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00519 oxRegistry::getUtils()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/editTags.tpl', $this->getViewId() ) );
00520 }
00521 }
00522
00528 public function cancelTags()
00529 {
00530 $oArticleTagList = oxNew("oxArticleTagList");
00531 $oArticleTagList->load( $this->getProduct()->getId() );
00532 $oTagSet = $oArticleTagList->get();
00533 $this->_aTags = $oTagSet->get();
00534 $this->_blEditTags = false;
00535
00536
00537 if ( oxConfig::getParameter( 'blAjax', true ) ) {
00538 oxRegistry::getUtils()->setHeader( "Content-Type: text/html; charset=".oxRegistry::getLang()->translateString( 'charset' ) );
00539 $oActView = oxNew( 'oxubase' );
00540 $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
00541 $oSmarty->assign('oView', $this );
00542 $oSmarty->assign('oViewConf', $this->getViewConfig() );
00543 oxRegistry::getUtils()->showMessageAndExit( $oSmarty->fetch( 'page/details/inc/tags.tpl', $this->getViewId() ) );
00544 }
00545 }
00546
00552 protected function _getSeoObjectId()
00553 {
00554 if ( $oProduct = $this->getProduct() ) {
00555 return $oProduct->getId();
00556 }
00557 }
00558
00564 public function getEditTags()
00565 {
00566 return $this->_blEditTags;
00567 }
00568
00574 public function getTags()
00575 {
00576 return $this->_aTags;
00577 }
00578
00584 public function getProduct()
00585 {
00586 $myConfig = $this->getConfig();
00587 $myUtils = oxRegistry::getUtils();
00588
00589 if ( $this->_oProduct === null ) {
00590
00591
00592
00593 $myConfig->setConfigParam( 'blLoadVariants', true );
00594
00595 $sOxid = oxConfig::getParameter( 'anid' );
00596
00597
00598 $this->_oProduct = oxNew( 'oxarticle' );
00599
00600 if ( !$this->_oProduct->load( $sOxid ) ) {
00601 $myUtils->redirect( $myConfig->getShopHomeURL() );
00602 $myUtils->showMessageAndExit( '' );
00603 }
00604
00605 $aVariantSelections = $this->_oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
00606 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && $aVariantSelections['blPerfectFit']) {
00607 $this->_oProduct = $aVariantSelections['oActiveVariant'];
00608 }
00609 }
00610
00611
00612 if ( !$this->_blIsInitialized ) {
00613
00614 $blContinue = true;
00615 if ( !$this->_oProduct->isVisible() ) {
00616 $blContinue = false;
00617 } elseif ( $this->_oProduct->oxarticles__oxparentid->value ) {
00618 $oParent = $this->_getParentProduct( $this->_oProduct->oxarticles__oxparentid->value );
00619 if ( !$oParent || !$oParent->isVisible() ) {
00620 $blContinue = false;
00621 }
00622 }
00623
00624 if ( !$blContinue ) {
00625 $myUtils->redirect( $myConfig->getShopHomeURL() );
00626 $myUtils->showMessageAndExit( '' );
00627 }
00628
00629 $this->_processProduct( $this->_oProduct );
00630 $this->_blIsInitialized = true;
00631 }
00632
00633 return $this->_oProduct;
00634 }
00635
00641 public function getLinkType()
00642 {
00643 if ( $this->_iLinkType === null ) {
00644 $sListType = oxConfig::getParameter( 'listtype' );
00645 if ( 'vendor' == $sListType ) {
00646 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00647 } elseif ( 'manufacturer' == $sListType ) {
00648 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00649 } elseif ( 'tag' == $sListType ) {
00650 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00651 } elseif ( 'recommlist' == $sListType ) {
00652 $this->_iLinkType = OXARTICLE_LINKTYPE_RECOMM;
00653 } else {
00654 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00655
00656
00657 if ( ( $oCat = $this->getActiveCategory() ) && $oCat->isPriceCategory() ) {
00658 $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00659 }
00660 }
00661 }
00662
00663 return $this->_iLinkType;
00664 }
00665
00671 public function drawParentUrl()
00672 {
00673 return $this->getProduct()->isVariant();
00674 }
00675
00683 public function getParentName()
00684 {
00685 if ( $this->_sParentName === null ) {
00686 $this->_sParentName = false;
00687 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00688 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00689 }
00690 }
00691 return $this->_sParentName;
00692 }
00693
00701 public function getParentUrl()
00702 {
00703 if ( $this->_sParentUrl === null ) {
00704 $this->_sParentUrl = false;
00705 if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00706 $this->_sParentUrl = $oParent->getLink();
00707 }
00708 }
00709 return $this->_sParentUrl;
00710 }
00711
00717 public function getPictureGallery()
00718 {
00719 if ( $this->_aPicGallery === null ) {
00720
00721 $this->_aPicGallery = $this->getPicturesProduct()->getPictureGallery();
00722 }
00723 return $this->_aPicGallery;
00724 }
00725
00731 public function getActPictureId()
00732 {
00733 $aPicGallery = $this->getPictureGallery();
00734 return $aPicGallery['ActPicID'];
00735 }
00736
00742 public function getActPicture()
00743 {
00744 $aPicGallery = $this->getPictureGallery();
00745 return $aPicGallery['ActPic'];
00746 }
00747
00753 public function getPictures()
00754 {
00755 $aPicGallery = $this->getPictureGallery();
00756 return $aPicGallery['Pics'];
00757 }
00758
00766 public function getArtPic( $sPicNr )
00767 {
00768 $aPicGallery = $this->getPictureGallery();
00769 return $aPicGallery['Pics'][$sPicNr];
00770 }
00771
00777 public function getSelectLists()
00778 {
00779 if ( $this->_aSelectLists === null ) {
00780 $this->_aSelectLists = false;
00781 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
00782 $this->_aSelectLists = $this->getProduct()->getSelectLists();
00783 }
00784 }
00785 return $this->_aSelectLists;
00786 }
00787
00793 public function getReviews()
00794 {
00795 if ( $this->_aReviews === null ) {
00796 $this->_aReviews = false;
00797 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
00798 $this->_aReviews = $this->getProduct()->getReviews();
00799 }
00800 }
00801 return $this->_aReviews;
00802 }
00803
00809 public function getCrossSelling()
00810 {
00811 if ( $this->_oCrossSelling === null ) {
00812 $this->_oCrossSelling = false;
00813 if ( $oProduct = $this->getProduct() ) {
00814 $this->_oCrossSelling = $oProduct->getCrossSelling();
00815 }
00816 }
00817 return $this->_oCrossSelling;
00818 }
00819
00825 public function getSimilarProducts()
00826 {
00827 if ( $this->_oSimilarProducts === null ) {
00828 $this->_oSimilarProducts = false;
00829 if ( $oProduct = $this->getProduct() ) {
00830 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
00831 }
00832 }
00833 return $this->_oSimilarProducts;
00834 }
00835
00841 public function getSimilarRecommListIds()
00842 {
00843 if ( $this->_aSimilarRecommListIds === null ) {
00844 $this->_aSimilarRecommListIds = false;
00845
00846 if ( $oProduct = $this->getProduct() ) {
00847 $this->_aSimilarRecommListIds = array( $oProduct->getId() );
00848 }
00849 }
00850 return $this->_aSimilarRecommListIds;
00851 }
00852
00858 public function getAccessoires()
00859 {
00860 if ( $this->_oAccessoires === null ) {
00861 $this->_oAccessoires = false;
00862 if ( $oProduct = $this->getProduct() ) {
00863 $this->_oAccessoires = $oProduct->getAccessoires();
00864 }
00865 }
00866 return $this->_oAccessoires;
00867 }
00868
00874 public function getAlsoBoughtTheseProducts()
00875 {
00876 if ( $this->_aAlsoBoughtArts === null ) {
00877 $this->_aAlsoBoughtArts = false;
00878 if ( $oProduct = $this->getProduct() ) {
00879 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
00880 }
00881 }
00882 return $this->_aAlsoBoughtArts;
00883 }
00884
00890 public function isPriceAlarm()
00891 {
00892
00893 $oProduct = $this->getProduct();
00894 if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
00895 return 0;
00896 }
00897 return 1;
00898 }
00899
00908 protected function _getSubject( $iLang )
00909 {
00910 return $this->getProduct();
00911 }
00912
00918 public function getSearchTitle()
00919 {
00920 return $this->_sSearchTitle;
00921 }
00922
00930 public function setSearchTitle( $sTitle )
00931 {
00932 $this->_sSearchTitle = $sTitle;
00933 }
00934
00942 public function setCatTreePath( $sActCatPath )
00943 {
00944 $this->_sCatTreePath = $sActCatPath;
00945 }
00946
00953 public function noIndex()
00954 {
00955 $sListType = oxConfig::getParameter( 'listtype' );
00956 if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
00957 return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
00958 }
00959 return parent::noIndex();
00960 }
00961
00967 public function getTitle()
00968 {
00969 if ( $oProduct = $this->getProduct() ) {
00970 $sTag = $this->getTag();
00971 return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' ) . (!empty($sTag) ? ' - '.$sTag : '');
00972 }
00973 }
00974
00980 public function getMetaDescription()
00981 {
00982 $sMeta = parent::getMetaDescription();
00983
00984 if($sTag = $this->getTag()) {
00985 $sMeta = $sTag.' - ' . $sMeta;
00986 }
00987
00988 return $sMeta;
00989 }
00990
00996 public function getTag()
00997 {
00998 return oxConfig::getParameter("searchtag", 1);
00999 }
01000
01006 public function getCanonicalUrl()
01007 {
01008 if ( ( $oProduct = $this->getProduct() ) ) {
01009 if ( $oProduct->oxarticles__oxparentid->value ) {
01010 $oProduct = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value );
01011 }
01012
01013 $oUtils = oxRegistry::get("oxUtilsUrl");
01014 if ( oxRegistry::getUtils()->seoIsActive() ) {
01015 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseSeoLink( $oProduct->getLanguage(), true ) );
01016 } else {
01017 $sUrl = $oUtils->prepareCanonicalUrl( $oProduct->getBaseStdLink( $oProduct->getLanguage() ) );
01018 }
01019 return $sUrl;
01020 }
01021 }
01022
01028 public function getBreadCrumb()
01029 {
01030 $aPaths = array();
01031 $oConfig = $this->getConfig();
01032
01033 if ( 'search' == $oConfig->getRequestParameter( 'listtype' ) ) {
01034 $sSearchParam = $this->getSearchParamForHtml();
01035
01036 $aCatPath = array();
01037 $aCatPath['title'] = sprintf( oxRegistry::getLang()->translateString( 'SEARCH_RESULT', oxRegistry::getLang()->getBaseLanguage(), false ), $sSearchParam );
01038 $aCatPath['link'] = $this->getViewConfig()->getSelfLink() . 'stoken=' . oxSession::getVar('sess_stoken') . "&cl=search&searchparam=" . $sSearchParam;
01039
01040 $aPaths[] = $aCatPath;
01041
01042 } elseif ( 'tag' == $oConfig->getRequestParameter( 'listtype' ) ) {
01043
01044 $aCatPath = array();
01045
01046 $aCatPath['title'] = oxRegistry::getLang()->translateString( 'TAGS', oxRegistry::getLang()->getBaseLanguage(), false );
01047 $aCatPath['link'] = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getViewConfig()->getSelfLink() . 'cl=tags' );
01048 $aPaths[] = $aCatPath;
01049
01050 $oStr = getStr();
01051 $aCatPath['title'] = $oStr->ucfirst($oConfig->getRequestParameter( 'searchtag' ));
01052 $aCatPath['link'] = oxRegistry::get("oxSeoEncoderTag")->getTagUrl( $oConfig->getRequestParameter( 'searchtag' ) );
01053 $aPaths[] = $aCatPath;
01054
01055 } elseif ( 'recommlist' == $oConfig->getRequestParameter( 'listtype' ) ) {
01056
01057 $aCatPath = array();
01058 $aCatPath['title'] = oxRegistry::getLang()->translateString( 'LISTMANIA', oxRegistry::getLang()->getBaseLanguage(), false );
01059 $aPaths[] = $aCatPath;
01060 } else {
01061
01062 $oCatTree = $this->getCatTreePath();
01063
01064 if ( $oCatTree ) {
01065
01066 foreach ( $oCatTree as $oCat ) {
01067 $aCatPath = array();
01068
01069 $aCatPath['link'] = $oCat->getLink();
01070 $aCatPath['title'] = $oCat->oxcategories__oxtitle->value;
01071
01072 $aPaths[] = $aCatPath;
01073 }
01074 }
01075 }
01076
01077 return $aPaths;
01078 }
01079
01085 public function getCaptcha()
01086 {
01087 if ( $this->_oCaptcha === null ) {
01088 $this->_oCaptcha = oxNew('oxCaptcha');
01089 }
01090 return $this->_oCaptcha;
01091 }
01092
01102 public function addme()
01103 {
01104 $myConfig = $this->getConfig();
01105 $myUtils = oxRegistry::getUtils();
01106
01107
01108 $sMac = oxConfig::getParameter( 'c_mac' );
01109 $sMacHash = oxConfig::getParameter( 'c_mach' );
01110 $oCaptcha = $this->getCaptcha();
01111 if ( !$oCaptcha->pass( $sMac, $sMacHash ) ) {
01112 $this->_iPriceAlarmStatus = 2;
01113 return;
01114 }
01115
01116 $aParams = oxConfig::getParameter( 'pa' );
01117 if ( !isset( $aParams['email'] ) || !$myUtils->isValidEmail( $aParams['email'] ) ) {
01118 $this->_iPriceAlarmStatus = 0;
01119 return;
01120 }
01121 $aParams['aid'] = $this->getProduct()->getId();
01122 $oCur = $myConfig->getActShopCurrencyObject();
01123
01124 $dPrice = $myUtils->currency2Float( $aParams['price'] );
01125
01126 $oAlarm = oxNew( "oxpricealarm" );
01127 $oAlarm->oxpricealarm__oxuserid = new oxField( oxSession::getVar( 'usr' ));
01128 $oAlarm->oxpricealarm__oxemail = new oxField( $aParams['email']);
01129 $oAlarm->oxpricealarm__oxartid = new oxField( $aParams['aid']);
01130 $oAlarm->oxpricealarm__oxprice = new oxField( $myUtils->fRound( $dPrice, $oCur ));
01131 $oAlarm->oxpricealarm__oxshopid = new oxField( $myConfig->getShopId());
01132 $oAlarm->oxpricealarm__oxcurrency = new oxField( $oCur->name);
01133
01134 $oAlarm->oxpricealarm__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage());
01135
01136 $oAlarm->save();
01137
01138
01139 $oEmail = oxNew( 'oxemail' );
01140 $this->_iPriceAlarmStatus = (int) $oEmail->sendPricealarmNotification( $aParams, $oAlarm );
01141 }
01142
01148 public function getPriceAlarmStatus()
01149 {
01150 return $this->_iPriceAlarmStatus;
01151 }
01152
01158 public function getBidPrice()
01159 {
01160 if ( $this->_sBidPrice === null ) {
01161 $this->_sBidPrice = false;
01162
01163 $aParams = oxConfig::getParameter( 'pa' );
01164 $oCur = $this->getConfig()->getActShopCurrencyObject();
01165 $iPrice = oxRegistry::getUtils()->currency2Float( $aParams['price'] );
01166 $this->_sBidPrice = oxRegistry::getLang()->formatCurrency( $iPrice, $oCur );
01167 }
01168 return $this->_sBidPrice;
01169 }
01170
01176 public function getVariantSelections()
01177 {
01178
01179 $oProduct = $this->getProduct();
01180 if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) ) {
01181 return $oParent->getVariantSelections( oxConfig::getParameter( "varselid" ), $oProduct->getId() );
01182 }
01183
01184 return $oProduct->getVariantSelections( oxConfig::getParameter( "varselid" ) );
01185 }
01186
01192 public function getPicturesProduct()
01193 {
01194 $aVariantSelections = $this->getVariantSelections();
01195 if ($aVariantSelections && $aVariantSelections['oActiveVariant'] && !$aVariantSelections['blPerfectFit']) {
01196 return $aVariantSelections['oActiveVariant'];
01197 }
01198 return $this->getProduct();
01199 }
01200
01206 public function getSearchParamForHtml()
01207 {
01208 if ( $this->_sSearchParamForHtml === null ) {
01209 $this->_sSearchParamForHtml = oxConfig::getParameter( 'searchparam' );
01210 }
01211 return $this->_sSearchParamForHtml;
01212 }
01213
01219 public function showRdfa()
01220 {
01221 return $this->getConfig()->getConfigParam( 'blRDFaEmbedding' );
01222 }
01223
01229 public function getRDFaNormalizedRating()
01230 {
01231 $myConfig = $this->getConfig();
01232 $iMin = $myConfig->getConfigParam("iRDFaMinRating");
01233 $iMax = $myConfig->getConfigParam("iRDFaMaxRating");
01234
01235 $oProduct = $this->getProduct();
01236 $iCount = $oProduct->oxarticles__oxratingcnt->value;
01237 if ( isset($iMin) && isset($iMax) && $iMax != '' && $iMin != '' && $iCount > 0 ) {
01238 $aNomalizedRating = array();
01239 $iValue = ((4*($oProduct->oxarticles__oxrating->value - $iMin)/($iMax - $iMin)))+1;
01240 $aNomalizedRating["count"] = $iCount;
01241 $aNomalizedRating["value"] = round($iValue, 2);
01242 return $aNomalizedRating;
01243 }
01244 return false;
01245 }
01246
01254 public function getRDFaValidityPeriod($sShopConfVar)
01255 {
01256 if ( $sShopConfVar ) {
01257 $aValidity = array();
01258 $iDays = $this->getConfig()->getConfigParam($sShopConfVar);
01259 $iFrom = oxRegistry::get("oxUtilsDate")->getTime();
01260
01261 $iThrough = $iFrom + ($iDays * 24 * 60 * 60);
01262 $aValidity["from"] = date('Y-m-d\TH:i:s', $iFrom)."Z";
01263 $aValidity["through"] = date('Y-m-d\TH:i:s', $iThrough)."Z";
01264
01265 return $aValidity;
01266 }
01267 return false;
01268 }
01269
01275 public function getRDFaBusinessFnc()
01276 {
01277 return $this->getConfig()->getConfigParam("sRDFaBusinessFnc");
01278 }
01279
01285 public function getRDFaCustomers()
01286 {
01287 return $this->getConfig()->getConfigParam("aRDFaCustomers");
01288 }
01289
01295 public function getRDFaVAT()
01296 {
01297 return $this->getConfig()->getConfigParam("iRDFaVAT");
01298 }
01299
01305 public function getRDFaGenericCondition()
01306 {
01307 return $this->getConfig()->getConfigParam("iRDFaCondition");
01308 }
01309
01315 public function getBundleArticle()
01316 {
01317 $oProduct = $this->getProduct();
01318 if ( $oProduct && $oProduct->oxarticles__oxbundleid->value ) {
01319 $oArticle = oxNew("oxarticle");
01320 $oArticle->load($oProduct->oxarticles__oxbundleid->value);
01321 return $oArticle;
01322 }
01323 return false;
01324 }
01325
01331 public function getRDFaPaymentMethods()
01332 {
01333 $iPrice = $this->getProduct()->getPrice()->getBruttoPrice();
01334 $oPayments = oxNew("oxpaymentlist");
01335 $oPayments->loadRDFaPaymentList($iPrice);
01336 return $oPayments;
01337 }
01338
01344 public function getRDFaDeliverySetMethods()
01345 {
01346 $oDelSets = oxNew("oxdeliverysetlist");
01347 $oDelSets->loadRDFaDeliverySetList();
01348 return $oDelSets;
01349 }
01350
01356 public function getProductsDeliveryList()
01357 {
01358 $oProduct = $this->getProduct();
01359 $oDelList = oxNew( "oxDeliveryList" );
01360 $oDelList->loadDeliveryListForProduct( $oProduct );
01361 return $oDelList;
01362 }
01363
01369 public function getRDFaDeliveryChargeSpecLoc()
01370 {
01371 return $this->getConfig()->getConfigParam("sRDFaDeliveryChargeSpecLoc");
01372 }
01373
01379 public function getRDFaPaymentChargeSpecLoc()
01380 {
01381 return $this->getConfig()->getConfigParam("sRDFaPaymentChargeSpecLoc");
01382 }
01383
01389 public function getRDFaBusinessEntityLoc()
01390 {
01391 return $this->getConfig()->getConfigParam("sRDFaBusinessEntityLoc");
01392 }
01393
01399 public function showRDFaProductStock()
01400 {
01401 return $this->getConfig()->getConfigParam("blShowRDFaProductStock");
01402 }
01403
01409 public function canChangeTags()
01410 {
01411 if ( $oUser = $this->getUser() ) {
01412
01413 return true;
01414 }
01415 return false;
01416 }
01417
01423 public function getTagCloudManager()
01424 {
01425 $oManager = oxNew( "oxTagCloud" );
01426 $oManager->setExtendedMode( true );
01427 $oManager->setProductId( $this->getProduct()->getId() );
01428 return $oManager;
01429 }
01430
01436 public function showZoomPics()
01437 {
01438 $aPicGallery = $this->getPictureGallery();
01439 return $aPicGallery['ZoomPic'];
01440 }
01441
01447 public function isReviewActive()
01448 {
01449 return $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' );
01450 }
01451
01457 public function getDefaultSorting()
01458 {
01459 $aSorting = parent::getDefaultSorting();
01460 $oCategory = $this->getActiveCategory();
01461
01462 if ( $this->getListType() != 'search' && $oCategory && $oCategory instanceof oxCategory ) {
01463 if ( $sDefaultSorting = $oCategory->getDefaultSorting() ) {
01464 $sArticleTable = getViewName( 'oxarticles' );
01465 $sSortBy = $sArticleTable.'.'.$sDefaultSorting;
01466 $sSortDir = ( $oCategory->getDefaultSortingMode() ) ? "desc" : "asc";
01467 $aSorting = array ( 'sortby' => $sSortBy, 'sortdir' => $sSortDir );
01468 }
01469 }
01470
01471 return $aSorting;
01472 }
01473
01479 public function getSortingParameters()
01480 {
01481 $aSorting = $this->getSorting( $this->getSortIdent() );
01482 if ( !is_array( $aSorting ) ) {
01483 return null;
01484 }
01485 return implode( '|', $aSorting);
01486 }
01487 }