Jump to content
Sign in to follow this  
Gyakutsuki

Newsletter & Subscribtion for MS2

Recommended Posts

Hi there,

 

I've got a problem with version 0.54:

 

everything is working fine except that it doesn't sent an email in html-format. I've found the problem, but don't have the skills to solve it.

 

in catalog/newsletters_subscripe.php there's a line that says

 

if ($email_type == "HTML") {

$newsletter_id='3';

$newsletter_query = "select p.newsletter_info_subject, p.newsletter_info_logo, p.newsletter_info_title, p.newsletter_info_greetings, p.newsletter_info_intro, p.newsletter_info_promo1_name, p.newsletter_info_promo1_des, p.newsletter_info_promo1_img, p.newsletter_info_promo1_url, p.newsletter_info_promo1_link, p.newsletter_info_promo2_name, p.newsletter_info_promo2_des, p.newsletter_info_promo2_img, p.newsletter_info_promo2_url, p.newsletter_info_promo2_link, p.newsletter_info_final_para, p.newsletter_info_closing, q.newsletter_email_address, q.newsletter_template, q.newsletter_user, q.newsletter_site_name, q.newsletter_site_url, q.newsletter_phone, q.newsletter_mailing_address, q.newsletter_template from newsletter_info p , newsletter q where p.newsletter_id = '" . $newsletter_id . "' and q.newsletter_id = p.newsletter_id ";

 

this isn't working. It always sends normal text-mails because p.newsletter_info & q.newsletter isn't there in the database but also I can't find any sql-file attached to version 0.54 which has these tables.

 

is there anybody who can help me fix this problem so I can sent html-newsletters?

 

marcus

Share this post


Link to post
Share on other sites

I'm using 53. Can some one help me?

Usubscribe does not work:

 

The email address listed below, was not found in our newsletter database, or has already been removed from our newletter subscription list.

 

test@test.com?osCsid=c3c4064a1e24d9deaa609419300cae6c

 

I guess this has something to do with the osCsid passed on. can someone help please (I saw this question is open since nearly a year now) !!

Share this post


Link to post
Share on other sites

OK I found a solution to the osCsid problem during unsubscribe:

 

Change newsletter_unsubscribe.php line:

 

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link($filename_newsletter_unsubscribe_done, '', 'NONSSL') . '">' . tep_image_button('button_unsubscribe.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

 

TO:

 

<td align="center" class="main"><br><?php echo '<a href="' . tep_href_link($filename_newsletter_unsubscribe_done, '', 'NONSSL','') . '">' . tep_image_button('button_unsubscribe.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

 

this did the trick for me.

Share this post


Link to post
Share on other sites

Does anyone have directions on how to actually send a newsletter with this? v.54

 

subscribe works, unsubscribe works

 

There are 3 options for the newsletter

When I hit confirm it takes me back to the menu

 

when I click on one of the options, what I typed is there

Share this post


Link to post
Share on other sites
When we try to send we get this message in this page : http://www.promotryp.com/admin/newsletters.php?page=1&nID=4&action=confirm_send

 

Warning: Missing argument 3 for newsletter() in /home/promotry/public_html/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 4 for newsletter() in /home/promotry/public_html/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 5 for newsletter() in /home/promotry/public_html/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 6 for newsletter() in /home/promotry/public_html/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 7 for newsletter() in /home/promotry/public_html/admin/includes/modules/newsletters/newsletter.php on line 17

 

any solution for this?

Share this post


Link to post
Share on other sites
any solution for this?

 

 

well I got it working

 

I installed the latest update ( the newsletter.php file) and it got rid of the errors.

 

I use the Module newsletter_subscribers as the option in the newsletter manager ...almost forgot...a few pages back was a post that had instructions for what to do after deleting the newsletter table in mysql

Share this post


Link to post
Share on other sites

Is there a way to send a test newsletter without sending it to the whole list?

Share this post


Link to post
Share on other sites

I think the contribution would be better with the ability for a customer to enter their email address and then hit unsubscribe on the unsubscribe.php page. For multiple reasons I would like to do this. Any ideas on how to do this?


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites

well please its very important question , in the installation read me file they ask to delete the tabe newslettr in mysql ... but when you try to un newletter manger under the tolls section doesn't work so how we can send news letter ???????

 

:rolleyes:

Share this post


Link to post
Share on other sites
Hi there,

 

I've got a problem with version 0.54:

 

everything is working fine except that it doesn't sent an email in html-format. I've found the problem, but don't have the skills to solve it.

 

in catalog/newsletters_subscripe.php there's a line that says

 

if ($email_type == "HTML") {

$newsletter_id='3';

$newsletter_query = "select p.newsletter_info_subject, p.newsletter_info_logo, p.newsletter_info_title, p.newsletter_info_greetings, p.newsletter_info_intro, p.newsletter_info_promo1_name, p.newsletter_info_promo1_des, p.newsletter_info_promo1_img, p.newsletter_info_promo1_url, p.newsletter_info_promo1_link, p.newsletter_info_promo2_name, p.newsletter_info_promo2_des, p.newsletter_info_promo2_img, p.newsletter_info_promo2_url, p.newsletter_info_promo2_link, p.newsletter_info_final_para, p.newsletter_info_closing, q.newsletter_email_address, q.newsletter_template, q.newsletter_user, q.newsletter_site_name, q.newsletter_site_url, q.newsletter_phone, q.newsletter_mailing_address, q.newsletter_template from newsletter_info p , newsletter q where p.newsletter_id = '" . $newsletter_id . "' and q.newsletter_id = p.newsletter_id ";

 

this isn't working. It always sends normal text-mails because p.newsletter_info & q.newsletter isn't there in the database but also I can't find any sql-file attached to version 0.54 which has these tables.

 

is there anybody who can help me fix this problem so I can sent html-newsletters?

 

marcus

 

It works fine to send html emails you just need to enable html emails in your oscommerce config.


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites
It works fine to send html emails you just need to enable html emails in your oscommerce config.

 

 

Ok please advice how i can send news letter ???? shal i use news letter manger in Tools or how ,,, ok i tried using newsletter manger , new letter button, paste html code with my new letter information , lock, send ,. all my customers recieved email has link to unsubscribe .... please help

Share this post


Link to post
Share on other sites

hello,

 

I installed this contribution, the subscription work well!

 

But the unsubscribe does not work.

 

for user, it seems to function, but in admin, the subscribers are not removed in the data base (status on 1), and not a red light on the newsletter members.

 

do you have an idea why?

Edited by thireg

Share this post


Link to post
Share on other sites
Ok please advice how i can send news letter ???? shal i use news letter manger in Tools or how ,,, ok i tried using newsletter manger , new letter button, paste html code with my new letter information , lock, send ,. all my customers recieved email has link to unsubscribe .... please help

 

I seem to remember posting how the contrib works alwhile back in this contrib (you can do a search by my username) or in the contrib download itself when I posted an update, you might look and see if there are directions there. Sorry, but to be honest I don't remember all the specifics anymore as I no longer use it to send emails, just to collect email addresses.


Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Share this post


Link to post
Share on other sites
I seem to remember posting how the contrib works alwhile back in this contrib (you can do a search by my username) or in the contrib download itself when I posted an update, you might look and see if there are directions there. Sorry, but to be honest I don't remember all the specifics anymore as I no longer use it to send emails, just to collect email addresses.

 

 

Hi..I've been all over the forums, made posts and still no one can tell me how to solve the following error.

 

Parse error: parse error, unexpected ';', expecting T_FUNCTION /admin/includes/modules/newsletters/newsletter.php line 121

 

I've installed several versions, some a couple of times and still come up with the same error. I'm so stupid from messing with this darn problem I can't think straight anymore.

 

ANY HELP GREATLY Appreciated!!

 

Thanks In Advance

 

Here is the problem file....I Think

 

<?php

/*

$Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

// ################# Contribution Newsletter v050 ##############

class newsletter {

var $show_choose_audience, $newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb;

 

function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {

$this->show_choose_audience = false;

$this->newsletters_id = $newsletters_id;

$this->module_subscribers = $module_subscribers;

$this->title = $title;

$this->header = $header;

$this->content = $content;

$this->unsubscribea = $unsubscribea;

$this->unsubscribeb = $unsubscribeb;

 

// ################# END - Contribution Newsletter v050 #############

 

function choose_audience() {

return false;

}

 

function confirm() {

global $HTTP_GET_VARS;

 

$mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

$mail = tep_db_fetch_array($mail_query);

 

// ################# Contribution Newsletter v050 ##############

$confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_INFO . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_BULLETIN_NUMB . "?" . '<font color="#0000ff">' . $this->newsletters_id . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_MODULE . "?" . '<font color="#0000ff">' . $this->module_subscribers . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main">' . TEXT_TITRE_MAIL . "?" . '<font color="#0000ff">' . $this->title . '</font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_VIEW . '</b></font></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->header . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->content . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribea . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td class="main"><tt>' . $this->unsubscribeb . '</tt></td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .

' </tr>' . "\n" .

'</table>';

 

// ################# END - Contribution Newsletter v050 ##############

 

// ################# Contribution Newsletter v050 ##############

function send($newsletter_id) {

$mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

 

while ($mail = tep_db_fetch_array($mail_query)) {

$mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));

// Pr?paration de l'envoie du mail en HTML

$mimemessage->add_html_newsletter($this->header . "\n" . $this->content . "\n" . $this->unsubscribea . "" . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n" . $this->unsubscribeb);

 

$mimemessage->build_message();

// ################# END - Contribution Newsletter v050 #############

$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);

}

 

$newsletter_id = tep_db_prepare_input($newsletter_id);

tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");

}

}

}

?> :thumbsup:

Share this post


Link to post
Share on other sites
function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {

$this->show_choose_audience = false;

$this->newsletters_id = $newsletters_id;

$this->module_subscribers = $module_subscribers;

$this->title = $title;

$this->header = $header;

$this->content = $content;

$this->unsubscribea = $unsubscribea;

$this->unsubscribeb = $unsubscribeb;

 

// ################# END - Contribution Newsletter v050 #############

 

It looks like you're missing a closing curly brace for the newsletter function.

 

Looks like there should be a } below $this->unsubscribeb = $unsubscribeb;

 

   $this->unsubscribeb = $unsubscribeb;						  
		   }
// ################# END - Contribution Newsletter v050 #############

Share this post


Link to post
Share on other sites
It looks like you're missing a closing curly brace for the newsletter function.

 

Looks like there should be a } below $this->unsubscribeb = $unsubscribeb;

 

   $this->unsubscribeb = $unsubscribeb;						  
		   }
// ################# END - Contribution Newsletter v050 #############

 

 

 

Hi..I added the bracket and now I get the following error:

 

Warning: Missing argument 3 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 4 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 5 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 6 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 17

 

Warning: Missing argument 7 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 17

 

 

I've seen others with this error also but I don't recall seeing a fix...I might of but I don't remember I've been messing with this damn thing for days.

 

Thanks In Advance For Any Help

Share this post


Link to post
Share on other sites

There seem to be a few closing bracket irregularities. Have a go with the code I use below.

 

<?php
/*
 $Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/
// ################# Contribution Newsletter v050 ##############
/*
 class newsletter {
var $show_choose_audience, $title, $content;

function newsletter($title, $content) {
  $this->show_choose_audience = false;
  $this->title = $title;
  $this->content = $content;
}
*/
 class newsletter {
var $show_choose_audience, $newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb;

function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {
  $this->show_choose_audience = false;
  $this->newsletters_id = $newsletters_id;
  $this->module_subscribers = $module_subscribers;
  $this->title = $title;
  $this->header = $header;
  $this->content = $content;
  $this->unsubscribea = $unsubscribea;
  $this->unsubscribeb = $unsubscribeb;						  
}
// ################# END - Contribution Newsletter v050 ##############




function choose_audience() {
  return false;
}

function confirm() {
  global $HTTP_GET_VARS;

  $mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  $mail = tep_db_fetch_array($mail_query);

// ################# Contribution Newsletter v050 ##############

/*  $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><b>' . $this->title . '</b></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . nl2br($this->content) . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
					'  </tr>' . "\n" .
					'</table>';
*/


  $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') .  TEXT_TITRE_INFO . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .												
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_BULLETIN_NUMB . "?" . '<font color="#0000ff">' . $this->newsletters_id . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_MODULE . "?" . '<font color="#0000ff">' . $this->module_subscribers . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_TITRE_MAIL . "?" . '<font color="#0000ff">' . $this->title . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_VIEW . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .												
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->header . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->content . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->unsubscribea . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->unsubscribeb . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .												
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
					'  </tr>' . "\n" .
					'</table>';
// ################# END - Contribution Newsletter v050 ##############

  return $confirm_string;
}

  // ################# Contribution Newsletter v050 ##############
/*
function send($newsletter_id) {
  $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

  $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  $mimemessage->add_text($this->content);
  $mimemessage->build_message();
  while ($mail = tep_db_fetch_array($mail_query)) {
  */


function send($newsletter_id) {
  $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

  while ($mail = tep_db_fetch_array($mail_query)) {
  $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  // Pr?paration de l'envoie du mail en HTML 
  $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">'  . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);

	$mimemessage->build_message();
// ################# END - Contribution Newsletter v050 ##############


	$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
  }

  $newsletter_id = tep_db_prepare_input($newsletter_id);
  tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
}
 }
?>

Share this post


Link to post
Share on other sites
There seem to be a few closing bracket irregularities. Have a go with the code I use below.

 

<?php
/*
 $Id: newsletter.php,v 1.1 2002/03/08 18:38:18 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/
// ################# Contribution Newsletter v050 ##############
/*
 class newsletter {
var $show_choose_audience, $title, $content;

function newsletter($title, $content) {
  $this->show_choose_audience = false;
  $this->title = $title;
  $this->content = $content;
}
*/
 class newsletter {
var $show_choose_audience, $newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb;

function newsletter($newsletters_id, $module_subscribers, $title, $header, $content, $unsubscribea, $unsubscribeb) {
  $this->show_choose_audience = false;
  $this->newsletters_id = $newsletters_id;
  $this->module_subscribers = $module_subscribers;
  $this->title = $title;
  $this->header = $header;
  $this->content = $content;
  $this->unsubscribea = $unsubscribea;
  $this->unsubscribeb = $unsubscribeb;						  
}
// ################# END - Contribution Newsletter v050 ##############




function choose_audience() {
  return false;
}

function confirm() {
  global $HTTP_GET_VARS;

  $mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  $mail = tep_db_fetch_array($mail_query);

// ################# Contribution Newsletter v050 ##############

/*  $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><b>' . $this->title . '</b></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . nl2br($this->content) . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
					'  </tr>' . "\n" .
					'</table>';
*/
  $confirm_string = '<table border="0" cellspacing="0" cellpadding="2">' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') .  TEXT_TITRE_INFO . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .												
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_BULLETIN_NUMB . "?" . '<font color="#0000ff">' . $this->newsletters_id . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_MODULE . "?" . '<font color="#0000ff">' . $this->module_subscribers . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main">' . TEXT_TITRE_MAIL . "?" . '<font color="#0000ff">' . $this->title . '</font></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><font color="#ff0000"><b>' . tep_draw_separator('pixel_trans.gif', '20', '1') . TEXT_TITRE_VIEW . '</b></font></td>' . "\n" .
					'  </tr>' . "\n" .												
					'  <tr>' . "\n" .
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->header . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->content . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->unsubscribea . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td class="main"><tt>' . $this->unsubscribeb . '</tt></td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .												
					'	<td>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>' . "\n" .
					'  </tr>' . "\n" .
					'  <tr>' . "\n" .
					'	<td align="right"><a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a></td>' . "\n" .
					'  </tr>' . "\n" .
					'</table>';
// ################# END - Contribution Newsletter v050 ##############

  return $confirm_string;
}

  // ################# Contribution Newsletter v050 ##############
/*
function send($newsletter_id) {
  $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

  $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  $mimemessage->add_text($this->content);
  $mimemessage->build_message();
  while ($mail = tep_db_fetch_array($mail_query)) {
  */


function send($newsletter_id) {
  $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");

  while ($mail = tep_db_fetch_array($mail_query)) {
  $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
  // Pr?paration de l'envoie du mail en HTML 
  $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">'  . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);

	$mimemessage->build_message();
// ################# END - Contribution Newsletter v050 ##############
	$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
  }

  $newsletter_id = tep_db_prepare_input($newsletter_id);
  tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
}
 }
?>

 

 

Hi..I tried your file and get the following error

 

 

Warning: Missing argument 3 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 26

 

Warning: Missing argument 4 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 26

 

Warning: Missing argument 5 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 26

 

Warning: Missing argument 6 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 26

 

Warning: Missing argument 7 for newsletter::newsletter() in /public_html/shop/admin/includes/modules/newsletters/newsletter.php on line 26

 

I really appreciate your help!!! :thumbsup:

Share this post


Link to post
Share on other sites
hello,

 

I installed this contribution, the subscription work well!

 

But the unsubscribe does not work.

 

for user, it seems to function, but in admin, the subscribers are not removed in the data base (status on 1), and not a red light on the newsletter members.

 

do you have an idea why?

 

Hi, I installed last 0.54 version and the "Automatic update of subscribers_table" modification from anorakgirl. almost everything seems to work fine but if I unregister a user in the admin then, create a new mail, when I go back to the "subscribers manager", the unregistered users a registered again. it looks like the synchronisation system overrides the "subscribed newsletter" flag.

 

I modified the tep_set_newsletter_status function like this to solve my problem. hope it helps :

 

  function tep_set_newsletter_status($subscribers_id, $status) {

	$select_str = "select p.customers_id ";
	$from_str .= "from " . TABLE_SUBSCRIBERS . " p ";
	$where = "where p.subscribers_id=" .(int)$subscribers_id;
	$listing_sql = $select_str . $from_str . $where;
	$listing = tep_db_query($listing_sql);

	if (tep_db_num_rows($listing)) {
		$listing_values = tep_db_fetch_array($listing);
		$customer_id = $listing_values['customers_id'];
	}

if ($status == '1') {
		if ($customer_id != 0) {
				$maj_customer =  tep_db_query("update " . TABLE_CUSTOMERS . " set customers_newsletter = '1' where customers_id = '" . (int)$customer_id . "'");
		}
  return tep_db_query("update " . TABLE_SUBSCRIBERS . " set customers_newsletter = '1' where subscribers_id = '" . (int)$subscribers_id . "'");
} elseif ($status == '0') {
	if ($customer_id != 0) {
			$maj_customer =  tep_db_query("update " . TABLE_CUSTOMERS . " set customers_newsletter = '0' where customers_id = '" . (int)$customer_id . "'");
	}
  return tep_db_query("update " . TABLE_SUBSCRIBERS . " set customers_newsletter = '0' where subscribers_id = '" . (int)$subscribers_id . "'");
} else {
  return -1;
}
 }

Share this post


Link to post
Share on other sites

There seem to be a few closing bracket irregularities. Have a go with the code I use below.

 

@ googly

 

I added your code into my catalog\admin\includes\modules\newsletters\newsletter.php

but I got the following error:

 

fatal error: Call to undefined function: add_html_newsletter() in c:\appserv\www\onlineshop\catalog\admin\includes\modules\newsletters\newsletter.php on line 161

 

Line 161:

$mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);

 

Do you have an Idea what is wrong?

 

Chris

Share this post


Link to post
Share on other sites

How do I fix this error?

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home2/webworkt/public_html/catalog/includes/header.php:210) in /home2/webworkt/public_html/catalog/includes/boxes/categories.php on line 13

Share this post


Link to post
Share on other sites

sorry, seems I could not edit the above post...

 

I have found a couple other things that needs to be mentioned:

 

1. Even though I get the error mentioned in the previous post, I still recieve a confirmation email that I in fact did sign up.

2. After the previously mentioned error occurred, Everything else seems to be working just fine. Although I have not recieved the newsletter as of yet.

 

What now?

Share this post


Link to post
Share on other sites
I think the contribution would be better with the ability for a customer to enter their email address and then hit unsubscribe on the unsubscribe.php page. For multiple reasons I would like to do this. Any ideas on how to do this?

 

Yes, I did it, but honestly I'm uninstalling this contrib. I don't understand how there can be so many updates and the most recent still doesn't seem to work properly. Not wasting my time, PM me if you'd like the file changes to let them enter the email manually.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×