Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with Newsletter Manager


apolyshow

Recommended Posts

Hello to everybody.I am having a problem with Newsletter Manager tool. When i am trying to get it the admin panel always return to his first page i mean index.php like i was inserting that time. The all things started when i was truing to update the Newsletter Manager with a module but i forgot to make a backup. Can you tell me what file should i check to try to fix it?

First of all it sais

 

 

"5)**Conditions apply

 

Add this where you need to show the input box

<script language="javascript">

function validate()

{

var mail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

if(!mail.test(document.index_newsletter.email_address.value))

 

{

alert("Please Enter Your Mail id Properly");

document.index_newsletter.email_address.focus();

return false;

}

 

}

 

</script>

 

<?php echo tep_draw_form('index_newsletter', tep_href_link(FILENAME_INDEX_NEWSLETTER, '', 'SSL'), 'post', 'onsubmit="return validate();"', true) . tep_draw_hidden_field('action', 'process'); ?>

<h1>Stay in touch with <span>Ahalya</span> </h1>

<input name="email_address" type="text" onblur="if (this.value == '') {this.value = 'sign up for emails...';}" onfocus="if (this.value == 'sign up for emails...') {this.value = '';}" value="sign up for emails..." class="SignipInput" />

<input name="" type="submit" />

</form>

</div>

 

What is conditions apply?

Second where do we have to put the code?

 

Thank you very much

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

image1nk.png

 

 

image2sy.png

 

Uploaded with ImageShack.us

 

I have found that the tool newsletter manager in admin panel is not connected with the newsletters.php as all the tools in admin panel having a page that hey redirecting you.

This is what my newsletters.php file having inside:

 

 

<?php

/*

$Id$

adapted for Separate Pricing Per Customer v4 2005/08/28

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

// BOF Separate Pricing Per Customer

$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id");

$cg_array = array();

while ($customers_group = tep_db_fetch_array($customers_group_query)) {

$cg_array[] = array('id' => $customers_group['customers_group_id'], 'customers_group_name' => $customers_group['customers_group_name']);

}

// this is now defined as a global variable since we need it everywhere

global $cg_array;

// EOF Separate Pricing Per Customer

 

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

 

if (tep_not_null($action)) {

switch ($action) {

// BOF Separate Pricing Per Customer

case 'update_cgs':

$customer_groups_chosen = '';

if (isset($_POST['send_to_cgs'])) {

foreach ($_POST['send_to_cgs'] as $key => $value) {

$customer_groups_chosen .= tep_db_prepare_input($value).',';

}

// remove last comma

$customer_groups_chosen = substr($customer_groups_chosen,0,strlen($customer_groups_chosen)-1);

} // end if (isset($HTTP_POST['send_to_cgs']))

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

 

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

 

tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID']));

break;

// EOF Separate Pricing Per Customer

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_error = false;

if (empty($title)) {

$messageStack->add(ERROR_NEWSLETTER_TITLE, 'error');

$newsletter_error = true;

}

 

if (empty($newsletter_module)) {

$messageStack->add(ERROR_NEWSLETTER_MODULE, 'error');

$newsletter_error = true;

}

 

if ($newsletter_error == false) {

$sql_data_array = array('title' => $title,

'content' => $content,

'module' => $newsletter_module);

 

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;

}

}

 

require(DIR_WS_INCLUDES . 'template_top.php');

?>

 

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

 

$parameters = array('title' => '',

'content' => '',

// BOF Separate Pricing Per Customer

'module' => '',

'send_to_customer_groups' => '');

// EOF Separate Pricing Per Customer

 

$nInfo = new objectInfo($parameters);

 

if (isset($HTTP_GET_VARS['nID'])) {

$form_action = 'update';

 

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

 

// BOF Separate Pricing Per Customer

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

// EOF Separate Pricing Per Customer

$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 echo tep_draw_form('newsletter', FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'action=' . $form_action); if ($form_action == 'update') echo tep_draw_hidden_field('newsletter_id', $nID); ?>

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

</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="smallText" align="right"><?php echo tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', 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'] : ''))); ?></td>

</tr>

</table></td>

</form></tr>

<?php

} elseif ($action == 'preview') {

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

 

// BOF Separate Pricing Per Customer

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

// EOF Separate Pricing Per Customer

$newsletter = tep_db_fetch_array($newsletter_query);

 

$nInfo = new objectInfo($newsletter);

?>

<tr>

<td class="smallText" align="right"><?php echo tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])); ?></td>

</tr>

<tr>

<td><tt><?php echo nl2br($nInfo->content); ?></tt></td>

</tr>

<tr>

<td class="smallText" align="right"><?php echo tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])); ?></td>

</tr>

<?php

} elseif ($action == 'send') {

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

 

// BOF Separate Pricing Per Customer

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

// EOF Separate Pricing Per Customer

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

// BOF Separate Pricing Per Customer

$module = new $module_name($nInfo->title, $nInfo->content, $nInfo->send_to_customer_groups);

// EOF Separate Pricing Per Customer

?>

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

 

// BOF Separate Pricing Per Customer

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

// EOF Separate Pricing Per Customer

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

// BOF Separate Pricing Per Customer

$module = new $module_name($nInfo->title, $nInfo->content, $nInfo->send_to_customer_groups);

// EOF Separate Pricing Per Customer

?>

<tr>

<td><?php echo $module->confirm(); ?></td>

</tr>

<?php

} elseif ($action == 'confirm_send') {

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

 

// BOF Separate Pricing Per Customer

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

// EOF Separate Pricing Per Customer

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

// BOF Separate Pricing Per Customer

$module = new $module_name($nInfo->title, $nInfo->content, $nInfo->send_to_customer_groups);

// EOF Separate Pricing Per Customer

?>

<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"><strong><?php echo TEXT_PLEASE_WAIT; ?></strong></td>

</tr>

</table></td>

</tr>

<?php

tep_set_time_limit(0);

flush();

// BOF Separate Pricing Per Customer

$module->send($nInfo->newsletters_id, $nInfo->send_to_customer_groups);

// EOF Separate Pricing Per Customer

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><font color="#ff0000"><strong><?php echo TEXT_FINISHED_SENDING_EMAILS; ?></strong></font></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="smallText"><?php echo tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])); ?></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

// BOF Separate Pricing Per Customer

$newsletters_query_raw = "select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked, send_to_customer_groups from " . TABLE_NEWSLETTERS . " order by date_added desc";

// EOF Separate Pricing Per Customer

$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 class="smallText" align="right" colspan="2"><?php echo tep_draw_button(IMAGE_NEW_NEWSLETTER, 'plus', tep_href_link(FILENAME_NEWSLETTERS, 'action=new')); ?></td>

</tr>

</table></td>

</tr>

</table></td>

<?php

$heading = array();

$contents = array();

 

switch ($action) {

case 'delete':

$heading[] = array('text' => '<strong>' . $nInfo->title . '</strong>');

 

$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 /><strong>' . $nInfo->title . '</strong>');

$contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])));

break;

default:

if (isset($nInfo) && is_object($nInfo)) {

$heading[] = array('text' => '<strong>' . $nInfo->title . '</strong>');

// BOF Separate Pricing Per Customer

if (tep_not_null($cg_array)) {

$cg_array_in_db = explode(',', $nInfo->send_to_customer_groups);

$table_with_check_boxes_cgs = "

<table border='0' cellspacing='0' cellpadding='2' style='border: 1px solid #c9c9c9; margin-top='10px;'>

<tr class='dataTableHeadingRow'>

<td class='dataTableHeadingContent'>" . TABLE_HEADING_CUSTOMERS_GROUPS . "</td>

<td class='dataTableHeadingContent'> </td>

</tr>";

$c = '0'; // variable used for background coloring of rows

for ($z = 0; $z < sizeof($cg_array); $z++) {

$bgcolor = ($c++ & 1) ? " class='dataTableRow'" : "";

$table_with_check_boxes_cgs .= "

<tr" . $bgcolor . ">

<td class='dataTableContent'>" . $cg_array[$z]['customers_group_name'] . " </td>

<td class='dataTableContent' align='right'>" . tep_draw_checkbox_field('send_to_cgs[' . $z . ']', $cg_array[$z]['id'] , (in_array ($cg_array[$z]['id'], $cg_array_in_db)) ? 1 : 0) . "</td>

</tr>

";

} // end for ($z = 0; $z < sizeof($cg_array); $z++)

$table_with_check_boxes_cgs .= " </table>";

}

// EOF Separate Pricing Per Customer

 

if ($nInfo->locked > 0) {

$contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=new')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=delete')) . tep_draw_button(IMAGE_PREVIEW, 'document', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=preview')) . tep_draw_button(IMAGE_SEND, 'mail-closed', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=send')) . tep_draw_button(IMAGE_UNLOCK, 'unlocked', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=unlock')));

} else {

$contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_PREVIEW, 'document', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=preview')) . tep_draw_button(IMAGE_LOCK, 'locked', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $nInfo->newsletters_id . '&action=lock')));

}

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

// BOF Separate Pricing Per Customer

$contents[] = array('text' => TEXT_SEND_TO_CUSTOMERS_GROUPS . '<div align="center" style="margin-bottom: 10px;">'. tep_draw_form('select_customer_groups', FILENAME_NEWSLETTERS, tep_get_all_get_params() . 'action=update_cgs', 'post') . $table_with_check_boxes_cgs . '<br clear="all">'. tep_image_submit('button_update.gif', IMAGE_UPDATE) . '</form></div>');

// EOF Separate Pricing Per Customer

}

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>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

Please help... I believe that maybe the error is somewhere in line 400 and below where is :

 

// BOF Separate Pricing Per Customer

if (tep_not_null($cg_array)) {

$cg_array_in_db = explode(',', $nInfo->send_to_customer_groups);

$table_with_check_boxes_cgs = "

<table border='0' cellspacing='0' cellpadding='2' style='border: 1px solid #c9c9c9; margin-top='10px;'>

 

Maybe is something from there and below.... Or something in my database...

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

The conditions just for security reasons

 

And just put this where you want to show sign up for news letter in front end

 

<script language="javascript">

function validate()

{

var mail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

if(!mail.test(document.index_newsletter.email_address.value))

 

{

alert("Please Enter Your Mail id Properly");

document.index_newsletter.email_address.focus();

return false;

}

 

}

 

</script>

 

<?php echo tep_draw_form('index_newsletter', tep_href_link(FILENAME_INDEX_NEWSLETTER, '', 'SSL'), 'post', 'onsubmit="return validate();"', true) . tep_draw_hidden_field('action', 'process'); ?>

<h1>Stay in touch with <span>Ahalya</span> </h1>

<input name="email_address" type="text" onblur="if (this.value == '') {this.value = 'sign up for emails...';}" onfocus="if (this.value == 'sign up for emails...') {this.value = '';}" value="sign up for emails..." class="SignipInput" />

<input name="" type="submit" />

</form>

</div>

 

And there's no issues on data base because i have done by separate table only call "newsletter_subscriber"

 

make sure you have put boxnewsletter.php file into catalog folder

santhosh

Link to comment
Share on other sites

I am sorry i had a problem with my provider and i couldn't be in internet. I think that you haven't understand. iroll back my web store from a backup . i made also the same with the database but i am not sure if the database backup is before i install your module sql or after i install it. Now the newsletter manager doesn't work at all. The news letter manager doesn't drive you anywhere. So do you believe that maybe it is because i have forgot to reinstall the files or because my database has been damaged? I don't understand the " And just put this where you want to show sign up for news letter in front end " and secondly the " 5. **Conditions apply ". What is this?

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Ok i understand the conditions aply but it made a mess in my condition page and i remove it.

But i believe that is not possible to install this module cause i am having the SPPC module and as you can see i will work to his lines something that i don't know if it is going to be ok for this module and if it will continue to work. Look my newsletter.page inside admin/include/module

 

<?php

/*

$Id$

adapted for Separate Pricing Per Customer v4.2 2007/02/10

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class newsletter {

var $show_choose_audience, $title, $content;

 

function newsletter($title, $content, $send_to_customer_groups) {

$this->show_choose_audience = false;

$this->title = $title;

$this->content = $content;

// BOF Separate Pricing Per Customer

$this->send_to_customer_groups = $send_to_customer_groups;

// EOF Separate Pricing Per Customer

}

 

function choose_audience() {

return false;

}

 

function confirm() {

global $HTTP_GET_VARS;

 

// BOF Separate Pricing Per Customer

if (tep_not_null($this->send_to_customer_groups)) {

$mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1' and customers_group_id in (" . $this->send_to_customer_groups . ")");

} else {

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

}

// EOF Separate Pricing Per Customer

$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"><strong>' . sprintf(TEXT_COUNT_CUSTOMERS, $mail['count']) . '</strong></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"><strong>' . $this->title . '</strong></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 class="smallText" align="right">' . tep_draw_button(IMAGE_SEND, 'mail-closed', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'] . '&action=confirm_send'), 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'] . '&nID=' . $HTTP_GET_VARS['nID'])) . '</td>' . "\n" .

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

'</table>';

 

return $confirm_string;

}

 

// BOF Separate Pricing Per Customer

function send($newsletter_id, $send_to_customer_groups) {

if (tep_not_null($send_to_customer_groups)) {

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

} else {

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

}

// EOF Separate Pricing Per Customer

 

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

 

// Build the text version

$text = strip_tags($this->content);

if (EMAIL_USE_HTML == 'true') {

$mimemessage->add_html($this->content, $text);

} else {

$mimemessage->add_text($text);

}

 

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

}

}

?>

 

So the problem contains. Does any one knows why the link behind Newsletter Manager inadmin is broken? And how can i fix it?

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Well i have find something usefull. When i had install this module http://addons.oscommerce.com/info/8074 , i had the big problem. Maybe i did something wrong. So i figure out what steps i had done and i had gone to admin/inludes/boxes/tools.php and find the wrong code.

So now i have find the way to link the newsletters Manager with newsletters.php but something is missing from my database and when i am choosing the newsletters manager in admin panel everything is ok except that i am seein in the panel of newsletters the message below

 

Newsletter Manager

 

 

 

 

 

Newsletters

 

Size

 

Module

 

Sent

 

Status

 

Action

 

 

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

 

select newsletters_id, title, length(content) as content_length, module, date_added, date_sent, status, locked, send_to_customer_groups from newsletters order by date_added desc limit 0, 20

 

[TEP STOP]

 

 

Any idea to fix this part of database? Everything else are working ok .

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Ok i will continue to ask to my self. Does anyone who knows from databases can help?

 

Ok i think that i have fix it.I just put a line in the database with the name "send_to_customer_groups" and the problem dissapeared but if someone knows just tell if it is right or wrong...

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...