22 $sql =
"select oxarticles.oxid, oxpricealarm.oxprice from oxpricealarm, oxarticles where oxarticles.oxid = oxpricealarm.oxartid and oxpricealarm.oxsended = '000-00-00 00:00:00'";
26 if ($rs !=
false && $rs->recordCount() > 0) {
28 $oArticle =
oxNew(
"oxarticle" );
29 $oArticle->load($rs->fields[0]);
30 if ($oArticle->getPrice()->getBruttoPrice() <= $rs->fields[1])
35 $this->_aViewData[
'iAllCnt'] = $iAllCnt;
38 if ( $soxId !=
"-1" && isset( $soxId)) {
40 $oPricealarm =
oxNew(
"oxpricealarm" );
41 $oPricealarm->load( $soxId);
45 if ( $oPricealarm->oxpricealarm__oxuserid->value) {
46 $oUser =
oxNew(
"oxuser" );
47 $oUser->load($oPricealarm->oxpricealarm__oxuserid->value);
48 $oPricealarm->oUser = $oUser;
52 $oShop =
oxNew(
"oxshop" );
56 if ( !( $iLang = $oPricealarm->oxpricealarm__oxlang->value ) ) {
62 $this->_aViewData[
"edit_lang"] =
$aLanguages[$iLang];
64 $oLetter =
new stdClass();
66 if ( isset( $aParams[
'oxpricealarm__oxlongdesc'] ) && $aParams[
'oxpricealarm__oxlongdesc'] ) {
67 $oLetter->oxpricealarm__oxlongdesc =
new oxField( stripslashes( $aParams[
'oxpricealarm__oxlongdesc'] ),
oxField::T_RAW );
79 $oEmail =
oxNew(
"oxEmail" );
80 $sDesc = $oEmail->sendPricealarmToCustomer( $oPricealarm->oxpricealarm__oxemail->value, $oPricealarm, null,
true );
82 $iOldLang = $oLang->getTplLanguage();
83 $oLang->setTplLanguage( $iLang );
85 $oLang->setTplLanguage( $iOldLang );
88 $this->_aViewData[
"editor"] = $this->
_generateTextEditor(
"100%", 300, $oLetter,
"oxpricealarm__oxlongdesc",
"details.tpl.css");
89 $this->_aViewData[
"edit"] = $oPricealarm;
90 $this->_aViewData[
"actshop"] =
$myConfig->getShopId();
95 return "pricealarm_main.tpl";
109 $oPricealarm =
oxNew(
"oxpricealarm" );
110 $oPricealarm->load( $sOxid );
113 $sMailBody = isset( $aParams[
'oxpricealarm__oxlongdesc'] ) ? stripslashes( $aParams[
'oxpricealarm__oxlongdesc'] ) :
'';
115 $sMailBody =
oxRegistry::get(
"oxUtilsView")->parseThroughSmarty( $sMailBody, $oPricealarm->getId() );
118 $sRecipient = $oPricealarm->oxpricealarm__oxemail->value;
120 $oEmail =
oxNew(
'oxemail' );
121 $blSuccess = (int) $oEmail->sendPricealarmToCustomer( $sRecipient, $oPricealarm, $sMailBody );
125 $oPricealarm->oxpricealarm__oxsended->setValue( date(
"Y-m-d H:i:s" ) );
126 $oPricealarm->save();
132 $this->_aViewData[
"mail_succ"] = 1;
134 $this->_aViewData[
"mail_err"] = 1;