53 $this->
init(
'oxnewsletter' );
63 public function delete( $sOxId = null )
66 $sOxId = $this->
getId();
76 $sDelete =
"delete from oxobject2group where oxobject2group.oxshopid = '".$this->getShopId().
"' and oxobject2group.oxobjectid = ".$oDb->quote( $sOxId );
77 $oDb->execute( $sDelete );
90 if ( isset( $this->_oGroups ) ) {
95 $this->_oGroups =
oxNew(
"oxList",
"oxgroups" );
99 $sSelect =
"select {$sViewName}.* from {$sViewName}, oxobject2group
100 where oxobject2group.oxobjectid='".$this->getId().
"'
101 and oxobject2group.oxgroupsid={$sViewName}.oxid ";
102 $this->_oGroups->selectString( $sSelect );
136 public function prepare( $sUserid, $blPerfLoadAktion =
false )
159 $oxEMail =
oxNew(
'oxemail' );
160 $blSend = $oxEMail->sendNewsletterMail( $this, $this->_oUser, $this->oxnewsletter__oxsubject->value );
178 $oShop =
oxNew(
'oxshop' );
181 $oView =
oxNew(
'oxubase' );
182 $oShop = $oView->addGlobalParams( $oShop );
184 $oView->addTplParam(
'myshop', $oShop );
185 $oView->addTplParam(
'shop', $oShop );
186 $oView->addTplParam(
'oViewConf', $oShop );
187 $oView->addTplParam(
'oView', $oView );
188 $oView->addTplParam(
'mycurrency',
$myConfig->getActShopCurrencyObject() );
189 $oView->addTplParam(
'myuser', $this->_oUser );
193 $aInput[] = array( $this->
getId().
'html', $this->oxnewsletter__oxtemplate->value );
194 $aInput[] = array( $this->
getId().
'plain', $this->oxnewsletter__oxplaintemplate->value );
195 $aRes =
oxRegistry::get(
"oxUtilsView")->parseThroughSmarty( $aInput, null, $oView,
true );
197 $this->_sHtmlText = $aRes[0];
198 $this->_sPlainText = $aRes[1];
210 if ( is_string( $sUserid )) {
211 $oUser =
oxNew(
'oxuser' );
212 if ( $oUser->load( $sUserid ) ) {
213 $this->_oUser = $oUser;
216 $this->_oUser = $sUserid;
231 if ( $blPerfLoadAktion ) {
232 $oArtList =
oxNew(
'oxarticlelist' );
233 $oArtList->loadActionArticles(
'OXNEWSLETTER' );
234 $oView->addTplParam(
'articlelist', $oArtList );
237 if ( $this->_oUser->getId() ) {
238 $oArticle =
oxNew(
'oxarticle' );
239 $sArticleTable = $oArticle->getViewName();
242 $sSelect =
"select $sArticleTable.* from oxorder left join oxorderarticles on oxorderarticles.oxorderid = oxorder.oxid";
243 $sSelect .=
" left join $sArticleTable on oxorderarticles.oxartid = $sArticleTable.oxid";
244 $sSelect .=
" where ".$oArticle->getSqlActiveSnippet();
245 $sSelect .=
" and oxorder.oxuserid = '".$this->_oUser->getId().
"' order by oxorder.oxorderdate desc limit 1";
247 if ( $oArticle->assignRecord( $sSelect ) ) {
248 $oSimList = $oArticle->getSimilarProducts();
249 if ( $oSimList && $oSimList->count() ) {
250 $oView->addTplParam(
'simlist', $oSimList );
252 foreach ( $oSimList as $oArt ) {
253 $oView->addTplParam(
"simarticle$iCnt", $oArt );
272 if (
'oxtemplate' === $sFieldName ||
'oxplaintemplate' === $sFieldName ) {