Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Newsletters and new subscribers


wendyv

Recommended Posts

I have multiple customers who subscribed to our newsletter. I can find this in my databasetable customers. I have 22 people where whitin the column "customer_newsletter" the value is set to 1, a few others have 0 as value.

When i check table newsletter_subscription is see only 17 subscribers (a few of them are manualy added in by me because of this error).

 

I can i get costumer values = 1 added to de table newsletter subscription?

 

This is my newsletter subscription.php

<?php
/*
  $Id: newsletter_subscription.php 25 May 2015

  Based on http://addons.oscommerce.com/info/8472

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

  Copyright (c) 2012 osCommerce

  Released under the GNU General Public License
*/

   require('includes/application_top.php');
   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWSLETTER_SUBSCRIPTION);

  $email_subscription = tep_db_prepare_input(strtolower(str_replace("'", "", $_POST['emailsubscription'])));

  $inscrits_check_query = tep_db_query("select count(*) as checkinscrits from " . TABLE_NEWSLETTER_SUBSCRIPTION . " where subscription_addresse_email = '" . $email_subscription . "' ");
  $inscrits_check_values = tep_db_fetch_array($inscrits_check_query);

  if ( ($inscrits_check_values['checkinscrits']=='0') && ($email_subscription != '') ) {
    $sql_data_array = array('subscription_addresse_email' => $email_subscription,
                            'subscription_date_creation' => 'now()',
                            'subscription_newsletter' => '1');
    tep_db_perform(TABLE_NEWSLETTER_SUBSCRIPTION, $sql_data_array);
    $insert_id = tep_db_insert_id();

    $email_unsubscribe = str_replace('@', '4r0b6s3', $email_subscription);

    $message = EMAIL_START_HTML;
    $message .= EMAIL_SPAN_START_STYLE;
    $message .= EMAIL_WELCOME . TEXT_PRIVACY_EMAIL . sprintf(NL_UNSUBSCRIBE_LINK, 'emailunsubscribe=' . $email_unsubscribe . '&iID='. $insert_id, 'emailunsubscribe=' . $email_unsubscribe . '&iID='. $insert_id);
    $message .= EMAIL_SPAN_STOP_STYLE;
    $message .= EMAIL_STOP_HTML;
   tep_mail('', $email_subscription, EMAIL_WELCOME_SUBJECT, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// recevoir un mail d'une nouvelle inscription
    if (PREVENIR_EMAIL_NEW_INSCRIT_NL == 'oui') {
     tep_mail('', STORE_OWNER_EMAIL_ADDRESS, EMAIL_NEW_INSCRIT_NL, $email_subscription, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
   }

  tep_redirect(tep_href_link(FILENAME_NEWSLETTER_SUBSCRIPTION_SUCCESS, '', 'NONSSL'));

?>
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...