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
00075 public function setProduct( $oArticle )
00076 {
00077 $this->_oArticle = $oArticle;
00078 }
00079
00085 public function getProduct()
00086 {
00087 if ( is_null( $this->_oArticle ) ) {
00088
00089 if ( $this->getViewParameter( '_object' ) ) {
00090 $oArticle = $this->getViewParameter( '_object' );
00091 } else {
00092 $sAddDynParams = $this->getConfig()->getTopActiveView()->getAddUrlParams();
00093
00094
00095 $oArticle = $this->_getArticleById( $this->getViewParameter( 'anid' ) );
00096 $this->_addDynParamsToLink( $sAddDynParams, $oArticle );
00097 }
00098
00099 $this->setProduct( $oArticle );
00100 }
00101
00102 return $this->_oArticle;
00103 }
00104
00112 public function getLink( $iLang = null )
00113 {
00114 return $this->getConfig()->getTopActiveView()->getLink( $iLang );
00115 }
00116
00122 public function isVatIncluded()
00123 {
00124 return (bool) $this->getViewParameter( "isVatIncluded" );
00125 }
00126
00132 public function getWishId()
00133 {
00134 return $this->getViewParameter('owishid');
00135 }
00136
00142 public function getRemoveFunction()
00143 {
00144 return $this->getViewParameter('removeFunction');
00145 }
00146
00152 public function getToBasketFunction()
00153 {
00154 return $this->getViewParameter('toBasketFunction');
00155 }
00156
00162 public function getDisableToCart()
00163 {
00164 return (bool) $this->getViewParameter('blDisableToCart');
00165 }
00166
00172 public function getIndex()
00173 {
00174 return $this->getViewParameter('iIndex');
00175 }
00176
00182 public function getRecommId()
00183 {
00184 return $this->getViewParameter('recommid');
00185 }
00186
00192 public function getIteration()
00193 {
00194 return $this->getViewParameter('iIteration');
00195 }
00196
00202 public function getRSSLinks()
00203 {
00204 $aRSS = $this->getViewParameter('rsslinks');
00205 if ( !is_array($aRSS) ) {
00206 $aRSS = null;
00207 }
00208 return $aRSS;
00209 }
00210
00216 public function getShowMainLink()
00217 {
00218 return (bool) $this->getViewParameter('showMainLink');
00219 }
00220
00226 public function getAltProduct()
00227 {
00228 return (bool) $this->getViewParameter('altproduct');
00229 }
00230
00239 protected function _addDynParamsToLink( $sAddDynParams, $oArticle )
00240 {
00241 $blAddedParams = false;
00242 if ( $sAddDynParams ) {
00243 $blSeo = oxRegistry::getUtils()->seoIsActive();
00244 if ( !$blSeo ) {
00245
00246 $oArticle->appendStdLink( $sAddDynParams );
00247 }
00248 $oArticle->appendLink( $sAddDynParams );
00249 $blAddedParams = true;
00250 }
00251
00252 return $blAddedParams;
00253 }
00254
00262 protected function _getArticleById( $sArticleId )
00263 {
00265 $oArticle = oxNew( 'oxArticle' );
00266 $oArticle->load( $sArticleId );
00267 $iLinkType = $this->getViewParameter( 'iLinkType' );
00268
00269 if ( $this->getViewParameter( 'inlist' ) ) {
00270 $oArticle->setInList();
00271 }
00272 if ( $iLinkType ) {
00273 $oArticle->setLinkType( $iLinkType );
00274 }
00275 if ( $oRecommList = $this->getActiveRecommList() ) {
00276 $oArticle->text = $oRecommList->getArtDescription( $oArticle->getId() );
00277 }
00278
00279 return $oArticle;
00280 }
00281
00282 }