pricealarm_list.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class PriceAlarm_List extends oxAdminList
00010 {
00016     protected $_sListClass = 'oxpricealarm';
00017 
00023     protected $_sDefSort = "oxpricealarm.oxuserid";
00024 
00032     protected function _buildSelectString( $oListObject = null )
00033     {
00034         $sSql  = "select oxpricealarm.*, oxarticles.oxtitle AS articletitle, ";
00035         $sSql .= "oxuser.oxlname as userlname, oxuser.oxfname as userfname ";
00036         $sSql .= "from oxpricealarm ";
00037         $sSql .= "left join oxarticles on oxarticles.oxid = oxpricealarm.oxartid ";
00038         $sSql .= "left join oxuser on oxuser.oxid = oxpricealarm.oxuserid WHERE 1 ";
00039 
00040         return $sSql;
00041     }
00042 
00049     public function render()
00050     {
00051         $myConfig = $this->getConfig();
00052 
00053         parent::render();
00054 
00055 
00056         $oDefCurr = $myConfig->getActShopCurrencyObject();
00057 
00058         foreach ( $this->_aViewData["mylist"] as $oListItem ) {
00059 
00060             $oArticle = oxNew( "oxarticle" );
00061             $oArticle->load($oListItem->oxpricealarm__oxartid->value);
00062 
00063             //$oListI = $this->_aViewData["mylist"][$sItemId];
00064             $oThisCurr = $myConfig->getCurrencyObject( $oListItem->oxpricealarm__oxcurrency->value );
00065 
00066             // #869A we should perform currency conversion
00067             // (older versions doesn't have currency info - assume as it is default - first in currency array)
00068             if ( !$oThisCurr ) {
00069                 $oThisCurr = $myConfig->getCurrencyObject( $oDefCurr->name );
00070                 $oListItem->oxpricealarm__oxcurrency->setValue($oDefCurr->name);
00071             }
00072 
00073             // #889C - Netto prices in Admin
00074             // (we have to call $oArticle->getPrice() to get price with VAT)
00075             $dArtPrice = $oArticle->getPrice()->getBruttoPrice() * $oThisCurr->rate;
00076             $dArtPrice = oxUtils::getInstance()->fRound( $dArtPrice );
00077 
00078             $oListItem->fprice = oxLang::getInstance()->formatCurrency( $dArtPrice, $oThisCurr );
00079 
00080             if ( $oArticle->oxarticles__oxparentid->value && !$oArticle->oxarticles__oxtitle->value) {
00081                 $oParent = oxNew( "oxarticle" );
00082                 $oParent->load($oArticle->oxarticles__oxparentid->value);
00083                 $oListItem->oxpricealarm__articletitle = new oxField( $oParent->oxarticles__oxtitle->value." ".$oArticle->oxarticles__oxvarselect->value );
00084             }
00085 
00086             $oListItem->fpricealarmprice = oxLang::getInstance()->formatCurrency( $oListItem->oxpricealarm__oxprice->value, $oThisCurr);
00087 
00088             // neutral status
00089             $oListItem->iStatus = 0;
00090 
00091             // shop price is less or equal
00092             if ( $oListItem->oxpricealarm__oxprice->value >= $dArtPrice)
00093                 $oListItem->iStatus = 1;
00094 
00095             // suggestion to user is sent
00096             if ( $oListItem->oxpricealarm__oxsended->value != "0000-00-00 00:00:00")
00097                 $oListItem->iStatus = 2;
00098         }
00099 
00100         return "pricealarm_list.tpl";
00101     }
00102 
00108     public function buildWhere()
00109     {
00110         $this->_aWhere = parent::buildWhere();
00111 
00112         if ( !is_array($this->_aWhere))
00113             $this->_aWhere = array();
00114 
00115         // updating price fields values for correct search in DB
00116         if ( $this->_aWhere['oxpricealarm.oxprice'] ) {
00117             $sPriceParam = (double) str_replace(array('%',','), array('', '.'), $this->_aWhere['oxpricealarm.oxprice']);
00118             $this->_aWhere['oxpricealarm.oxprice'] = '%'. $sPriceParam. '%';
00119         }
00120 
00121         if ( $this->_aWhere['oxarticles.oxprice'] ) {
00122             $sPriceParam = (double) str_replace(array('%',','), array('', '.'), $this->_aWhere['oxarticles.oxprice']);
00123             $this->_aWhere['oxarticles.oxprice'] = '%'. $sPriceParam. '%';
00124         }
00125 
00126         return $this->_aWhere;
00127     }
00128 
00129 }

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5