pricealarm_mail.php

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