Go to the documentation of this file.00001 <?php
00002
00006 class oxwArticleBox extends oxWidget
00007 {
00014 protected $_aComponentNames = array( 'oxcmp_user' => 1, 'oxcmp_basket' => 1, 'oxcmp_cur' => 1 );
00015
00020 protected $_sTemplate = 'widget/product/boxproduct.tpl';
00021
00022
00027 protected $_oArticle = null;
00028
00029
00035 public function getActiveCategory()
00036 {
00037 $oCategory = $this->getConfig()->getTopActiveView()->getActiveCategory();
00038 if ( $oCategory ) {
00039 $this->setActiveCategory( $oCategory );
00040 }
00041 return $this->_oActCategory;
00042 }
00043
00049 public function render()
00050 {
00051 parent::render();
00052
00053 $sWidgetType = $this->getViewParameter('sWidgetType');
00054 $sListType = $this->getViewParameter('sListType');
00055
00056 if ($sWidgetType && $sListType) {
00057 $this->_sTemplate = "widget/" . $sWidgetType . "/" . $sListType . ".tpl";
00058 }
00059
00060 $sForceTemplate = $this->getViewParameter('oxwtemplate');
00061 if ($sForceTemplate) {
00062 $this->_sTemplate = $sForceTemplate;
00063 }
00064
00065 return $this->_sTemplate;
00066 }
00067
00073 public function setProduct( $oArticle )
00074 {
00075 $this->_oArticle = $oArticle;
00076 }
00077
00083 public function getProduct()
00084 {
00085 if ( is_null( $this->_oArticle ) ) {
00086
00087 if ( $this->getViewParameter( '_object' ) ) {
00088 $oArticle = $this->getViewParameter( '_object' );
00089 } else {
00090 $sAddDynParams = $this->getConfig()->getTopActiveView()->getAddUrlParams();
00091
00092
00093 $oArticle = $this->_getArticleById( $this->getViewParameter( 'anid' ) );
00094 $this->_addDynParamsToLink( $sAddDynParams, $oArticle );
00095 }
00096
00097 $this->setProduct( $oArticle );
00098 }
00099
00100 return $this->_oArticle;
00101 }
00102
00110 public function getLink( $iLang = null )
00111 {
00112 return $this->getConfig()->getTopActiveView()->getLink( $iLang );
00113 }
00114
00120 public function isVatIncluded()
00121 {
00122 return (bool) $this->getViewParameter( "isVatIncluded" );
00123 }
00124
00130 public function getWishId()
00131 {
00132 return $this->getViewParameter('owishid');
00133 }
00134
00140 public function getRemoveFunction()
00141 {
00142 return $this->getViewParameter('removeFunction');
00143 }
00144
00150 public function getToBasketFunction()
00151 {
00152 return $this->getViewParameter('toBasketFunction');
00153 }
00154
00160 public function getDisableToCart()
00161 {
00162 return (bool) $this->getViewParameter('blDisableToCart');
00163 }
00164
00170 public function getIndex()
00171 {
00172 return $this->getViewParameter('iIndex');
00173 }
00174
00180 public function getRecommId()
00181 {
00182 return $this->getViewParameter('recommid');
00183 }
00184
00190 public function getIteration()
00191 {
00192 return $this->getViewParameter('iIteration');
00193 }
00194
00200 public function getRSSLinks()
00201 {
00202 $aRSS = $this->getViewParameter('rsslinks');
00203 if ( !is_array($aRSS) ) {
00204 $aRSS = null;
00205 }
00206 return $aRSS;
00207 }
00208
00214 public function getShowMainLink()
00215 {
00216 return (bool) $this->getViewParameter('showMainLink');
00217 }
00218
00224 public function getAltProduct()
00225 {
00226 return (bool) $this->getViewParameter('altproduct');
00227 }
00228
00237 protected function _addDynParamsToLink( $sAddDynParams, $oArticle )
00238 {
00239 $blAddedParams = false;
00240 if ( $sAddDynParams ) {
00241 $blSeo = oxRegistry::getUtils()->seoIsActive();
00242 if ( !$blSeo ) {
00243
00244 $oArticle->appendStdLink( $sAddDynParams );
00245 }
00246 $oArticle->appendLink( $sAddDynParams );
00247 $blAddedParams = true;
00248 }
00249
00250 return $blAddedParams;
00251 }
00252
00260 protected function _getArticleById( $sArticleId )
00261 {
00263 $oArticle = oxNew( 'oxArticle' );
00264 $oArticle->load( $sArticleId );
00265 $iLinkType = $this->getViewParameter( 'iLinkType' );
00266
00267 if ( $this->getViewParameter( 'inlist' ) ) {
00268 $oArticle->setInList();
00269 }
00270 if ( $iLinkType ) {
00271 $oArticle->setLinkType( $iLinkType );
00272 }
00273 if ( $oRecommList = $this->getActiveRecommList() ) {
00274 $oArticle->text = $oRecommList->getArtDescription( $oArticle->getId() );
00275 }
00276
00277 return $oArticle;
00278 }
00279
00280 }