54 $this->
init(
'oxnewsletter');
64 public function delete($sOxId = null)
67 $sOxId = $this->
getId();
77 $sDelete =
"delete from oxobject2group where oxobject2group.oxshopid = '" . $this->
getShopId() .
"' and oxobject2group.oxobjectid = " . $oDb->quote($sOxId);
78 $oDb->execute($sDelete);
91 if (isset($this->_oGroups)) {
96 $this->_oGroups =
oxNew(
"oxList",
"oxgroups");
100 $sSelect =
"select {$sViewName}.* from {$sViewName}, oxobject2group
101 where oxobject2group.oxobjectid='" . $this->
getId() .
"'
102 and oxobject2group.oxgroupsid={$sViewName}.oxid ";
103 $this->_oGroups->selectString($sSelect);
135 public function prepare($sUserid, $blPerfLoadAktion =
false)
158 $oxEMail =
oxNew(
'oxemail');
159 $blSend = $oxEMail->sendNewsletterMail($this, $this->_oUser, $this->oxnewsletter__oxsubject->value);
175 $oShop =
oxNew(
'oxshop');
178 $oView =
oxNew(
'oxubase');
179 $oShop = $oView->addGlobalParams($oShop);
181 $oView->addTplParam(
'myshop', $oShop);
182 $oView->addTplParam(
'shop', $oShop);
183 $oView->addTplParam(
'oViewConf', $oShop);
184 $oView->addTplParam(
'oView', $oView);
185 $oView->addTplParam(
'mycurrency',
$myConfig->getActShopCurrencyObject());
186 $oView->addTplParam(
'myuser', $this->_oUser);
190 $aInput[] = array($this->
getId() .
'html', $this->oxnewsletter__oxtemplate->value);
191 $aInput[] = array($this->
getId() .
'plain', $this->oxnewsletter__oxplaintemplate->value);
192 $aRes =
oxRegistry::get(
"oxUtilsView")->parseThroughSmarty($aInput, null, $oView,
true);
194 $this->_sHtmlText = $aRes[0];
195 $this->_sPlainText = $aRes[1];
205 if (is_string($sUserid)) {
206 $oUser =
oxNew(
'oxuser');
207 if ($oUser->load($sUserid)) {
208 $this->_oUser = $oUser;
211 $this->_oUser = $sUserid;
224 if ($blPerfLoadAktion) {
225 $oArtList =
oxNew(
'oxarticlelist');
226 $oArtList->loadActionArticles(
'OXNEWSLETTER');
227 $oView->addTplParam(
'articlelist', $oArtList);
230 if ($this->_oUser->getId()) {
231 $oArticle =
oxNew(
'oxarticle');
232 $sArticleTable = $oArticle->getViewName();
235 $sSelect =
"select $sArticleTable.* from oxorder left join oxorderarticles on oxorderarticles.oxorderid = oxorder.oxid";
236 $sSelect .=
" left join $sArticleTable on oxorderarticles.oxartid = $sArticleTable.oxid";
237 $sSelect .=
" where " . $oArticle->getSqlActiveSnippet();
238 $sSelect .=
" and oxorder.oxuserid = '" . $this->_oUser->getId() .
"' order by oxorder.oxorderdate desc limit 1";
240 if ($oArticle->assignRecord($sSelect)) {
241 $oSimList = $oArticle->getSimilarProducts();
242 if ($oSimList && $oSimList->count()) {
243 $oView->addTplParam(
'simlist', $oSimList);
245 foreach ($oSimList as $oArt) {
246 $oView->addTplParam(
"simarticle$iCnt", $oArt);
265 if (
'oxtemplate' === $sFieldName ||
'oxplaintemplate' === $sFieldName) {