Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Newsletter Products


Luna Arcana

Recommended Posts

Hi All

 

I've installed the Newsletter Products contribution and have had moderate success with updates and fixes.

One problem that's stopping me though is an error I keep getting when I try to preview a newsletter, update changes to an existing newsletter, or even send the newsletter (just to see what I actually get).

 

I've tried many of the fixes and tips in the forum for these errors, but none of them are yielding any results (for better or for worse).

Here is the error that I'm getting:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and pd.language_id=1' at line 1

 

select p.products_id, pd.products_name, p.products_image2, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_price from products p, products_description pd left join specials s on p.products_id = s.products_id where pd.products_id = p.products_id and p.products_id in() and pd.language_id=1

 

 

MYSQL version is 4.1.20 and I've tried the fixes to /split_page_results.php for both front and admin sides

It appears to me that something is wrong with the SQL statement itself?

Any ideas would be appreciated.

Link to comment
Share on other sites

Could you post the file the query is from? This bit is wrong in()

 

Thanks for the reply.

This is from admin/newsletters.php modified from the Newsletter Products contribution:

 

there's about 600 lines of code, but if you want/need I can post it here

Link to comment
Share on other sites

Ok, search through that file for this in() and if you find it, remove it. If that works, all well and good but if not, then we'll have a look at the file.

 

BTW - Make a copy of admin/newsletters.php before you attempt any changes

Link to comment
Share on other sites

Ok, search through that file for this in() and if you find it, remove it. If that works, all well and good but if not, then we'll have a look at the file.

 

BTW - Make a copy of admin/newsletters.php before you attempt any changes

 

That was the first thing I did when I saw your message, unfortunately no "in()" I searched for "in" "()" and "in()" and found nothing out of the ordinary

I also checked for copy & paste errors from when I added the code from the contribution, nothing obvious, but then again I'm a novice at php so I easily may have missed something.

 

<?php
/*
 $Id: newsletters.php,v 1.17 2003/06/29 22:50:52 hpdl Exp $
 $Id: newsletters.php, v 1.18 2005/07/29 scottyb $
 $Id: newsletters.php, v 1.19 2007/05/17 scottyb $

 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');
 set_time_limit(0);

 //newsletter products
 //currenices class required for price display in newsletter
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
 //end newsletter products

 $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		
	  //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 {
		  if(!empty($HTTP_POST_VARS['template_id'])){
			  //we're using template from drow-down
			  $template = $HTTP_POST_VARS['template_id'];
		  }elseif(empty($HTTP_POST_VARS['template_id']) && isset($HTTP_POST_VARS['previous_template'])){
			  //if old template exists and drop-down not select, keep old template
			  $template = $HTTP_POST_VARS['previous_template'];
		  }else{
			  $template = '';
		  }
		  //$template = (isset($HTTP_POST_VARS['previous_template']) ? $HTTP_POST_VARS['previous_template'] : '');
	  }	   

	  $sql_data_array = array('title' => $title,
							  'content' => $content,
							  'module' => $newsletter_module,
							  '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();

		//newsletter products			
		if(!empty($products)){
			for($i=0, $n=sizeof($products); $i<$n; $i++){
				tep_db_query("insert into " . TABLE_NEWSLETTERS_TO_PRODUCTS . " (newsletters_id, products_id) values (" . $newsletter_id . ", " . $products[$i] . ")");
			}
		}
		//end newsletter products
	  } elseif ($action == 'update') {
		tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int)$newsletter_id . "'");
		//newsletter products			
		tep_db_query("delete from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$newsletter_id . "'");			
		if(!empty($products) && $newsletter_module == 'newsletter_products'){
			for($i=0, $n=sizeof($products); $i<$n; $i++){
				tep_db_query("insert into " . TABLE_NEWSLETTERS_TO_PRODUCTS . " (newsletters_id, products_id) values (" . $newsletter_id . ", " . $products[$i] . ")");
			}
		}
		//end newsletter products
	  }

	  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 . "'");
	//newsletter products
	tep_db_query("delete from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$newsletter_id . "'");
	//end newsletter products

	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>
<script type="text/javascript" language="javascript">
//newsletter products
<!--
function showProducts(){	
var module = document.forms[0].elements['module'].value;
if(module == 'newsletter_products'){
	document.getElementById('products').style.display = 'block';
}else{
	document.getElementById('products').style.display = 'none';
}
}
//-->
//end newsletter products
</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' => array(),
					'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 . "'");
  $newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$nID . "'");
  while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){
	  $news_products[] = $newsletter_products['products_id'];
  }	  

  $newsletter = tep_db_fetch_array($newsletter_query);
  $newsletter['products'] = $news_products;
  //end newsletter products
  $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, 'onchange="showProducts()"'); ?></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
	//get existing templates
	$template_array[] = array('id' => '',
							  'text' => '-Select Template-');
	if ($dir = dir(DIR_WS_TEMPLATES)) {
	  while ($file = $dir->read()) {
		if (!is_dir(DIR_WS_TEMPLATES . $file)) {
		  if (substr($file, strrpos($file, '.')) == '.html') {
			$template_array[] = array('id' => $file,
									  'text' => $file);
		  }
		}
	  }
	  sort($template_array);
	  $dir->close();
	}
	/*$templates_query = tep_db_query("select template from newsletters where template <> '' group by template order by template");

	while($templates = tep_db_fetch_array($templates_query)){
		$template_array[] = array('id' => $templates['template'],
								  'text' => $templates['template']);
	}*/
?>
	  <tr>
		  <td colspan="2">
			  <table border="0" cellpadding="0" cellspacing="0" width="100%" id="products" style="<?php if($nInfo->module == 'newsletter_products'){ echo ''; }else{ echo 'display: none';}?>">
				  <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>
			<?php
				if(sizeof($template_array) > 0){
			?>
				<tr>
					  <td class="main" valign="top"><?php echo TEXT_NEWSLETTER_SELECT_TEMPLATE; ?></td>
					  <td class="main" valign="top"><?php echo tep_draw_pull_down_menu('template_id', $template_array);?></td>
				</tr>
				<tr>
					  <td class="main" valign="top" colspan="2"><b><?php echo TEXT_NEWSLETTER_OR_TEXT; ?></b><br></td>
				</tr>
			<?php
				}
			?>
				<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>
			  </table>
		  </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, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
$newsletter = tep_db_fetch_array($newsletter_query);

$newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$nID . "'");
while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){
   	$news_products[] = $newsletter_products['products_id'];
}	  
$newsletter['products'] = $news_products;

$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
?>
  <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
 } elseif ($action == 'send') {
$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 . "'");
$newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$nID . "'");
while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){
   	$news_products[] = $newsletter_products['products_id'];
}
$newsletter = tep_db_fetch_array($newsletter_query);
$newsletter['products'] = $news_products;
//end newsletter products   

$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_query = tep_db_query("select 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><?php echo $module->confirm(); ?></td>
  </tr>
<?php
 } elseif ($action == 'confirm_send') {
$nID = tep_db_prepare_input($HTTP_GET_VARS['nID']);

//newsletter products
$newsletter_query = tep_db_query("select newsletters_id, title, content, module, template from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int)$nID . "'");
$newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id = '" . (int)$nID . "'");
while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){
   	$news_products[] = $newsletter_products['products_id'];
}
$newsletter = tep_db_fetch_array($newsletter_query);
$newsletter['products'] = $news_products;
//end newsletter products

$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><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'); ?>

Link to comment
Share on other sites

What about admin/includes/modules/newsletters/newsletter_products.php

 

 

Not finding an instance of "in()" here either:

 

<?php
/*
 $Id: newsletter_products.php,v 2.0 2007/05/17 scottyb Exp $

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
 //newsletter products
*/

 class newsletter_products {

function newsletter_products($title, $content, $products, $template) {
  $this->title = $title;
  $this->content = $content;
  $this->products = $products;
  $this->template = $template;
}

function choose_products() {
  global $HTTP_GET_VARS, $languages_id;

  //first let's get the products that have been added to newsletter
  if($HTTP_GET_VARS['nID']){
	  $newsletter_products_query = tep_db_query("select products_id from " . TABLE_NEWSLETTERS_TO_PRODUCTS . " where newsletters_id ='" . $HTTP_GET_VARS['nID'] . "'");
	  $newsletter_products_string = '';
	  while($newsletter_products = tep_db_fetch_array($newsletter_products_query)){
		  $newsletter_products_string .= $newsletter_products['products_id'] . ', ';
	  }
	  $newsletter_products_string = trim($newsletter_products_string, ', ');

  //$newsletter_products_string = tep_db_result($newsletter_products_query, 0, $newsletter_products_query['products']);
	  $current_products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'";
	  if($newsletter_products_string) $current_products_query .= " and pd.products_id in(" . $newsletter_products_string . ")";
	$current_products_query .= " order by pd.products_name";
	$current_products_query = tep_db_query($current_products_query);
  }   

  if($newsletter_products_string){
	  $current_products_array = array();
	  while ($current_products = tep_db_fetch_array($current_products_query)){
		  $current_products_array[] = array('id' => $current_products['products_id'],
											'text' => $current_products['products_name'] . ' - ' . $current_products['products_model']);
	  }
  }

  $products_query = "select pd.products_id, pd.products_name, p.products_model from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . $languages_id . "' and pd.products_id = p.products_id and p.products_status = '1'";
  if($newsletter_products_string) $products_query .= " and pd.products_id not in(" . $newsletter_products_string . ")";
  $products_query .= " order by pd.products_name";

  $products_array = array();
  $products_query = tep_db_query($products_query);

  while ($products = tep_db_fetch_array($products_query)) {
	$products_array[] = array('id' => $products['products_id'],
							  'text' => $products['products_name'] . ' - ' . $products['products_model']);
  }

$choose_products_string = '<script language="javascript"><!--
function mover(move) {
 if (move == \'remove\') {
for (x=0; x<(document.newsletter.products.length); x++) {
  if (document.newsletter.products.options[x].selected) {
	with(document.newsletter.elements[\'chosen[]\']) {
	  options[options.length] = new Option(document.newsletter.products.options[x].text,document.newsletter.products.options[x].value);
	}
	document.newsletter.products.options[x] = null;
	x = -1;
  }
}
 }
 if (move == \'add\') {
for (x=0; x<(document.newsletter.elements[\'chosen[]\'].length); x++) {
  if (document.newsletter.elements[\'chosen[]\'].options[x].selected) {
	with(document.newsletter.products) {
	  options[options.length] = new Option(document.newsletter.elements[\'chosen[]\'].options[x].text,document.newsletter.elements[\'chosen[]\'].options[x].value);
	}
	document.newsletter.elements[\'chosen[]\'].options[x] = null;
	x = -1;
  }
}
 }
 return true;
}

function selectAll(FormName, SelectBox) {
 temp = "document." + FormName + ".elements[\'" + SelectBox + "\']";
 Source = eval(temp);

 for (x=0; x<(Source.length); x++) {
Source.options[x].selected = "true";
 }
}
//--></script>';

  $choose_products_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n" .
							 '  <tr>' . "\n" .
							 '	<td align="center" class="main"><b>' . TEXT_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('products', $products_array, '', 'size="20" style="width: 32em;" multiple') . '</td>' . "\n" .
							 '	<td align="center" class="main"> <br><br><input type="button" value="' . BUTTON_SELECT . '" style="width: 8em;" onClick="mover(\'remove\');"><br><br><input type="button" value="' . BUTTON_UNSELECT . '" style="width: 8em;" onClick="mover(\'add\');"></td>' . "\n" .
							 '	<td align="center" class="main"><b>' . TEXT_SELECTED_PRODUCTS . '</b><br>' . tep_draw_pull_down_menu('chosen[]', $current_products_array, '', 'size="20" style="width: 25em;" multiple') . '</td>' . "\n" .
							 '  </tr>' . "\n" .
							 '</table>';

  return $choose_products_string;
}

function productInfo(){
	global $languages_id;
	$this->productInfo = array();
	$p_string = '';
	for($i=0, $n=sizeof($this->products); $i<$n; $i++){
		$p_string .= $this->products[$i] . ', ';
	}
	$p_string = trim($p_string, ', ');

	$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image2, 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);

	//$this->productsInfo = array();
	while($product = tep_db_fetch_array($product_query)){
		$this->productsInfo[] = array('products_id' => $product['products_id'],
									  'products_name' => $product['products_name'],
									  'products_image' => $product['products_image2'],
									  'products_price' => $product['products_price'],
									  'specials_price' => $product['specials_price'],
									  'products_tax_class_id' => $product['products_tax_class_id']);
	}
}	

function html_content() {	
	global $currencies, $languages_id;		
	//create HTML string containing links & pics

	//define product columns here
	define('COLS', 2);
	$width = intval(100/COLS);
	$html_content = '<table border="0" width="100%" cellpadding="" cellspacing="3"><tr>';

	$col = 0;		
	$this->productInfo();

	//change html body styles here
	$cssPrice = 'color: #000000;';
	$cssSale = 'color: #ff0000;';
	$cssMarkdown = 'color: #000000; text-decoration: line-through';
	$cssLink = 'color: #ff0000; text-decoration: none';

	for($i=0, $n=sizeof($this->productsInfo); $i<$n; $i++){
		if($col > COLS-1){
			$html_content .= '</tr><tr><td align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . '" style="' . $cssLink . '">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name']) . '<br>' . $this->productsInfo[$i]['products_name'] . '</a><br>';
			$price = ($this->productsInfo[$i]['specials_price']) ? '<span style="'. $cssMarkdown . '">' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>  <span style="' . $cssSale . '">' . $currencies->display_price($this->productsInfo[$i]['specials_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>' : '<span style="' . $cssPrice . '">' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>';
			$html_content .= $price . '</td>';
			$col = 0;
		}else{
			$html_content .= '<td align="center" width="' . $width . '%"><a href="' . tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . '" style="' . $cssLink . '">' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $this->productsInfo[$i]['products_image'], $this->productsInfo[$i]['products_name']) . '<br>' . $this->productsInfo[$i]['products_name'] . '</a><br>';
			$price = ($this->productsInfo[$i]['specials_price']) ? '<span style="' . $cssMarkdown . '">' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>  <span style="' . $cssSale . '">' . $currencies->display_price($this->productsInfo[$i]['specials_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>' : '<span style="' . $cssPrice . '">' . $currencies->display_price($this->productsInfo[$i]['products_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . '</span>';
			$html_content .= $price . '</td>';
		}
		$col++;
	}

	//uncomment & create your unsubscribe link in your includes/languages/YOUR LANGUAGE/modules/newsletters/newsletter_products.php
	$html_content .= '</tr><tr><td colspan="' . COLS . '">' . TEXT_UNSUBSCRIBE . '</td></tr></table>';

	if(tep_not_null($this->template)){
		//HTML page from template
		//$content = join('', file(DIR_WS_TEMPLATES . $this->template));
		$content = file_get_contents(DIR_WS_TEMPLATES . $this->template);
		//remove all line breaks and spaces in template to ensure no spaces resulting from email class
		$content = str_replace("\n", '', $content);
		$content = str_replace("\r", '', $content);
		//$content = str_replace('> ', '>', $content);
		$content = addslashes($content);
		$email_title = $this->title;
		$email_message = nl2br($this->content);
		eval ("\$content = \"$content\";");
		$html_content = $content;
	}

	return $html_content;
}

function text_content(){
	global $currencies, $languages_id;

	$text_content = $this->content . "\r\n\r\n";

	//var_dump($this->productsInfo);
	for($i=0, $n=sizeof($this->productsInfo); $i<$n; $i++){
		$text_content .= $this->productsInfo[$i]['products_name'] . ' ';
		$price = ($this->productsInfo[$i]['specials_price']) ? 'Sale Price: ' . $currencies->display_price($this->productsInfo[$i]['specials_price'], tep_get_tax_rate($this->productsInfo[$i]['products_tax_class_id'])) . ' Down from: ' . $currencies->display_price($this->productsInfo[$i]['products_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']));
		$text_content .= $price . "\n";
		$text_content .= tep_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $this->productsInfo[$i]['products_id']) . "\r\r";
	}

	//uncomment & create your unsubscribe link in your includes/languages/YOUR LANGUAGE/modules/newsletters/newsletter_products.php
	$text_content .= "\r\r" . TEXT_UNSUBSCRIBE;

	return $text_content;
}

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);

  $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">' . $this->html_content() . '</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>';

  return $confirm_string;
}

function send($newsletter_id) {
  $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
  //create id for current mailing
  $messageId = "Message-Id: <" . time() . "@" . $_SERVER['SERVER_NAME'] . ">";

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

  //$mimemessage->add_text($this->content);
  //$text = $this->text_content();

  $mimemessage->add_html($this->html_content(), $this->text_content(), HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES);
  $mimemessage->build_message();

  while ($mail = tep_db_fetch_array($mail_query)) {
   $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) . "'");
}
 }
?>

Link to comment
Share on other sites

$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image2, 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);

 

 

This seems to match the problematic query string, particularly

in(" . $p_string . ")

 

Actually now that I look, there appear to be several instances of this in newsletter_products.php

Link to comment
Share on other sites

This is the problem query, I think.

 

$product_query = tep_db_query("select p.products_id, pd.products_name, p.products_image2, 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);

 

The variable $p_string is empty for whatever reason, I don't know why. If there is a support thread for the contribution, you would be better to post there. Other than that, you will have to debug the code to find where it is failing.

 

 

EDIT: I was distracted before hitting submit.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...