Knowledgebase: Admin
Newsletter showing same number of customer for all groups
Posted by Matt Hayes on 03 February 2014 10:31 PM

Version: Loaded 6.5.xx

1. Reported Issue:

News letter shows same count for number of customer to whom the news letter will be sent, even after selecting other customer groups or all customer.

The issue is with this condition,

//case 1 : Only drop down
if($_POST["customers_email_address"] != "")
{
    if($_POST["customers_email_address"] == "**D") // News letter subscribers
    {
        $str_mail_query = "select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'";
    }
    else if($_POST["customers_email_address"] == "***") // All Customers
    {
        $str_mail_query = "select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS;
    }
}

The above code by default enters in loop else if($_POST["customers_email_address"] == "***") // All Customers , as when we select the drop down box their is no auto POST event, the event occurs only when we hit the send button to send the new letter.

 

Resolution:

/admin/newsletters.php

CODE:

    $frm_chk = 'onchange="showCount(this.value)"';

added the above code on line number 297.

CODE:

              <td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, (isset($_GET['customer']) ? $_GET['customer'] : '')?></td>

REPLACE WITH:

              <td><?php echo tep_draw_pull_down_menu('customers_email_address', $customers, (isset($_GET['customer']) ? $_GET['customer'] : ''), $frm_chk);?></td>
  

/admin/includes/modules/newsletter/newsletter.php

CODE:

              '    <td class="main"><font color="#ff0000"><b>' . sprintf(TEXT_COUNT_CUSTOMERS, $inum_rows) . '</b></font></td>' . "\n" .

REPLACE WITH:

              '    <td class="main"><font color="#ff0000"><b><div id="newscnt"></div></b></font></td>' . "\n" .

/admin/includes/general.js

CODE:

/* news letter */
function showCount(str){
var xmlhttp;
  if (str==""){
    document.getElementById("newscnt").innerHTML="";
    return;
  }
  if (window.XMLHttpRequest){ /* code for IE7+, Firefox, Chrome, Opera, Safari */
    xmlhttp=new XMLHttpRequest();
  }else{/* code for IE6, IE5 */
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
    xmlhttp.onreadystatechange=function(){
    if (xmlhttp.readyState==4 && xmlhttp.status==200){
      document.getElementById("newscnt").innerHTML=xmlhttp.responseText;
    }
   }
   xmlhttp.open("GET","getcount.php?customers_email_address="+str,true);
   xmlhttp.send();
 }


Attached updated files.



Attachments 
 
 catalog.zip (9.75 KB)
(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako Fusion