Go to the documentation of this file.00001 <?php
00002
00008 class PriceAlarm_List extends oxAdminList
00009 {
00015 protected $_sListClass = 'oxpricealarm';
00016
00022 protected $_sDefSort = "oxpricealarm.oxuserid";
00023
00031 protected function _buildSelectString( $oListObject = null )
00032 {
00033 $sSql = "select oxpricealarm.*, oxarticles.oxtitle AS articletitle, ";
00034 $sSql .= "oxuser.oxlname as userlname, oxuser.oxfname as userfname ";
00035 $sSql .= "from oxpricealarm ";
00036 $sSql .= "left join oxarticles on oxarticles.oxid = oxpricealarm.oxartid ";
00037 $sSql .= "left join oxuser on oxuser.oxid = oxpricealarm.oxuserid WHERE 1 ";
00038
00039 return $sSql;
00040 }
00041
00048 public function render()
00049 {
00050 $myConfig = $this->getConfig();
00051
00052 parent::render();
00053
00054
00055 $oDefCurr = $myConfig->getActShopCurrencyObject();
00056 $myUtils = oxUtils::getInstance();
00057 $myLang = oxLang::getInstance();
00058
00059 foreach ( $this->_aViewData["mylist"] as $oListItem ) {
00060
00061 $oArticle = oxNew( "oxarticle" );
00062 $oArticle->load($oListItem->oxpricealarm__oxartid->value);
00063
00064
00065 $oThisCurr = $myConfig->getCurrencyObject( $oListItem->oxpricealarm__oxcurrency->value );
00066
00067
00068
00069 if ( !$oThisCurr ) {
00070 $oThisCurr = $myConfig->getCurrencyObject( $oDefCurr->name );
00071 $oListItem->oxpricealarm__oxcurrency->setValue($oDefCurr->name);
00072 }
00073
00074
00075
00076 $dArtPrice = $oArticle->getPrice()->getBruttoPrice() * $oThisCurr->rate;
00077 $dArtPrice = $myUtils->fRound( $dArtPrice );
00078
00079 $oListItem->fprice = $myLang->formatCurrency( $dArtPrice, $oThisCurr );
00080
00081 if ( $oArticle->oxarticles__oxparentid->value && !$oArticle->oxarticles__oxtitle->value) {
00082 $oParent = oxNew( "oxarticle" );
00083 $oParent->load( $oArticle->oxarticles__oxparentid->value );
00084 $sFieldName = "oxpricealarm__articletitle";
00085 $oListItem->$sFieldName = new oxField( $oParent->oxarticles__oxtitle->value . " " . $oArticle->oxarticles__oxvarselect->value );
00086 }
00087
00088 $oListItem->fpricealarmprice = $myLang->formatCurrency( $oListItem->oxpricealarm__oxprice->value, $oThisCurr);
00089
00090
00091 $oListItem->iStatus = 0;
00092
00093
00094 if ( $oListItem->oxpricealarm__oxprice->value >= $dArtPrice)
00095 $oListItem->iStatus = 1;
00096
00097
00098 if ( $oListItem->oxpricealarm__oxsended->value != "0000-00-00 00:00:00")
00099 $oListItem->iStatus = 2;
00100 }
00101
00102 return "pricealarm_list.tpl";
00103 }
00104
00110 public function buildWhere()
00111 {
00112 $this->_aWhere = ( array ) parent::buildWhere();
00113
00114
00115 if ( $this->_aWhere['oxpricealarm.oxprice'] ) {
00116 $sPriceParam = (double) str_replace( array( '%', ',' ), array( '', '.' ), $this->_aWhere['oxpricealarm.oxprice'] );
00117 $this->_aWhere['oxpricealarm.oxprice'] = '%'. $sPriceParam. '%';
00118 }
00119
00120 if ( $this->_aWhere['oxarticles.oxprice'] ) {
00121 $sPriceParam = (double) str_replace( array( '%', ',' ), array( '', '.' ), $this->_aWhere['oxarticles.oxprice'] );
00122 $this->_aWhere['oxarticles.oxprice'] = '%'. $sPriceParam. '%';
00123 }
00124
00125 return $this->_aWhere;
00126 }
00127
00128 }