Jump to content
scottyb

Newsletter products, HTML email

Recommended Posts

Mark,

 

Looks like the class isn't seeing the $currencies class variables created in newsletters.php. You will probably have to add that during your html_content() function. Try adding global $currencies; after the function declaration.

 

Aside from that, the debugging is up to you my friend. Good luck, for your sake I hope this is the solution.

Share this post


Link to post
Share on other sites
Whoa, that's what I get when I try to reply in the am before coffee.

 

So when I said that whole $currencies->display_price($price_value, $tax_value, $quantity); thing I was looking at the application_top.php from the catalog, not the admin.

 

Anyways, in order to use this, you're going to need to add

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

to the top of your newsletters.php file. Then add the $currencies->display_price($images['products_price'], $images['products_tax']).

 

That should work (without having to alter your DB).

 

mmm. this is where I got to yesterday with the error:

Fatal error: Call to a member function on a non-object in catalog/admin/includes/modules/newsletters/newsletter_products.php on line 122

 

after adding

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

to the top of newsletters.php and

 

$html_content .= '<td class="content" align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $images['products_id']) . '"  class="content">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '<br>' . $images['products_name'] . '</a></td>
<td valign="top"><font size="3" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>' . $images['products_name'] . '</b></font><br><font size="3" color="#663366" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">' . $images['products_intro'] . '</font><br><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">' . $images['products_description'] . $currencies->display_price($images['products_price'], $images['products_tax']) . '<font></td>';

 

to newsletter_products.php

 

can you confirm this is what you mean? thanks.

Share this post


Link to post
Share on other sites

Mark,

 

Looks like the class isn't seeing the $currencies class variables created in newsletters.php. You will probably have to add that during your html_content() function. Try adding global $currencies; after the function declaration.

 

Aside from that, the debugging is up to you my friend. Good luck, for your sake I hope this is the solution.

Share this post


Link to post
Share on other sites

Ok, I got it.

 

Find

 

	function html_content() {
	//create HTML string containing links & pics
	define('COLS', 1);
	$width = intval(0/COLS);

 

and change it to

 

	function html_content() {
	//create HTML string containing links & pics
	define('COLS', 1);
	$width = intval(0/COLS);
			require(DIR_WS_CLASSES . 'currencies.php');
			$currencies = new currencies();

 

This will sort out the undefined function error.

 

Mark


Lifes a bitch, then you marry one, then you die!

Share this post


Link to post
Share on other sites

In newsletter manager I chose 'new newsletter' , then selected 'newsletter_products' from the drop down menu. I called the newsletter 'test' and then selected the first of my products that appeared in the list and clicked '>>>', so it appeared in the 'selected products' window. However, when I clicked on 'save' I get the following error message???

 

 

1054 - Unknown column 'products' in 'field list'

 

insert into newsletters (title, content, module, products, template, date_added, status, locked) values ('test', '', 'newsletter_products', '91', '', now(), '0', '0')

 

[TEP STOP]

 

Can any one help?

 

Thanks

Jemma

Share this post


Link to post
Share on other sites
In newsletter manager I chose 'new newsletter' , then selected 'newsletter_products' from the drop down menu. I called the newsletter 'test' and then selected the first of my products that appeared in the list and clicked '>>>', so it appeared in the 'selected products' window. However, when I clicked on 'save' I get the following error message???

Can any one help?

 

Thanks

Jemma

 

OK, I had mis-named the 'products' bit products text'!

 

Dear oh dear!

 

However, now I can choose a product to create the newsletter, but nothing appears in the preview???

 

thanks jemma

Share this post


Link to post
Share on other sites

I want to write descriptions next to my products and also put a message at the top and the bottom of the page. can someone tell me how to do this, as I can't edit the newsletter apart from adding or removing products!!!???

 

thanks

jemma

Share this post


Link to post
Share on other sites

Great contribution! I am trying to get this integrated, and have it mostly working with a few issues that I hope someone can help with.

 

The first problem is with the images and links. For some reason my paths are not being generated correctly, so neither of these works. Here is a sample from viewing the source of a received e-mail:

 

<td class="content" align="center" width="33%"><a href="http://www.greenmountainspecialties.comproduct_info.php?products_id=308"  class="content"><img src="http://www.greenmountainspecialties.com../images/253-264-200365.jpg" width="100" height="80" border="0" alt="Dewalt 9.6V Compact 3/8" Adjustable Clutch Drill-Driver Kit" title="Dewalt 9.6V Compact 3/8" Adjustable Clutch Drill-Driver Kit"><br>Dewalt 9.6V Compact 3/8" Adjustable Clutch Drill-Driver Kit<br>$147.00</a></td>

 

Notice the first path for the href link - there is no "/" between .com and product_info.

 

The second path for the img src has ".." between the .com and the /images directory.

 

What seems to be going on here?

 

The second issue comes in when I put in the code from Mark to display prices. It is rounding my prices of to the next whole dollar (i.e. product is $8.96 shows up as $9.00). Any idea why that might be happening?

 

Thanks for any help anyone can provide.

 

John

Share this post


Link to post
Share on other sites

Hello,

 

I just installed this module and trying to play around with its functions. I have some basic questions to begin with. I wonder is there any way I can specify what customers are to receive a newsletter? I have a Template: Browse on admin/newsletters.php and it's browsing my computer for a file. What is this for and what file is this looking for? What exactly should I put into Content: area? Is there any way to insert pictures into a newsletter to make it look like all this fancy newsletters sent by some popular web sites?

 

I'll appreciate your help.

Thanks.

Share this post


Link to post
Share on other sites

Jemma,

 

Did you ever get this working to where you could edit more than the products and view the newsletter? Did you overwrite the files or did you cut and paste line edits. It sounds like your missing code in more than one place if you can't preview the newsletter or change anything other than the products.

 

Unfortunately, this contribution will not easily be modified to add text blurbs next to the images. The products that are used are stored with commas in one field of the newsletters table in the DB. If you want to do this, I would recommend a redesign of how this works. i.e. create a new table to hold each product within the newsletter as well as the blurb.

 

John,

The image links are created from your configuration file settings, this is the line in modules/newsletter_products.php:

$html_content .= '</tr><tr><td class="content" align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $images['products_id']) . '" class="content">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $images['products_name'] . '</a></td>';

 

It looks like you have some funky settings in the config.php file. ../ are valid html folder references, but for the purpose of this, it won't work.

 

As far as the prices go, read my suggestion from a few posts back.

 

Irin,

The readme.txt file explains how the template operates in part 3b.

Share this post


Link to post
Share on other sites

Hello i have a small problema with this nice contrib:

 

When i select a product (see image)

17eg5.jpg

 

In the preview of my newsletter i see duplicate products(see images)

29xn.jpg

 

 

 

 

And after i send the mail i see this:

"Warning: Missing argument 3 for newsletter_products() in /web/htdocs/www.needforexhaust.com/home/admin/includes/modules/newsletters/newsletter_products.php on line 16

 

Warning: Missing argument 4 for newsletter_products() in /web/htdocs/www.needforexhaust.com/home/admin/includes/modules/newsletters/newsletter_products.php on line 16

 

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.needforexhaust.com/home/admin/includes/functions/database.php on line 99"

 

When i go in the my e-mail i see that the newsletter si arrived but in the body of it the images of the products missing!!!

 

WHY? HELP

bye thank

exhaust

Share this post


Link to post
Share on other sites

I see this in the HTML of the mail that arrive to me

 

<table border=3D"0" width=3D"100%" height=3D"100%" cellpadding=3D"2" cellsp=

acing=3D"3"><tr><td colspan=3D"2" align=3D"center" class=3D"content">Newsle=

tter test!!!</td></tr><tr><td colspan=3D"2"><img src=3D"images/pixel_trans.=

gif" border=3D"0" alt=3D"" width=3D"1" height=3D"10"></td></tr><tr></tr></t=

able>

Share this post


Link to post
Share on other sites
Hello i have a small problema with this nice contrib:

 

When i select a product (see image)

17eg5.jpg

 

In the preview of my newsletter i see duplicate products(see images)

29xn.jpg

And after i send the mail i see this:

"Warning: Missing argument 3 for newsletter_products() in /web/htdocs/www.needforexhaust.com/home/admin/includes/modules/newsletters/newsletter_products.php on line 16

 

Warning: Missing argument 4 for newsletter_products() in /web/htdocs/www.needforexhaust.com/home/admin/includes/modules/newsletters/newsletter_products.php on line 16

 

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /web/htdocs/www.needforexhaust.com/home/admin/includes/functions/database.php on line 99"

 

When i go in the my e-mail i see that the newsletter si arrived but in the body of it the images of the products missing!!!

 

WHY? HELP

bye thank

exhaust

 

Exhaust,

 

in admin/newsletters.php, there are 2 instances that call newsletter_products(). The first sets all equal to empty strings, the second fills the function with your product information declared in the $nInfo class. I would guess that the mysql_fetch_array is failing becuase $nInfo->products and $nInfo->template are probably empty.

 

As far as the lack of images go, you don't have absolute references (http://www.exaust.com/images/muffler.jpg). Make sure the full path is included in the html_content() function: tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $images['products_image'], $images['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

 

For the duplicate images, check previous posts. It has to do with multiple languages. There is a quick fix for this that you basically choose a default language for the newsletter.

 

Version 2.0 is hopefully coming out in the next month, and will address the issues so far in this thread as well as better email implementation.

Edited by scottyb

Share this post


Link to post
Share on other sites
not understand!!! :P

 

Not sure what part you are talking about.

 

If it's the newsletter_products error, you are not passing required variables to the function. Check the $nInfo->products and $nInfo->template variables. Those are what is supposed to be passed to the function.

 

The email that is coming through doesn't have the content, because the above function is failing.

Share this post


Link to post
Share on other sites

This is my admin/newsletter.php

 

 

 

 

 

<?php
/*
 $Id: newsletters.php,v 1.17 2003/06/29 22:50:52 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
switch ($action) {
  case 'lock':
  case 'unlock':
	$newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']);
	$status = (($action == 'lock') ? '1' : '0');

	tep_db_query("update " . TABLE_NEWSLETTERS . " set locked = '" . $status . "' where newsletters_id = '" . (int)$newsletter_id . "'");

	tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']));
	break;
  case 'insert':
  case 'update':
	if (isset($HTTP_POST_VARS['newsletter_id'])) $newsletter_id = tep_db_prepare_input($HTTP_POST_VARS['newsletter_id']);
	$newsletter_module = tep_db_prepare_input($HTTP_POST_VARS['module']);
	$title = tep_db_prepare_input($HTTP_POST_VARS['title']);
	$content = tep_db_prepare_input($HTTP_POST_VARS['content']);
//newsletter products
	$products = $HTTP_POST_VARS['chosen'];;
	//end newsletter products

	$newsletter_error = false;
	if (empty($title)) {
	  $messageStack->add(ERROR_NEWSLETTER_TITLE, 'error');
	  $newsletter_error = true;
	}

	if (empty($module)) {
	  $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error');
	  $newsletter_error = true;
	}

  	if ($newsletter_error == false) {
		   //newsletter products
			 $products_string = '';
			   $once = false;
	 	   if(!empty($products)){
		   	for($i=0, $n=sizeof($products); $i<$n; $i++){
				  $products_string .= (!$once) ? $products[$i] : ',' . $products[$i];
				  $once = true;
			  }
			 }
			 //copy template only if modified	 
			 $template_file = new upload('template');
   	 	   $template_file->set_destination(DIR_WS_TEMPLATES);
	 	   if ($template_file->parse() && $template_file->save()) {
			 	$template = $template_file->filename;
			 } else {
			  $template = (isset($HTTP_POST_VARS['previous_template']) ? $HTTP_POST_VARS['previous_template'] : '');
			 }	   

		  $sql_data_array = array('title' => $title,
								  'content' => $content,
								  'module' => $newsletter_module,
								  'products' => $products_string,
								  'template' => $template);
		  //end newsletter products

	  if ($action == 'insert') {
		$sql_data_array['date_added'] = 'now()';
		$sql_data_array['status'] = '0';
		$sql_data_array['locked'] = '0';

		tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array);
		$newsletter_id = tep_db_insert_id();
	  } elseif ($action == 'update') {
		tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int)$newsletter_id . "'");
	  }

	  tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'nID=' . $newsletter_id));
	} else {
	  $action = 'new';
	}
	break;
  case 'deleteconfirm':
	$newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']);

	tep_db_query("delete from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$newsletter_id . "'");

	tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page']));
	break;
  case 'delete':
  case 'new': if (!isset($HTTP_GET_VARS['nID'])) break;
  case 'send':
  case 'confirm_send':
	$newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']);

	$check_query = tep_db_query("select locked from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$newsletter_id . "'");
	$check = tep_db_fetch_array($check_query);

	if ($check['locked'] < 1) {
	  switch ($action) {
		case 'delete': $error = ERROR_REMOVE_UNLOCKED_NEWSLETTER; break;
		case 'new': $error = ERROR_EDIT_UNLOCKED_NEWSLETTER; break;
		case 'send': $error = ERROR_SEND_UNLOCKED_NEWSLETTER; break;
		case 'confirm_send': $error = ERROR_SEND_UNLOCKED_NEWSLETTER; break;
	  }

	  $messageStack->add_session($error, 'error');

	  tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']));
	}
	break;
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
if ($action == 'new') {
$form_action = 'insert';
  		//newsletter products
		include(DIR_WS_MODULES . 'newsletters/newsletter_products.php');
		include(DIR_WS_LANGUAGES . $language . '/modules/newsletters/newsletter_products.php');
		$products = new newsletter_products('','', '', '');

		$parameters = array('title' => '',
							'content' => '',
							'module' => '',
							'products' => '',
							'template' => '');
		//end newsletter products

$nInfo = new objectInfo($parameters);

if (isset($HTTP_GET_VARS['nID'])) {
  $form_action = 'update';

  $nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);

//newsletter products
		  $newsletter_query = tep_db_query("select title, content, module, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
 		//end newsletter products
  $newsletter = tep_db_fetch_array($newsletter_query);

  $nInfo->objectInfo($newsletter);
} elseif ($HTTP_POST_VARS) {
  $nInfo->objectInfo($HTTP_POST_VARS);
}

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
$directory_array = array();
if ($dir = dir(DIR_WS_MODULES . 'newsletters/')) {
  while ($file = $dir->read()) {
	if (!is_dir(DIR_WS_MODULES . 'newsletters/' . $file)) {
	  if (substr($file, strrpos($file, '.')) == $file_extension) {
		$directory_array[] = $file;
	  }
	}
  }
  sort($directory_array);
  $dir->close();
}

for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
  $modules_array[] = array('id' => substr($directory_array[$i], 0, strrpos($directory_array[$i], '.')), 'text' => substr($directory_array[$i], 0, strrpos($directory_array[$i], '.')));
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr><?php //newsletter products
		  echo tep_draw_form('newsletter', FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'action=' . $form_action, 'post', ' enctype="multipart/form-data" onSubmit="return selectAll(\'newsletter\', \'chosen[]\')"'); if ($form_action == 'update') echo tep_draw_hidden_field('newsletter_id', $nID); 
		  //end newsletter products ?>
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><?php echo TEXT_NEWSLETTER_MODULE; ?></td>
		<td class="main"><?php echo tep_draw_pull_down_menu('module', $modules_array, $nInfo->module); ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_NEWSLETTER_TITLE; ?></td>
		<td class="main"><?php echo tep_draw_input_field('title', $nInfo->title, '', true); ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main" valign="top"><?php echo TEXT_NEWSLETTER_CONTENT; ?></td>
		<td class="main"><?php echo tep_draw_textarea_field('content', 'soft', '100%', '20', $nInfo->content); ?></td>
	  </tr>
<?php
//newsletter products
?>
<tr>
<td colspan="2"><?php tep_draw_separator('pixel_trans.gif' , '1', '10'); ?></td>
</tr>
<tr>
  <td colspan="2" class="main" align="center"><?php echo TEXT_NEWSLETTER_NOTE; ?></td>
</tr>
<tr>
   	<td></td>
	  <td class="main"><?php echo $products->choose_products(); ?></td>
</tr>
<tr>
 	<td class="main" valign="top"><?php echo TEXT_NEWSLETTER_TEMPLATE; ?></td>
	  <td class="main" valign="top"><?php echo tep_draw_file_field('template') . '<br>' . $nInfo->template . tep_draw_hidden_field('previous_template', $nInfo->template);?></td>
</tr>
<?php
//end newsletter products
?>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main" align="right"><?php echo (($form_action == 'insert') ? tep_image_submit('button_save.gif', IMAGE_SAVE) : tep_image_submit('button_update.gif', IMAGE_UPDATE)). '??<a href="' . tep_href_link(FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . (isset($HTTP_GET_VARS['nID']) ? 'nID=' . $HTTP_GET_VARS['nID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
	  </tr>
	</table></td>
  </form></tr>
<?php
 } elseif ($action == 'preview') {
$nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);
//newsletter products
$newsletter_query = tep_db_query("select title, content, module, products, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
$newsletter = tep_db_fetch_array($newsletter_query);
$nInfo = new objectInfo($newsletter);
?>
  <tr>
	<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  </tr>
<?php
if($nInfo->module == 'newsletter_products'){
	include(DIR_WS_MODULES . 'newsletters/newsletter_products.php');
	include(DIR_WS_LANGUAGES . $language . '/modules/newsletters/newsletter_products.php');
	$module = new newsletter_products($nInfo->title, $nInfo->content, $nInfo->products, $nInfo->template);
?>
<tr>
	<td><?php echo $module->html_content(); ?></td>
</tr>
<?php
}else{
?>
  <tr>
	<td><tt><?php echo nl2br($nInfo->content); ?></tt></td>
  </tr>
<?php
}	
//end newsletter products
?>
	<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  </tr>
<?php
 } elseif ($action == 'send') {
$nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);

//newsletter products
$newsletter_query = tep_db_query("select title, content, module, products, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
//end newsletter products
$newsletter = tep_db_fetch_array($newsletter_query);

$nInfo = new objectInfo($newsletter);

include(DIR_WS_LANGUAGES . $language . '/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
$module_name = $nInfo->module;
//newsletter products
if($nInfo->module == 'newsletter_products'){
	$module = new $module_name($nInfo->title, $nInfo->content, $nInfo->products, $nInfo->template);
}else{
	$module = new $module_name($nInfo->title, $nInfo->content);
}
//end newsletter products
?>
  <tr>
	<td><?php if ($module->show_choose_audience) { echo $module->choose_audience(); } else { echo $module->confirm(); } ?></td>
  </tr>
<?php
 } elseif ($action == 'confirm') {
$nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);

  //newsletter products
$newsletter_query = tep_db_query("select newsletters_id, title, content, module, products, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
//end newsletter products
$newsletter = tep_db_fetch_array($newsletter_query);

$nInfo = new objectInfo($newsletter);

include(DIR_WS_LANGUAGES . $language . '/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
$module_name = $nInfo->module;
//newsletter products
if($nInfo->module == 'newsletter_products'){
	$module = new $module_name($nInfo->title, $nInfo->content, $nInfo->products, $nInfo->template);
}else{
	$module = new $module_name($nInfo->title, $nInfo->content);
}
//end newsletter products
?>
  <tr>
	<td><?php echo $module->confirm(); ?></td>
  </tr>
<?php
 } elseif ($action == 'confirm_send') {
$nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);

$newsletter_query = tep_db_query("select newsletters_id, title, content, module from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
$newsletter = tep_db_fetch_array($newsletter_query);

$nInfo = new objectInfo($newsletter);

include(DIR_WS_LANGUAGES . $language . '/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
include(DIR_WS_MODULES . 'newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.')));
$module_name = $nInfo->module;
$module = new $module_name($nInfo->title, $nInfo->content);
?>
  <tr>
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main" valign="middle"><?php echo tep_image(DIR_WS_IMAGES . 'ani_send_email.gif', IMAGE_ANI_SEND_EMAIL); ?></td>
		<td class="main" valign="middle"><b><?php echo TEXT_PLEASE_WAIT; ?></b></td>
	  </tr>
	</table></td>
  </tr>
<?php
 tep_set_time_limit(0);
 flush();
 $module->send($nInfo->newsletters_id);
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><font color="#ff0000"><b><?php echo TEXT_FINISHED_SENDING_EMAILS; ?></b></font></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td><?php echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  </tr>
<?php
 } else {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NEWSLETTERS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_SIZE; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_MODULE; ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SENT; ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>?</td>
		  </tr>
<?php
$newsletters_query_raw = "select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked from " . TABLE_NEWSLETTERS . " order by date_added desc";
$newsletters_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $newsletters_query_raw, $newsletters_query_numrows);
$newsletters_query = tep_db_query($newsletters_query_raw);
while ($newsletters = tep_db_fetch_array($newsletters_query)) {
if ((!isset($HTTP_GET_VARS['nID']) || (isset($HTTP_GET_VARS['nID']) && ($HTTP_GET_VARS['nID'] == $newsletters['newsletters_id']))) && !isset($nInfo) && (substr($action, 0, 3) != 'new')) {
	$nInfo = new objectInfo($newsletters);
  }

  if (isset($nInfo) && is_object($nInfo) && ($newsletters['newsletters_id'] == $nInfo->newsletters_id) ) {
	echo '				  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=preview') . '\'">' . "\n";
  } else {
	echo '				  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $newsletters['newsletters_id']) . '\'">' . "\n";
  }
?>
			<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $newsletters['newsletters_id'] . '&action=preview') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>?' . $newsletters['title']; ?></td>
			<td class="dataTableContent" align="right"><?php echo number_format($newsletters['content_length']) . ' bytes'; ?></td>
			<td class="dataTableContent" align="right"><?php echo $newsletters['module']; ?></td>
			<td class="dataTableContent" align="center"><?php if ($newsletters['status'] == '1') { echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK); } else { echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS); } ?></td>
			<td class="dataTableContent" align="center"><?php if ($newsletters['locked'] > 0) { echo tep_image(DIR_WS_ICONS . 'locked.gif', ICON_LOCKED); } else { echo tep_image(DIR_WS_ICONS . 'unlocked.gif', ICON_UNLOCKED); } ?></td>
			<td class="dataTableContent" align="right"><?php if (isset($nInfo) && is_object($nInfo) && ($newsletters['newsletters_id'] == $nInfo->newsletters_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $newsletters['newsletters_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>?</td>
		  </tr>
<?php
}
?>
		  <tr>
			<td colspan="6"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText" valign="top"><?php echo $newsletters_split->display_count($newsletters_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_NEWSLETTERS); ?></td>
				<td class="smallText" align="right"><?php echo $newsletters_split->display_links($newsletters_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
			  </tr>
			  <tr>
				<td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'action=new') . '">' . tep_image_button('button_new_newsletter.gif', IMAGE_NEW_NEWSLETTER) . '</a>'; ?></td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
case 'delete':
  $heading[] = array('text' => '<b>' . $nInfo->title . '</b>');

  $contents = array('form' => tep_draw_form('newsletters', FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=deleteconfirm'));
  $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  $contents[] = array('text' => '<br><b>' . $nInfo->title . '</b>');
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <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>');
  break;
default:
  if (is_object($nInfo)) {
	$heading[] = array('text' => '<b>' . $nInfo->title . '</b>');

	if ($nInfo->locked > 0) {
	  $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=new') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=preview') . '">' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=send') . '">' . tep_image_button('button_send.gif', IMAGE_SEND) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=unlock') . '">' . tep_image_button('button_unlock.gif', IMAGE_UNLOCK) . '</a>');
	} else {
	  $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=preview') . '">' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a> <a href="' . tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=lock') . '">' . tep_image_button('button_lock.gif', IMAGE_LOCK) . '</a>');
	}
	$contents[] = array('text' => '<br>' . TEXT_NEWSLETTER_DATE_ADDED . ' ' . tep_date_short($nInfo->date_added));
	if ($nInfo->status == '1') $contents[] = array('text' => TEXT_NEWSLETTER_DATE_SENT . ' ' . tep_date_short($nInfo->date_sent));
  }
  break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";
 }
?>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Exhaust,

 

mark27uk3 had a similar problem where the DB fields weren't being populated. Unfortunately, it seemed to have fixed itself and we never discovered where the error was occurring. You'd have to debug the code inserting values into the DB and selecting them out via the $nInfo object.

Share this post


Link to post
Share on other sites

brilliant contrib, got this all working, but just noticed one issue is that my html area WYSIWYG bit is missing now, i.e. MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7

 

It used to be there and the code is still listed but i dont get any java errors, its just not there, any ideas what caused this ? has anyone else got this contrib installed and its all working fine ?

Share this post


Link to post
Share on other sites
brilliant contrib, got this all working, but just noticed one issue is that my html area WYSIWYG bit is missing now, i.e. MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7

 

It used to be there and the code is still listed but i dont get any java errors, its just not there, any ideas what caused this ? has anyone else got this contrib installed and its all working fine ?

 

I don't think anybody here has used the WYSIWYG contribution with this. The reason I made newsletter products was to avoid using that (I'm a Mac person). Maybe someone else here could help.

 

BTW, v2.0 is coming out shortly. I have a new site going live within the next couple weeks. The code is streamlined and will use the multi-part email functionality.

Share this post


Link to post
Share on other sites

I added the TinyMCE WYSIWYG editor to the content box which was just a matter of installing TinyMCE and then changing the one line in newsletters.php

 

<td class="main"><?php echo tep_draw_textarea_field('content', 'soft', '100%', '20', $nInfo->content, 'class="TinyMCE"'); ?></td>

 

I have never used the contribution from MaxiDVD so I dont know which editor that uses but it should not be hard to work out.

 

I presume that fuzioneer overwrote the admin/newsletters.php file while installing the Newsletter Products contrib and that is what is the problem.

 

Hopefully fuzioneer has a backup :thumbsup:

 

Mark


Lifes a bitch, then you marry one, then you die!

Share this post


Link to post
Share on other sites
The code is streamlined and will use the multi-part email functionality.

 

Any other enhancements ?

 

I presume that fuzioneer overwrote the admin/newsletters.php file while installing the Newsletter Products contrib and that is what is the problem.

 

Hopefully fuzioneer has a backup

 

lol its ok i fixed it just me being dumb :)

Share this post


Link to post
Share on other sites
Any other enhancements ?

lol its ok i fixed it just me being dumb :)

 

Mostly just cleaner/more modular code, but sale price & tax will be included.

Share this post


Link to post
Share on other sites

Hi

I have noticed that special prices are not included.

I have tried to include them in the same matter that has been used on featured products, but it wont work.

 

Anyone know how to show the products with special prices?

Share this post


Link to post
Share on other sites
Hi

I have noticed that special prices are not included.

I have tried to include them in the same matter that has been used on featured products, but it wont work.

 

Anyone know how to show the products with special prices?

 

For your $product_query, change it to this:

$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in(" . $p_string . ") and pd.language_id=" . $languages_id);

 

Then you have to add

'specials_price' => $product['specials_price'], to your $this->productsInfo[] object.

 

Then add something like:

$html_content .= ($this->productsInfo[$i]['specials_price']) ? '<s>' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</s>  ' . $currencies->display_price($this->productsInfo[$i]['specials_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) : $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id']));

into your $html_content string

Share this post


Link to post
Share on other sites

Hi

I can't seem to do this update, Sorry.

My products query looks like this:

 

$products_query = "select pd.products_id, p.short_desc, pd.products_name, p.products_price, p.products_tax_class_id, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = 1 and pd.products_id = p.products_id and p.products_status = '1'";

 

I cant find where to put:

'specials_price' => $product['specials_price'], to your $this->productsInfo[] object.

Is it in the admin/includes/modules/newsletter/newsletter_products.php?

or in /admin/newletter.php?

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

×