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