00001 <?php
00002
00009 class PriceAlarm_Mail extends oxAdminDetails
00010 {
00018 public function render()
00019 {
00020 $myConfig = $this->getConfig();
00021
00022 parent::render();
00023
00024 $sIndex="";
00025 if ( $myConfig->getConfigParam( 'blEnterNetPrice' ) )
00026 $sIndex = " * ". (1+$myConfig->getConfigParam( 'dDefaultVAT' )/100);
00027
00028 $sShopID = $myConfig->getShopID();
00029
00030 $this->_aViewData['iAllCnt'] = 0;
00031 $oDB = oxDb::getDb();
00032 $sQ = "select oxprice, oxartid from oxpricealarm where oxsended = '000-00-00 00:00:00' and oxshopid = '$sShopID' ";
00033 $rs = $oDB->execute($sQ);
00034 if ($rs != false && $rs->recordCount() > 0) {
00035 $aSimpleCache = array();
00036 while (!$rs->EOF) {
00037 $sPrice = $rs->fields[0];
00038 $sArtID = $rs->fields[1];
00039 if (isset($aSimpleCache[$sArtID])) {
00040 if ($aSimpleCache[$sArtID] <= $sPrice) {
00041 $this->_aViewData['iAllCnt'] += 1;
00042 }
00043 } else {
00044 $oArticle = oxNew( "oxarticle" );
00045 if ( $oArticle->load($sArtID)) {
00046 $dArtPrice = $aSimpleCache[$sArtID] = $oArticle->getPrice()->getBruttoPrice();
00047 if ($dArtPrice <= $sPrice) {
00048 $this->_aViewData['iAllCnt'] += 1;
00049 }
00050 }
00051 }
00052 $rs->moveNext();
00053 }
00054 }
00055 return "pricealarm_mail.tpl";
00056 }
00057 }