23 $sSql =
"select oxarticles.oxid, oxpricealarm.oxprice from oxpricealarm, oxarticles " .
24 "where oxarticles.oxid = oxpricealarm.oxartid and oxpricealarm.oxsended = '000-00-00 00:00:00'";
28 if ($rs !=
false && $rs->recordCount() > 0) {
30 $oArticle =
oxNew(
"oxarticle");
31 $oArticle->load($rs->fields[0]);
32 if ($oArticle->getPrice()->getBruttoPrice() <= $rs->fields[1]) {
38 $this->_aViewData[
'iAllCnt'] = $iAllCnt;
41 if ($soxId !=
"-1" && isset($soxId)) {
43 $oPricealarm =
oxNew(
"oxpricealarm");
44 $oPricealarm->load($soxId);
48 if ($oPricealarm->oxpricealarm__oxuserid->value) {
49 $oUser =
oxNew(
"oxuser");
50 $oUser->load($oPricealarm->oxpricealarm__oxuserid->value);
51 $oPricealarm->oUser = $oUser;
55 $oShop =
oxNew(
"oxshop");
59 if (!($iLang = $oPricealarm->oxpricealarm__oxlang->value)) {
65 $this->_aViewData[
"edit_lang"] =
$aLanguages[$iLang];
67 $oLetter =
new stdClass();
69 if (isset($aParams[
'oxpricealarm__oxlongdesc']) && $aParams[
'oxpricealarm__oxlongdesc']) {
70 $oLetter->oxpricealarm__oxlongdesc =
new oxField(stripslashes($aParams[
'oxpricealarm__oxlongdesc']),
oxField::T_RAW);
82 $oEmail =
oxNew(
"oxEmail");
83 $sDesc = $oEmail->sendPricealarmToCustomer($oPricealarm->oxpricealarm__oxemail->value, $oPricealarm, null,
true);
85 $iOldLang = $oLang->getTplLanguage();
86 $oLang->setTplLanguage($iLang);
88 $oLang->setTplLanguage($iOldLang);
91 $this->_aViewData[
"editor"] = $this->
_generateTextEditor(
"100%", 300, $oLetter,
"oxpricealarm__oxlongdesc",
"details.tpl.css");
92 $this->_aViewData[
"edit"] = $oPricealarm;
93 $this->_aViewData[
"actshop"] =
$myConfig->getShopId();
98 return "pricealarm_main.tpl";
110 $oPricealarm =
oxNew(
"oxpricealarm");
111 $oPricealarm->load($sOxid);
114 $sMailBody = isset($aParams[
'oxpricealarm__oxlongdesc']) ? stripslashes($aParams[
'oxpricealarm__oxlongdesc']) :
'';
116 $sMailBody =
oxRegistry::get(
"oxUtilsView")->parseThroughSmarty($sMailBody, $oPricealarm->getId());
119 $sRecipient = $oPricealarm->oxpricealarm__oxemail->value;
121 $oEmail =
oxNew(
'oxemail');
122 $blSuccess = (int) $oEmail->sendPricealarmToCustomer($sRecipient, $oPricealarm, $sMailBody);
126 $oPricealarm->oxpricealarm__oxsended->setValue(date(
"Y-m-d H:i:s"));
127 $oPricealarm->save();
133 $this->_aViewData[
"mail_succ"] = 1;
135 $this->_aViewData[
"mail_err"] = 1;