pricealarm_mail.php

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