details.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Details extends oxUBase
00010 {
00016     protected $_aVariantList = null;
00017 
00023     protected $_sThisTemplate = 'details.tpl';
00024 
00030     protected $_oParent = null;
00031 
00037     protected $_blCanRate = null;
00038 
00043     protected $_blShowSorting = true;
00044 
00049     protected $_blEditTags = null;
00050 
00055     protected $_aTags = null;
00056 
00061     protected $_sTagCloud = null;
00062 
00067     protected $_aUserRecommList = null;
00068 
00073     protected $_sLoginFormAnchor = null;
00074 
00079     protected $_oCaptcha = null;
00080 
00085     protected $_aMediaFiles = null;
00086 
00091     protected $_aLastProducts = null;
00092 
00097     protected $_oVendor = null;
00098 
00103     protected $_oManufacturer = null;
00104 
00109     protected $_oCategory = null;
00110 
00115     protected $_aAttributes = null;
00116 
00121     protected $_sParentName = null;
00122 
00127     protected $_sParentUrl = null;
00128 
00133     protected $_aPicGallery = null;
00134 
00139     protected $_aSelectLists = null;
00140 
00145     protected $_aReviews = null;
00146 
00151     protected $_oCrossSelling = null;
00152 
00157     protected $_oSimilarProducts = null;
00158 
00163     protected $_oRecommList = null;
00164 
00169     protected $_oAccessoires = null;
00170 
00175     protected $_aAlsoBoughtArts = null;
00176 
00181     protected $_sSearchTitle = null;
00182 
00188     protected $_blIsInitialized = false;
00189 
00195     protected $_iLinkType = null;
00196 
00202     protected $_blMdView = null;
00203 
00211     protected function _getParentProduct( $sParentId )
00212     {
00213         if ( $sParentId && $this->_oParent === null ) {
00214             $this->_oParent = false;
00215             if ( ( $oParent = oxNewArticle( $sParentId ) ) ) {
00216                 $this->_processProduct( $oParent );
00217                 $this->_oParent = $oParent;
00218             }
00219         }
00220         return $this->_oParent;
00221     }
00222 
00229     public function loadVariantInformation()
00230     {
00231         if ( $this->_aVariantList === null ) {
00232             $oProduct = $this->getProduct();
00233 
00234             //loading full list of variants
00235             $this->_aVariantList = $oProduct->getVariants( false );
00236 
00237             //if we are child and do not have any variants then please load all parent variants as ours
00238             if ( ( $oParent = $this->_getParentProduct( $oProduct->oxarticles__oxparentid->value ) ) && count( $this->_aVariantList ) == 0 ) {
00239                 $myConfig = $this->getConfig();
00240 
00241                 $this->_aVariantList = $oParent->getVariants( false );
00242 
00243                 //in variant list parent may be NOT buyable
00244                 if ( $oParent->blNotBuyableParent ) {
00245                     $oParent->blNotBuyable = true;
00246                 }
00247 
00248                 //lets additionally add parent article if it is sellable
00249                 if ( $myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
00250                     //#1104S if parent is buyable load selectlists too
00251                     $oParent->aSelectlist = $oParent->getSelectLists();
00252                     $this->_aVariantList = array_merge( array( $oParent ), $this->_aVariantList->getArray() );
00253                 }
00254 
00255                 //..and skip myself from the list
00256                 if ( isset( $this->_aVariantList[$oProduct->getId()] ) ) {
00257                     unset( $this->_aVariantList[$oProduct->getId()] );
00258                 }
00259             }
00260 
00261             // setting link type for variants ..
00262             foreach ( $this->_aVariantList as $oVariant ) {
00263                 $this->_processProduct( $oVariant );
00264             }
00265 
00266         }
00267         return $this->_aVariantList;
00268     }
00269 
00275     protected function _getAddUrlParams()
00276     {
00277         if ( $this->getListType() == "search" ) {
00278             return $this->getDynUrlParams();
00279         }
00280     }
00281 
00289     protected function _processProduct( $oProduct )
00290     {
00291         $oProduct->setLinkType( $this->getLinkType() );
00292         if ( $sAddParams = $this->_getAddUrlParams() ) {
00293             $oProduct->appendLink( $sAddParams );
00294         }
00295     }
00296 
00302     public function getViewId()
00303     {
00304         if ( isset( $this->_sViewId )) {
00305             return $this->_sViewId;
00306         }
00307 
00308             $sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'anid' ).'|'.count( $this->getVariantList() ).'|';
00309 
00310 
00311         return $this->_sViewId = $sViewId;
00312     }
00313 
00314 
00321     public function init()
00322     {
00323         parent::init();
00324 
00325         $oProduct = $this->getProduct();
00326 
00327         // assign template name
00328         if ( $oProduct->oxarticles__oxtemplate->value ) {
00329             $this->_sThisTemplate = $oProduct->oxarticles__oxtemplate->value;
00330         }
00331 
00332         if ( ( $sTplName = oxConfig::getParameter( 'tpl' ) ) ) {
00333             $this->_sThisTemplate = basename ( $sTplName );
00334         }
00335     }
00336 
00356     public function render()
00357     {
00358         $myConfig = $this->getConfig();
00359 
00360         $oProduct = $this->getProduct();
00361 
00362         //loading amount price list
00363         $oProduct->loadAmountPriceInfo();
00364 
00365         // Passing to view. Left for compatibility reasons for a while. Will be removed in future
00366         $this->_aViewData['product'] = $oProduct;
00367 
00368         $this->_aViewData["aTags"]      = $this->getTags();
00369         $this->_aViewData["blEditTags"] = $this->getEditTags();
00370         startProfile("tagCloud");
00371         $this->_aViewData['tagCloud']   = $this->getTagCloud();
00372         stopProfile("tagCloud");
00373 
00374         $this->_aViewData['loginformanchor'] = $this->getLoginFormAnchor();
00375 
00376         $this->_aViewData['ispricealarm'] = $this->isPriceAlarm();
00377 
00378         $this->_aViewData['customerwho']    = $this->getAlsoBoughtTheseProducts();
00379         $this->_aViewData['accessoirelist'] = $this->getAccessoires();
00380         $this->_aViewData['similarlist']    = $this->getSimilarProducts();
00381         $this->_aViewData['crossselllist']  = $this->getCrossSelling();
00382 
00383         $this->_aViewData['variants'] = $this->getVariantList();
00384 
00385         $this->_aViewData['reviews'] = $this->getReviews();
00386 
00387         $this->_aViewData['selectlist'] = $this->getSelectLists();
00388 
00389         $this->_aViewData["actpicid"]  = $this->getActPictureId();
00390         $this->_aViewData["actpic"]    = $this->getActPicture();
00391         $this->_aViewData['blMorePic'] = $this->morePics();
00392         $this->_aViewData['ArtPics']   = $this->getPictures();
00393         $this->_aViewData['ArtIcons']  = $this->getIcons();
00394         $this->_aViewData['blZoomPic'] = $this->showZoomPics();
00395         $this->_aViewData['aZoomPics'] = $this->getZoomPics();
00396         $this->_aViewData['iZoomPic']  = $this->getActZoomPic();
00397 
00398         $this->_aViewData['parentname']      = $this->getParentName();
00399         $this->_aViewData['parent_url']      = $this->getParentUrl();
00400         $this->_aViewData['draw_parent_url'] = $this->drawParentUrl();
00401 
00402         $this->_aViewData['pgNr'] = $this->getActPage();
00403 
00404         parent::render();
00405 
00406         $this->_aViewData['allartattr'] = $this->getAttributes();
00407 
00408         // #1102C
00409         $this->_aViewData['oCategory'] = $this->getCategory();
00410 
00411         $this->_aViewData['oVendor'] = $this->getVendor();
00412 
00413         $this->_aViewData['oManufacturer'] = $this->getManufacturer();
00414 
00415         $this->_aViewData['aLastProducts'] = $this->getLastProducts();
00416 
00417         // #785A loads and sets locator data
00418         $oLocator = oxNew( 'oxlocator', $this->getListType() );
00419         $oLocator->setLocatorData( $oProduct, $this );
00420 
00421         //media files
00422         $this->_aViewData['aMediaUrls'] = $this->getMediaFiles();
00423 
00424         if (in_array('oxrss_recommlists', $myConfig->getConfigParam( 'aRssSelected' )) && $this->getSimilarRecommLists()) {
00425             $oRss = oxNew('oxrssfeed');
00426             $this->addRssFeed($oRss->getRecommListsTitle( $oProduct ), $oRss->getRecommListsUrl( $oProduct ), 'recommlists');
00427         }
00428 
00429 
00430         //antispam
00431         $this->_aViewData['oCaptcha']     = $this->getCaptcha();
00432         $this->_aViewData['sSearchTitle'] = $this->getSearchTitle();
00433         $this->_aViewData['actCatpath']   = $this->getCatTreePath();
00434 
00435         return $this->_sThisTemplate;
00436     }
00437 
00449     protected function _prepareMetaDescription( $sMeta, $iLength = 200, $blDescTag = false )
00450     {
00451         if ( !$sMeta ) {
00452             $oProduct = $this->getProduct();
00453 
00454             $sMeta = $oProduct->getArticleLongDesc()->value;
00455             $sMeta = str_replace( array( '<br>', '<br />', '<br/>' ), "\n", $sMeta );
00456             $sMeta = $oProduct->oxarticles__oxtitle->value.' - '.$sMeta;
00457             $sMeta = strip_tags( $sMeta );
00458         }
00459         return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00460     }
00461 
00472     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00473     {
00474         $myConfig = $this->getConfig();
00475 
00476         if ( !$sKeywords ) {
00477             $oProduct = $this->getProduct();
00478             $aKeywords[] = trim( $this->getTitle() );
00479 
00480             if ( $oCatTree = $this->getCategoryTree() ) {
00481                 foreach ( $oCatTree->getPath() as $oCat ) {
00482                     $aKeywords[] = trim( $oCat->oxcategories__oxtitle->value );
00483                 }
00484             }
00485 
00486             $sKeywords = implode( ", ", $aKeywords );
00487 
00488             $sKeywords = parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00489 
00490             //adding searchkeys info
00491             if ( $sSearchKeys = trim( $oProduct->oxarticles__oxsearchkeys->value ) ) {
00492                 $sKeywords .= ", " . parent::_prepareMetaKeyword( $sSearchKeys, false );
00493             }
00494         }
00495 
00496         return $sKeywords;
00497     }
00498 
00504     public function canRate()
00505     {
00506         if ( $this->_blCanRate === null ) {
00507 
00508             $this->_blCanRate = false;
00509             $myConfig = $this->getConfig();
00510 
00511             if ( $myConfig->getConfigParam( 'bl_perfLoadReviews' ) &&
00512                  $oUser = $this->getUser() ) {
00513 
00514                 $oRating = oxNew( 'oxrating' );
00515                 $this->_blCanRate = $oRating->allowRating( $oUser->getId(), 'oxarticle', $this->getProduct()->getId() );
00516             }
00517         }
00518         return $this->_blCanRate;
00519     }
00520 
00526     public function saveReview()
00527     {
00528         $sReviewText = trim( ( string ) oxConfig::getParameter( 'rvw_txt', true ) );
00529         $dRating     = oxConfig::getParameter( 'artrating' );
00530         if ($dRating < 0 || $dRating > 5) {
00531             $dRating = null;
00532         }
00533 
00534         $sArtId  = oxConfig::getParameter( 'anid' );
00535         $sUserId = oxSession::getVar( 'usr' );
00536 
00537         //save rating
00538         if ( $dRating && $sUserId ) {
00539             $oProduct = $this->getProduct();
00540 
00541             $oRating = oxNew( 'oxrating' );
00542             $blRate = $oRating->allowRating( $sUserId, 'oxarticle', $oProduct->getId());
00543             if ( $blRate) {
00544                 $oRating->oxratings__oxuserid = new oxField($sUserId);
00545                 $oRating->oxratings__oxtype   = new oxField('oxarticle', oxField::T_RAW);
00546                 $oRating->oxratings__oxobjectid = new oxField($sArtId);
00547                 $oRating->oxratings__oxrating = new oxField($dRating);
00548                 $oRating->save();
00549                 $oProduct->addToRatingAverage( $dRating);
00550             } else {
00551                 $dRating = null;
00552             }
00553         }
00554 
00555         if ( $sReviewText && $sUserId ) {
00556             $oReview = oxNew( 'oxreview' );
00557             $oReview->oxreviews__oxobjectid = new oxField($sArtId);
00558             $oReview->oxreviews__oxtype = new oxField('oxarticle', oxField::T_RAW);
00559             $oReview->oxreviews__oxtext = new oxField($sReviewText, oxField::T_RAW);
00560             $oReview->oxreviews__oxlang = new oxField(oxLang::getInstance()->getBaseLanguage());
00561             $oReview->oxreviews__oxuserid = new oxField($sUserId);
00562             $oReview->oxreviews__oxrating = new oxField(( $dRating) ? $dRating : null);
00563             $oReview->save();
00564         }
00565     }
00566 
00574     public function showLogin()
00575     {
00576         $this->_sThisTemplate = 'account_login.tpl';
00577         if ( $sAnchor = $this->getConfig()->getParameter("anchor") ) {
00578             $this->_sLoginFormAnchor = $sAnchor;
00579         }
00580     }
00581 
00587     public function addToRecomm()
00588     {
00589         $sRecommText = trim( ( string ) oxConfig::getParameter( 'recomm_txt' ) );
00590         $sRecommList = oxConfig::getParameter( 'recomm' );
00591         $sArtId      = oxConfig::getParameter( 'anid' );
00592 
00593         if ( $sArtId ) {
00594             $oRecomm = oxNew( 'oxrecommlist' );
00595             $oRecomm->load( $sRecommList);
00596             $oRecomm->addArticle( $sArtId, $sRecommText );
00597         }
00598     }
00599 
00605     public function addTags()
00606     {
00607         $sTag  = $this->getConfig()->getParameter('newTags', true );
00608         $sTag .= " ".getStr()->html_entity_decode( $this->getConfig()->getParameter( 'highTags', true ) );
00609 
00610         $oProduct = $this->getProduct();
00611         $oProduct->addTag( $sTag );
00612 
00613         //refresh
00614         $oTagHandler = oxNew( 'oxTagCloud' );
00615         $this->_sTagCloud = $oTagHandler->getTagCloud( $oProduct->getId() );
00616     }
00617 
00623     public function editTags()
00624     {
00625         $oTagCloud = oxNew("oxTagCloud");
00626         $this->_aTags = $oTagCloud->getTags( $this->getProduct()->getId() );
00627         $this->_blEditTags = true;
00628     }
00629 
00635     protected function _getSeoObjectId()
00636     {
00637         if ( $oProduct = $this->getProduct() ) {
00638             return $oProduct->getId();
00639         }
00640     }
00641 
00647     public function getAttributes()
00648     {
00649         if ( $this->_aAttributes === null ) {
00650             // all attributes this article has
00651             $aArtAttributes = $this->getProduct()->getAttributes();
00652 
00653             //making a new array for backward compatibility
00654             $this->_aAttributes = array();
00655             if ( count( $aArtAttributes ) ) {
00656                 foreach ( $aArtAttributes as $sKey => $oAttribute ) {
00657                     $this->_aAttributes[$sKey] = new stdClass();
00658                     $this->_aAttributes[$sKey]->title = $oAttribute->oxattribute__oxtitle->value;
00659                     $this->_aAttributes[$sKey]->value = $oAttribute->oxattribute__oxvalue->value;
00660                 }
00661             }
00662         }
00663 
00664         return $this->_aAttributes;
00665     }
00666 
00667 
00673     public function getEditTags()
00674     {
00675         return $this->_blEditTags;
00676     }
00677 
00683     public function getTags()
00684     {
00685         return $this->_aTags;
00686     }
00687 
00693     public function getTagCloud()
00694     {
00695         if ( $this->_sTagCloud === null ) {
00696             $this->_sTagCloud = false;
00697             $oTagHandler = oxNew('oxTagCloud');
00698             $this->_sTagCloud = $oTagHandler->getTagCloud($this->getProduct()->getId());
00699         }
00700         return $this->_sTagCloud;
00701     }
00702 
00703 
00709     public function getLoginFormAnchor()
00710     {
00711         return $this->_sLoginFormAnchor;
00712     }
00713 
00719     public function getProduct()
00720     {
00721         $myConfig = $this->getConfig();
00722         $myUtils  = oxUtils::getInstance();
00723 
00724         if ( $this->_oProduct === null ) {
00725 
00726             //this option is only for lists and we must reset value
00727             //as blLoadVariants = false affect "ab price" functionality
00728             $myConfig->setConfigParam( 'blLoadVariants', true );
00729 
00730             $sOxid = oxConfig::getParameter( 'anid' );
00731 
00732             // object is not yet loaded
00733             $this->_oProduct = oxNew( 'oxarticle' );
00734             //$this->_oProduct->setSkipAbPrice( true );
00735 
00736             if ( !$this->_oProduct->load( $sOxid ) ) {
00737                 $myUtils->redirect( $myConfig->getShopHomeURL() );
00738                 $myUtils->showMessageAndExit( '' );
00739             }
00740         }
00741 
00742         // additional checks
00743         if ( !$this->_blIsInitialized ) {
00744             if ( !$this->_oProduct->isVisible() ) {
00745                 $myUtils->redirect( $myConfig->getShopHomeURL() );
00746                 $myUtils->showMessageAndExit( '' );
00747             }
00748 
00749             $this->_processProduct( $this->_oProduct );
00750             $this->_blIsInitialized = true;
00751         }
00752 
00753         return $this->_oProduct;
00754     }
00755 
00761     public function getLinkType()
00762     {
00763         if ( $this->_iLinkType === null ) {
00764             $sListType = oxConfig::getParameter( 'listtype' );
00765             if ( 'vendor' == $sListType ) {
00766                 $this->_iLinkType = OXARTICLE_LINKTYPE_VENDOR;
00767         } elseif ( 'manufacturer' == $sListType ) {
00768                 $this->_iLinkType = OXARTICLE_LINKTYPE_MANUFACTURER;
00769             } elseif ( 'tag' == $sListType ) {
00770                 $this->_iLinkType = OXARTICLE_LINKTYPE_TAG;
00771         } else {
00772                 $this->_iLinkType = OXARTICLE_LINKTYPE_CATEGORY;
00773 
00774                 // price category has own type..
00775                 if ( ( $oCat = $this->getCategory() ) && $oCat->isPriceCategory() ) {
00776                     $this->_iLinkType = OXARTICLE_LINKTYPE_PRICECATEGORY;
00777                 }
00778             }
00779         }
00780 
00781         return $this->_iLinkType;
00782     }
00783 
00789     public function getVariantList()
00790     {
00791         return $this->loadVariantInformation();
00792     }
00793 
00799     public function getCaptcha()
00800     {
00801         if ( $this->_oCaptcha === null ) {
00802             $this->_oCaptcha = oxNew('oxCaptcha');
00803         }
00804         return $this->_oCaptcha;
00805     }
00806 
00812     public function getMediaFiles()
00813     {
00814         if ( $this->_aMediaFiles === null ) {
00815             $aMediaFiles = $this->getProduct()->getMediaUrls();
00816             $this->_aMediaFiles = count($aMediaFiles) ? $aMediaFiles : false;
00817         }
00818         return $this->_aMediaFiles;
00819     }
00820 
00826     public function getLastProducts()
00827     {
00828         if ( $this->_aLastProducts === null ) {
00829             //last seen products for #768CA
00830             $oProduct = $this->getProduct();
00831             $sArtId = $oProduct->oxarticles__oxparentid->value?$oProduct->oxarticles__oxparentid->value:$oProduct->getId();
00832 
00833             $oHistoryArtList = oxNew( 'oxarticlelist' );
00834             $oHistoryArtList->loadHistoryArticles( $sArtId );
00835             $this->_aLastProducts = $oHistoryArtList;
00836         }
00837         return $this->_aLastProducts;
00838     }
00839 
00845     public function getVendor()
00846     {
00847         if ( $this->_oVendor === null ) {
00848             $this->_oVendor = $this->getProduct()->getVendor( false );
00849         }
00850         return $this->_oVendor;
00851     }
00852 
00858     public function getManufacturer()
00859     {
00860         if ( $this->_oManufacturer === null ) {
00861             $this->_oManufacturer = $this->getProduct()->getManufacturer( false );
00862         }
00863         return $this->_oManufacturer;
00864     }
00865 
00871     public function getCategory()
00872     {
00873         if ( $this->_oCategory === null ) {
00874             $this->_oCategory = $this->getProduct()->getCategory();
00875         }
00876         return $this->_oCategory;
00877     }
00878 
00884     public function drawParentUrl()
00885     {
00886         return $this->getProduct()->isVariant();
00887     }
00888 
00894     public function getParentName()
00895     {
00896         if ( $this->_sParentName === null ) {
00897             $this->_sParentName = false;
00898             if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00899                 $this->_sParentName = $oParent->oxarticles__oxtitle->value;
00900             }
00901         }
00902         return $this->_sParentName;
00903     }
00904 
00910     public function getParentUrl()
00911     {
00912         if ( $this->_sParentUrl === null ) {
00913             $this->_sParentUrl = false;
00914             if ( ( $oParent = $this->_getParentProduct( $this->getProduct()->oxarticles__oxparentid->value ) ) ) {
00915                 $this->_sParentUrl = $oParent->getLink();
00916             }
00917         }
00918         return $this->_sParentUrl;
00919     }
00920 
00926     public function getPictureGallery()
00927     {
00928         if ( $this->_aPicGallery === null ) {
00929             //get picture gallery
00930             $this->_aPicGallery = $this->getProduct()->getPictureGallery();
00931         }
00932         return $this->_aPicGallery;
00933     }
00934 
00940     public function getActPictureId()
00941     {
00942         $aPicGallery = $this->getPictureGallery();
00943         return $aPicGallery['ActPicID'];
00944     }
00945 
00951     public function getActPicture()
00952     {
00953         $aPicGallery = $this->getPictureGallery();
00954         return $aPicGallery['ActPic'];
00955     }
00956 
00962     public function morePics()
00963     {
00964         $aPicGallery = $this->getPictureGallery();
00965         return $aPicGallery['MorePics'];
00966     }
00967 
00973     public function getPictures()
00974     {
00975         $aPicGallery = $this->getPictureGallery();
00976         return $aPicGallery['Pics'];
00977     }
00978 
00986     public function getArtPic( $sPicNr )
00987     {
00988         $aPicGallery = $this->getPictureGallery();
00989         return $aPicGallery['Pics'][$sPicNr];
00990     }
00991 
00997     public function getIcons()
00998     {
00999         $aPicGallery = $this->getPictureGallery();
01000         return $aPicGallery['Icons'];
01001     }
01002 
01008     public function showZoomPics()
01009     {
01010         $aPicGallery = $this->getPictureGallery();
01011         return $aPicGallery['ZoomPic'];
01012     }
01013 
01019     public function getZoomPics()
01020     {
01021         $aPicGallery = $this->getPictureGallery();
01022         return $aPicGallery['ZoomPics'];
01023     }
01024 
01030     public function getActZoomPic()
01031     {
01032         return 1;
01033     }
01034 
01040     public function getSelectLists()
01041     {
01042         if ( $this->_aSelectLists === null ) {
01043             $this->_aSelectLists = false;
01044             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' ) ) {
01045                 $this->_aSelectLists = $this->getProduct()->getSelectLists();
01046             }
01047         }
01048         return $this->_aSelectLists;
01049     }
01050 
01056     public function getReviews()
01057     {
01058         if ( $this->_aReviews === null ) {
01059             $this->_aReviews = false;
01060             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadReviews' ) ) {
01061                 $this->_aReviews = $this->getProduct()->getReviews();
01062             }
01063         }
01064         return $this->_aReviews;
01065     }
01066 
01072     public function getCrossSelling()
01073     {
01074         if ( $this->_oCrossSelling === null ) {
01075             $this->_oCrossSelling = false;
01076             if ( $oProduct = $this->getProduct() ) {
01077                 $this->_oCrossSelling = $oProduct->getCrossSelling();
01078             }
01079         }
01080         return $this->_oCrossSelling;
01081     }
01082 
01088     public function getSimilarProducts()
01089     {
01090         if ( $this->_oSimilarProducts === null ) {
01091             $this->_oSimilarProducts = false;
01092             if ( $oProduct = $this->getProduct() ) {
01093                 $this->_oSimilarProducts = $oProduct->getSimilarProducts();
01094             }
01095         }
01096         return $this->_oSimilarProducts;
01097     }
01098 
01104     public function getSimilarRecommLists()
01105     {
01106         if ( $this->_oRecommList === null ) {
01107             $this->_oRecommList = false;
01108             if ( $oProduct = $this->getProduct() ) {
01109                 $oRecommList = oxNew('oxrecommlist');
01110                 $this->_oRecommList = $oRecommList->getRecommListsByIds( array( $oProduct->getId() ) );
01111             }
01112         }
01113         return $this->_oRecommList;
01114     }
01115 
01121     public function getAccessoires()
01122     {
01123         if ( $this->_oAccessoires === null ) {
01124             $this->_oAccessoires = false;
01125             if ( $oProduct = $this->getProduct() ) {
01126                 $this->_oAccessoires = $oProduct->getAccessoires();
01127             }
01128         }
01129         return $this->_oAccessoires;
01130     }
01131 
01139     public function getAlsoBoughtThiesProducts()
01140     {
01141         return $this->getAlsoBoughtTheseProducts();
01142     }
01143 
01149     public function getAlsoBoughtTheseProducts()
01150     {
01151         if ( $this->_aAlsoBoughtArts === null ) {
01152             $this->_aAlsoBoughtArts = false;
01153             if ( $oProduct = $this->getProduct() ) {
01154                 $this->_aAlsoBoughtArts = $oProduct->getCustomerAlsoBoughtThisProducts();
01155             }
01156         }
01157         return $this->_aAlsoBoughtArts;
01158     }
01159 
01165     public function isPriceAlarm()
01166     {
01167         // #419 disabling pricealarm if article has fixed price
01168         $oProduct = $this->getProduct();
01169         if ( isset( $oProduct->oxarticles__oxblfixedprice->value ) && $oProduct->oxarticles__oxblfixedprice->value ) {
01170             return 0;
01171         }
01172         return 1;
01173     }
01174 
01183     protected function _getSubject( $iLang )
01184     {
01185         return $this->getProduct();
01186     }
01187 
01193     public function getSearchTitle()
01194     {
01195         return $this->_sSearchTitle;
01196     }
01197 
01205     public function setSearchTitle( $sTitle )
01206     {
01207         $this->_sSearchTitle = $sTitle;
01208     }
01209 
01217     public function setCatTreePath( $sActCatPath )
01218     {
01219         $this->_sCatTreePath = $sActCatPath;
01220     }
01221 
01228     public function noIndex()
01229     {
01230         $sListType = oxConfig::getParameter( 'listtype' );
01231         if ( $sListType && ( 'vendor' == $sListType || 'manufacturer' == $sListType ) ) {
01232             return $this->_iViewIndexState = VIEW_INDEXSTATE_NOINDEXFOLLOW;
01233         }
01234         return parent::noIndex();
01235     }
01236 
01242     public function getTitle()
01243     {
01244         if ( $oProduct = $this->getProduct() ) {
01245             return $oProduct->oxarticles__oxtitle->value . ( $oProduct->oxarticles__oxvarselect->value ? ' ' . $oProduct->oxarticles__oxvarselect->value : '' );
01246         }
01247     }
01248 
01249 
01255     public function getTag()
01256     {
01257         return oxConfig::getParameter("searchtag", 1);
01258     }
01259 
01265     public function getCanonicalUrl()
01266     {
01267         if ( $oProduct = $this->getProduct() ) {
01268             return $oProduct->getMainLink();
01269         }
01270     }
01271 
01277     public function isMdVariantView()
01278     {
01279         if(!is_null($this->_blMdView))
01280             return $this->_blMdView;
01281 
01282         $iMaxMdDepth = $this->getProduct()->getMdVariants()->getMaxDepth();
01283 
01284         $this->_blMdView = ($iMaxMdDepth > 1);
01285 
01286         return $this->_blMdView;
01287     }
01288 }

Generated on Mon Oct 26 20:07:20 2009 for OXID eShop CE by  doxygen 1.5.5