Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Email Welcome stack error

    Hi,

    I installed ZC 1.3.9 with two languages.

    Everything works well to choose the new language, send emails and subscribe newsletters.

    BUT... In the Admin, when I go to "Tools>Email Welcome"

    a pink stripe appear at the top of the page with the message "header".

    It is a class="messageStackError".

    In the welcome email of THAT language, the email header doesn't appear.

    BUT... if I switch to English to see the email welcome tool, the stripe disappears... the email header appears... and, finally, the Zencart Admin logo also disappears.

    I believe there are 2 problems in the same page, but I don't know how to solve them.

    Any idea?

    Thanks!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Email Welcome stack error

    Simple: Don't use that screen. It's ONLY a preview anyway, and doesn't always work well in a multi-lingual case especially if the language files for the added languages aren't complete (missing defines, missing files, images, etc) or your haven't created the email templates for the additional languages.

    Much better to create new customer accounts so that you send ACTUAL real emails out. That's the true test of ensuring it works correctly anyway. And that's your best workaround.


    ref: http://www.zen-cart.com/wiki/index.p...lish_Languages
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    Hooray, I think I found the answer

    at least to 1 of the 2 problems (as I suspected...)

    http://www.zen-cart.com/forum/showthread.php?t=88305

    No Stack Error anymore, Email Logo visible in every language.



    Only 1 problem left:

    Zencart Admin header is without logo, and

    "Check for Updates to Zen Cart
    (You are presently using: v1.3.9h)"

    is not aligned...

    This only happens in the Email Welcome page, and in both languages...

    If you have a clue, please tell me

  4. #4
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    Why is the header of Admin Email Welcome page getting images from a different place from all other pages?

    Instead of /zencart/images/logo.gif

    it should be /zencart/admin/images/logo.gif


    The same is happening with the "current version" button.


    Possibly, it has something to do with "require language template"

    in admin/email_welcome.php:


    PHP Code:
     if (file_exists(DIR_FS_CATALOG DIR_WS_LANGUAGES $_SESSION['language'] . (($template_dir=='') ? '' '/'.$template_dir) .'/' 'create_account.php')) {

        require(
    DIR_FS_CATALOG DIR_WS_LANGUAGES $_SESSION['language'] . (($template_dir=='') ? '' '/'.$template_dir) . '/' 'create_account.php');

      } else {

        require(
    DIR_FS_CATALOG DIR_WS_LANGUAGES $_SESSION['language'] . '/' 'create_account.php');

      } 

    Anyone knows how to correct this?

    Thanks

  5. #5
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Email Welcome stack error

    I'm not sure what you've changed, or what you've got wrong on your site. I can't replicate the problems you're describing when looking at my fresh clean uncustomized install of v1.3.9h.

    If your DIR_FS_xxxxx or DIR_WS_xxxxx settings have been tampered with then it might start looking in the wrong places.

    However, the email-welcome screen is NOT a true representation of normal use. And the only way it can SOMEWHAT emulate SOME of the store-side operation in order to TRY to show a SAMPLE of what the welcome email MIGHT look like, is to use store-side paths to find the store-side files including languages and images and email templates, etc. If you are tampering with any of the paths then I'm not surprised if it stops working.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    Thanks for your answer.

    Well, I tell you what I did...

    I installed a brand new Zencart just to compare the code.

    Since the only add-on I installed related with E-mail files was Newsletter Subscribe 2.2.2 for ZC 1.3.9, I believe that something in it (I don't know what) is affecting the Welcome Email Page.

    The only differences I see in the code (not present in the original ZC) are related to the CSS styling of the Newsletter. It doesn't have anything to do with the "corrupted" header of Welcome Email Page.

    It doesn't bother me, as long as it doesn't affect anything else.

    So, for now, I give up of finding the cause.

  7. #7
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    I found something else on the spot.


    The following highlighted code just occurs in the "corrupted" header page, but I don't know what it means:


    <td align="right" class="main" valign="top"><a href="/zenc/zcadmin/email_welcome.php? securityToken=XXXXXXXXXXXXXXXXXXXXXXXX&language=en&vcheck=yes"><img src="includes/languages/english/images/buttons/button_check_new_version.gif" border="0" alt="Check for Updates to Zen Cart" title=" Check for Updates to Zen Cart "></a><br />(You are presently using: v1.3.9h)</td>

    The others (with the header OK) don't have that red part.

    What's that? (I omitted it, because I don't know if it is some kind of password...)

  8. #8
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    I realized now that this SecurityToken only appears in the English view, not in the other language.

    So, it is not this what is causing the check version button not to appear in Welcome Email Admin page.

  9. #9
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    After replacing just one file - includes/functions/functions_email.php - Admin Welcome Email header got back to normal.

    To sum up, the functions_email.php that messes the Admin Welcome Email header in two related ways:

    - When adding another language to your cart, Zencart 1.3.9. (and not only the 1.3.8) shows the Stack Error, related to this part of code:

    PHP Code:
    // Identify and Read the template file for the type of message being sent
        
    $langfolder = (strtolower($_SESSION['languages_code']) == 'en') ? '' strtolower($_SESSION['languages_code']) . '/'
    - When adding the Newsletter Subscribe for ZC 1.3.9, the header text shows up in disalighment and the button_check_new_version.gif disappears, because it gets automatically a wrong path: includes/languages/english/images/buttons/button_check_new_version.gif (this folder doesn't exist)

    I paste here the modified code provided by Newsletter mod (the rest goes like the original ZC file):

    PHP Code:
       // eof: body of the email clean-up

          //determine customer's email preference type: HTML or TEXT-ONLY  (HTML assumed if not specified)

    // BEGIN newsletter_subscribe mod 1/2
    // dmcl1 -- changed to look for format in SUBSCRIBERS table instead of CUSTOMERS
          
    if(defined('NEWSONLY_SUBSCRIPTION_ENABLED') && (NEWSONLY_SUBSCRIPTION_ENABLED=='true')) {
            
    $subscriber $db->Execute("SELECT count(*) as count FROM " TABLE_SUBSCRIBERS " WHERE email_address = '" zen_db_input($to_email_address) . "'");
            
    $subscriber $subscriber->fields['count'];
        
            if (
    $subscriber 0) {
              
    $customers_email_format_read $db->Execute("select email_format from " TABLE_SUBSCRIBERS " where email_address= '" zen_db_input($to_email_address) . "'");
              
    $customers_email_format $customers_email_format_read->fields['email_format'];
            } else {
              
    $sql "select customers_email_format from " TABLE_CUSTOMERS " where customers_email_address= :custEmailAddress:";
              
    $sql $db->bindVars($sql':custEmailAddress:'$to_email_address'string');
              
    $result $db->Execute($sql);
              
    $customers_email_format = ($result->RecordCount() > 0) ? $result->fields['customers_email_format'] : '';
            }
          } else {
            
    $sql "select customers_email_format from " TABLE_CUSTOMERS " where customers_email_address= :custEmailAddress:";
            
    $sql $db->bindVars($sql':custEmailAddress:'$to_email_address'string');
            
    $result $db->Execute($sql);
            
    $customers_email_format = ($result->RecordCount() > 0) ? $result->fields['customers_email_format'] : '';
          }
    // END newsletter_subscribe mod 1/2

          
    if ($customers_email_format == 'NONE' || $customers_email_format == 'OUT') return; //if requested no mail, then don't send.
    //      if ($customers_email_format == 'HTML') $customers_email_format = 'HTML'; // if they opted-in to HTML messages, then send HTML format

          // handling admin/"extra"/copy emails:
          
    if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module,-6)=='_extra') {
            
    $email_html='';  // just blank out the html portion if admin has selected text-only
          
    }
          
    //determine what format to send messages in if this is an admin email for newsletters:
          
    if ($customers_email_format == '' && ADMIN_EXTRA_EMAIL_FORMAT == 'HTML' && in_array($module, array('newsletters''product_notification')) && isset($_SESSION['admin_id'])) {
            
    $customers_email_format 'HTML';
          }

          
    // special handling for XML content
          
    if ($module == 'xml_record') {
            
    $email_html '';
            
    $customers_email_format ='TEXT';
          }

          
    //notifier intercept option
          
    $zco_notifier->notify('NOTIFY_EMAIL_AFTER_EMAIL_FORMAT_DETERMINED');

          
    // now lets build the mail object with the phpmailer class
          
    $mail = new PHPMailer();
          
    $lang_code strtolower(($_SESSION['languages_code'] == '' 'en' $_SESSION['languages_code'] ));
          
    $mail->SetLanguage($lang_codeDIR_FS_CATALOG DIR_WS_CLASSES 'support/');
          
    $mail->CharSet =  (defined('CHARSET')) ? CHARSET "iso-8859-1";
          
    $mail->Encoding = (defined('EMAIL_ENCODING_METHOD')) ? EMAIL_ENCODING_METHOD "7bit";
          if ((int)
    EMAIL_SYSTEM_DEBUG $mail->SMTPDebug = (int)EMAIL_SYSTEM_DEBUG;
          
    $mail->WordWrap 76;    // set word wrap to 76 characters
          // set proper line-endings based on switch ... important for windows vs linux hosts:
          
    $mail->LE = (EMAIL_LINEFEED == 'CRLF') ? "\r\n" "\n";

          switch (
    EMAIL_TRANSPORT) {
            case 
    'smtp':
              
    $mail->IsSMTP();
              
    $mail->Host trim(EMAIL_SMTPAUTH_MAIL_SERVER);
              if (
    EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '25' && EMAIL_SMTPAUTH_MAIL_SERVER_PORT != ''$mail->Port trim(EMAIL_SMTPAUTH_MAIL_SERVER_PORT);
              
    $mail->LE "\r\n";
              break;
            case 
    'smtpauth':
              
    $mail->IsSMTP();
              
    $mail->SMTPAuth true;
              
    $mail->Username = (zen_not_null(EMAIL_SMTPAUTH_MAILBOX)) ? trim(EMAIL_SMTPAUTH_MAILBOX) : EMAIL_FROM;
              
    $mail->Password trim(EMAIL_SMTPAUTH_PASSWORD);
              
    $mail->Host trim(EMAIL_SMTPAUTH_MAIL_SERVER);
              if (
    EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '25' && EMAIL_SMTPAUTH_MAIL_SERVER_PORT != ''$mail->Port trim(EMAIL_SMTPAUTH_MAIL_SERVER_PORT);
              
    $mail->LE "\r\n";
              
    //set encryption protocol to allow support for Gmail or other secured email protocols
              
    if (EMAIL_SMTPAUTH_MAIL_SERVER_PORT == '465' || EMAIL_SMTPAUTH_MAIL_SERVER_PORT == '587' || EMAIL_SMTPAUTH_MAIL_SERVER == 'smtp.gmail.com'$mail->Protocol 'ssl';
              if (
    defined('SMTPAUTH_EMAIL_PROTOCOL') && SMTPAUTH_EMAIL_PROTOCOL != 'none') {
                
    $mail->Protocol SMTPAUTH_EMAIL_PROTOCOL;
                if (
    SMTPAUTH_EMAIL_PROTOCOL == 'starttls' && defined('SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT')) {
                  
    $mail->Starttls true;
                  
    $mail->Context SMTPAUTH_EMAIL_CERTIFICATE_CONTEXT;
                }
              }
              break;
            case 
    'PHP':
              
    $mail->IsMail();
              break;
            case 
    'Qmail':
              
    $mail->IsQmail();
              break;
            case 
    'sendmail':
            case 
    'sendmail-f':
              
    $mail->LE "\n";
            default:
              
    $mail->IsSendmail();
              if (
    defined('EMAIL_SENDMAIL_PATH')) $mail->Sendmail trim(EMAIL_SENDMAIL_PATH);
              break;
          }

          
    $mail->Subject  $email_subject;
          
    $mail->From     $from_email_address;
          
    $mail->FromName $from_email_name;
          
    $mail->AddAddress($to_email_address$to_name);
          
    //$mail->AddAddress($to_email_address);    // (alternate format if no name, since name is optional)
          //$mail->AddBCC(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);

          // set the reply-to address.  If none set yet, then use Store's default email name/address.
          // If sending from contact-us or tell-a-friend page, use the supplied info
          
    $email_reply_to_address = (isset($email_reply_to_address) && $email_reply_to_address != '') ? $email_reply_to_address : (in_array($module, array('contact_us',  'tell_a_friend')) ? $from_email_address EMAIL_FROM);
          
    $email_reply_to_name    = (isset($email_reply_to_name) && $email_reply_to_name != '')    ? $email_reply_to_name    : (in_array($module, array('contact_us',  'tell_a_friend')) ? $from_email_name    STORE_NAME);
          
    $mail->AddReplyTo($email_reply_to_address$email_reply_to_name);

          
    // if mailserver requires that all outgoing mail must go "from" an email address matching domain on server, set it to store address
          
    if (EMAIL_SEND_MUST_BE_STORE=='Yes'$mail->From EMAIL_FROM;

          if (
    EMAIL_TRANSPORT=='sendmail-f' || EMAIL_SEND_MUST_BE_STORE=='Yes') {
            
    $mail->Sender EMAIL_FROM;
          }

          if (
    EMAIL_USE_HTML == 'true'$email_html processEmbeddedImages($email_html$mail);

          
    // PROCESS FILE ATTACHMENTS
          
    if ($attachments_list == ''$attachments_list = array();
          if (
    is_string($attachments_list)) {
            if (
    file_exists($attachments_list)) {
              
    $attachments_list = array(array('file' => $attachments_list));
            } elseif (
    file_exists(DIR_FS_CATALOG $attachments_list)) {
              
    $attachments_list = array(array('file' => DIR_FS_CATALOG $attachments_list));
            } else {
              
    $attachments_list = array();
            }
          }
          global 
    $newAttachmentsList;
          
    $zco_notifier->notify('NOTIFY_EMAIL_BEFORE_PROCESS_ATTACHMENTS', array('attachments'=>$attachments_list'module'=>$module));
          if (isset(
    $newAttachmentsList) && is_array($newAttachmentsList)) $attachments_list $newAttachmentsList;
          if (
    defined('EMAIL_ATTACHMENTS_ENABLED') && EMAIL_ATTACHMENTS_ENABLED && is_array($attachments_list) && sizeof($attachments_list) > 0) {
            foreach(
    $attachments_list as $key => $val) {
              
    $fname = (isset($val['name']) ? $val['name'] : null);
              
    $mimeType = (isset($val['mime_type']) && $val['mime_type'] != '' && $val['mime_type'] != 'application/octet-stream') ? $val['mime_type'] : '';
              switch (
    true) {
                case (isset(
    $val['raw_data']) && $val['raw_data'] != ''):
                  
    $fdata $val['raw_data'];
                  if (
    $mimeType != '') {
                    
    $mail->AddStringAttachment($fdata$fname"base64"$mimeType);
                  } else {
                    
    $mail->AddStringAttachment($fdata$fname);
                  }
                  break;
                case (isset(
    $val['file']) && file_exists($val['file'])): //'file' portion must contain the full path to the file to be attached
                  
    $fdata $val['file'];
                  if (
    $mimeType != '') {
                    
    $mail->AddAttachment($fdata$fname"base64"$mimeType);
                  } else {
                    
    $mail->AddAttachment($fdata$fname);
                  }
                  break;
              } 
    // end switch
            
    //end foreach attachments_list
          
    //endif attachments_enabled
          
    $zco_notifier->notify('NOTIFY_EMAIL_AFTER_PROCESS_ATTACHMENTS'sizeof($attachments_list));

          
    // prepare content sections:
          
    if (EMAIL_USE_HTML == 'true' && trim($email_html) != '' &&
          (
    $customers_email_format == 'HTML' || (ADMIN_EXTRA_EMAIL_FORMAT != 'TEXT' && substr($module,-6)=='_extra'))) {
            
    $mail->IsHTML(true);           // set email format to HTML
            
    $mail->Body    $email_html;  // HTML-content of message
            
    $mail->AltBody $text;        // text-only content of message
          
    }  else {                        // use only text portion if not HTML-formatted
            
    $mail->Body    $text;        // text-only content of message
          
    }

    /**
     * Send the email. If an error occurs, trap it and display it in the messageStack
     */
          
    $ErrorInfo '';
          
    $zco_notifier->notify('NOTIFY_EMAIL_READY_TO_SEND');
          if (!(
    $result $mail->Send())) {
            if (
    IS_ADMIN_FLAG === true) {
              
    $messageStack->add_session(sprintf(EMAIL_SEND_FAILED '&nbsp;'$mail->ErrorInfo$to_name$to_email_address$email_subject),'error');
            } else {
              
    $messageStack->add('header',sprintf(EMAIL_SEND_FAILED '&nbsp;'$mail->ErrorInfo$to_name$to_email_address$email_subject),'error');
            }
            
    $ErrorInfo .= $mail->ErrorInfo '<br />';
          }
          
    $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND');

          
    // Archive this message to storage log
          // don't archive pwd-resets and CC numbers
          
    if (EMAIL_ARCHIVE == 'true'  && $module != 'password_forgotten_admin' && $module != 'cc_middle_digs' && $module != 'no_archive') {
            
    zen_mail_archive_write($to_name$to_email_address$from_email_name$from_email_address$email_subject$email_html$text$module$ErrorInfo );
          } 
    // endif archiving
        
    // end foreach loop thru possible multiple email addresses
        
    $zco_notifier->notify('NOTIFY_EMAIL_AFTER_SEND_ALL_SPECIFIED_ADDRESSES');

        if (
    EMAIL_FRIENDLY_ERRORS=='false' && $ErrorInfo != '') die('<br /><br />Email Error: ' $ErrorInfo);

        return 
    $ErrorInfo;
      }  
    // end function

    /**
     * zen_mail_archive_write()
     *
     * this function stores sent emails into a table in the database as a log record of email activity.  This table CAN get VERY big!
     * To disable this function, set the "Email Archives" switch to 'false' in ADMIN!
     *
     * See zen_mail() function description for more details on the meaning of these parameters
     * @param string $to_name
     * @param string $to_email_address
     * @param string $from_email_name
     * @param string $from_email_address
     * @param string $email_subject
     * @param string $email_html
     * @param array $email_text
     * @param string $module
    **/
      
    function zen_mail_archive_write($to_name$to_email_address$from_email_name$from_email_address$email_subject$email_html$email_text$module$error_msgs) {
        global 
    $db;
        
    $to_name zen_db_prepare_input($to_name);
        
    $to_email_address zen_db_prepare_input($to_email_address);
        
    $from_email_name zen_db_prepare_input($from_email_name);
        
    $from_email_address zen_db_prepare_input($from_email_address);
        
    $email_subject zen_db_prepare_input($email_subject);
        
    $email_html = (EMAIL_USE_HTML=='true') ? zen_db_prepare_input($email_html) : zen_db_prepare_input('HTML disabled in admin');
        
    $email_text zen_db_prepare_input($email_text);
        
    $module zen_db_prepare_input($module);
        
    $error_msgs zen_db_prepare_input($error_msgs);

        
    $db->Execute("insert into " TABLE_EMAIL_ARCHIVE "
                      (email_to_name, email_to_address, email_from_name, email_from_address, email_subject, email_html, email_text, date_sent, module)
                      values ('" 
    zen_db_input($to_name) . "',
                              '" 
    zen_db_input($to_email_address) . "',
                              '" 
    zen_db_input($from_email_name) . "',
                              '" 
    zen_db_input($from_email_address) . "',
                              '" 
    zen_db_input($email_subject) . "',
                              '" 
    zen_db_input($email_html) . "',
                              '" 
    zen_db_input($email_text) . "',
                              now() ,
                              '" 
    zen_db_input($module) . "')");
        return 
    $db;
      }

      
    //DEFINE EMAIL-ARCHIVABLE-MODULES LIST // this array will likely be used by the email archive log VIEWER module in future
      
    $emodules_array = array();
      
    $emodules_array[] = array('id' => 'newsletters''text' => 'Newsletters');
      
    $emodules_array[] = array('id' => 'product_notification''text' => 'Product Notifications');
      
    $emodules_array[] = array('id' => 'direct_email''text' => 'One-Time Email');
      
    $emodules_array[] = array('id' => 'contact_us''text' => 'Contact Us');
      
    $emodules_array[] = array('id' => 'coupon''text' => 'Send Coupon');
      
    $emodules_array[] = array('id' => 'coupon_extra''text' => 'Send Coupon');
      
    $emodules_array[] = array('id' => 'gv_queue''text' => 'Send-GV-Queue');
      
    $emodules_array[] = array('id' => 'gv_mail''text' => 'Send-GV');
      
    $emodules_array[] = array('id' => 'gv_mail_extra''text' => 'Send-GV-Extra');
      
    $emodules_array[] = array('id' => 'welcome''text' => 'New Customer Welcome');
      
    $emodules_array[] = array('id' => 'welcome_extra''text' => 'New Customer Welcome-Extra');
      
    $emodules_array[] = array('id' => 'password_forgotten''text' => 'Password Forgotten');
      
    $emodules_array[] = array('id' => 'password_forgotten_admin''text' => 'Password Forgotten');
      
    $emodules_array[] = array('id' => 'checkout''text' => 'Checkout');
      
    $emodules_array[] = array('id' => 'checkout_extra''text' => 'Checkout-Extra');
      
    $emodules_array[] = array('id' => 'order_status''text' => 'Order Status');
      
    $emodules_array[] = array('id' => 'order_status_extra''text' => 'Order Status-Extra');
      
    $emodules_array[] = array('id' => 'low_stock''text' => 'Low Stock Notices');
      
    $emodules_array[] = array('id' => 'cc_middle_digs''text' => 'CC - Middle-Digits');
      
    $emodules_array[] = array('id' => 'tell_a_friend''text' => 'Tell-A-Friend');
      
    $emodules_array[] = array('id' => 'tell_a_friend_extra''text' => 'Tell-A-Friend-Extra');
      
    $emodules_array[] = array('id' => 'purchase_order''text' => 'Purchase Order');
      
    $emodules_array[] = array('id' => 'payment_modules''text' => 'Payment Modules');
      
    $emodules_array[] = array('id' => 'payment_modules_extra''text' => 'Payment Modules-Extra');
      
    /////////////////////////////////////////////////////////////////////////////////////////
      ////////END SECTION FOR EMAIL FUNCTIONS//////////////////////////////////////////////////
      /////////////////////////////////////////////////////////////////////////////////////////


    /**
     * select email template based on 'module' (supplied as param to function)
     * selectively go thru each template tag and substitute appropriate text
     * finally, build full html content as "return" output from class
    **/
      
    function zen_build_html_email_from_template($module='default'$content='') {
        global 
    $messageStack$current_page_base;
        
    $block = array();
        if (
    is_array($content)) {
          
    $block $content;
        } else {
          
    $block['EMAIL_MESSAGE_HTML'] = $content;
        }
        
    // Identify and Read the template file for the type of message being sent
        
    $langfolder = (strtolower($_SESSION['languages_code']) == 'en' or 'pt') ? '' strtolower($_SESSION['languages_code']) . '/';
        
    $template_filename_base DIR_FS_EMAIL_TEMPLATES $langfolder "email_template_";
        
    $template_filename DIR_FS_EMAIL_TEMPLATES $langfolder "email_template_" $current_page_base ".html";

        if (!
    file_exists($template_filename)) {
          if (isset(
    $block['EMAIL_TEMPLATE_FILENAME']) && $block['EMAIL_TEMPLATE_FILENAME'] != '' && file_exists($block['EMAIL_TEMPLATE_FILENAME'] . '.html')) {
            
    $template_filename $block['EMAIL_TEMPLATE_FILENAME'] . '.html';
          } elseif (
    file_exists($template_filename_base str_replace(array('_extra','_admin'),'',$module) . '.html')) {
            
    $template_filename $template_filename_base str_replace(array('_extra','_admin'),'',$module) . '.html';
          } elseif (
    file_exists($template_filename_base 'default' '.html')) {
            
    $template_filename $template_filename_base 'default' '.html';
          } else {
            if(isset(
    $messageStack)) $messageStack->add('header','ERROR: The email template file for (' $template_filename_base ') or (' $template_filename ') cannot be found.','caution');
            return 
    ''// couldn't find template file, so return an empty string for html message.
          
    }
        }

        if (!
    $fh fopen($template_filename'rb')) {   // note: the 'b' is for compatibility with Windows systems
          
    if (isset($messageStack)) $messageStack->add('header','ERROR: The email template file (' $template_filename_base ') or (' $template_filename ') cannot be opened''caution');
        }

        
    $file_holder fread($fhfilesize($template_filename));
        
    fclose($fh);

        
    //strip linebreaks and tabs out of the template
    //  $file_holder = str_replace(array("\r\n", "\n", "\r", "\t"), '', $file_holder);
        
    $file_holder str_replace(array("\t"), ' '$file_holder);


        if (!
    defined('HTTP_CATALOG_SERVER')) define('HTTP_CATALOG_SERVER'HTTP_SERVER);
        
    //check for some specifics that need to be included with all messages
        
    if (!isset($block['EMAIL_STORE_NAME']) || $block['EMAIL_STORE_NAME'] == '')     $block['EMAIL_STORE_NAME']  = STORE_NAME;
        if (!isset(
    $block['EMAIL_STORE_URL']) || $block['EMAIL_STORE_URL'] == '')       $block['EMAIL_STORE_URL']   = '<a href="'.HTTP_CATALOG_SERVER DIR_WS_CATALOG.'">'.STORE_NAME.'</a>';
        if (!isset(
    $block['EMAIL_STORE_OWNER']) || $block['EMAIL_STORE_OWNER'] == '')   $block['EMAIL_STORE_OWNER'] = STORE_OWNER;
        if (!isset(
    $block['EMAIL_FOOTER_COPYRIGHT']) || $block['EMAIL_FOOTER_COPYRIGHT'] == ''$block['EMAIL_FOOTER_COPYRIGHT'] = EMAIL_FOOTER_COPYRIGHT;
        if (!isset(
    $block['EMAIL_DISCLAIMER']) || $block['EMAIL_DISCLAIMER'] == '')     $block['EMAIL_DISCLAIMER']  = sprintf(EMAIL_DISCLAIMER'<a href="mailto:' STORE_OWNER_EMAIL_ADDRESS '">'STORE_OWNER_EMAIL_ADDRESS .' </a>');
        if (!isset(
    $block['EMAIL_SPAM_DISCLAIMER']) || $block['EMAIL_SPAM_DISCLAIMER'] == '')   $block['EMAIL_SPAM_DISCLAIMER']  = EMAIL_SPAM_DISCLAIMER;
        if (!isset(
    $block['EMAIL_DATE_SHORT']) || $block['EMAIL_DATE_SHORT'] == '')     $block['EMAIL_DATE_SHORT']  = zen_date_short(date("Y-m-d"));
        if (!isset(
    $block['EMAIL_DATE_LONG']) || $block['EMAIL_DATE_LONG'] == '')       $block['EMAIL_DATE_LONG']   = zen_date_long(date("Y-m-d"));
        if (!isset(
    $block['BASE_HREF']) || $block['BASE_HREF'] == ''$block['BASE_HREF'] = HTTP_SERVER DIR_WS_CATALOG;
        if (!isset(
    $block['CHARSET']) || $block['CHARSET'] == ''$block['CHARSET'] = CHARSET;
        
    //  if (!isset($block['EMAIL_STYLESHEET']) || $block['EMAIL_STYLESHEET'] == '')      $block['EMAIL_STYLESHEET']       = str_replace(array("\r\n", "\n", "\r"), "",@file_get_contents(DIR_FS_EMAIL_TEMPLATES.'stylesheet.css'));

    // BEGIN newsletter_subscribe mod 2/2
    // Since many templates are Dear So-and-So we need something here when we direct-mail subscribers, as they have no name.
        
    if(defined('NEWSONLY_SUBSCRIPTION_ENABLED') && (NEWSONLY_SUBSCRIPTION_ENABLED=='true'))
          if (empty(
    $block['EMAIL_FIRST_NAME']) && empty($block['EMAIL_LAST_NAME']))
            
    $block['EMAIL_LAST_NAME'] = TEXT_SUBSCRIBER_DEFAULT_NAME;
    // END newsletter_subscribe mod 2/2

        
    if (!isset($block['EXTRA_INFO']))  $block['EXTRA_INFO']  = '';
        if (
    substr($module,-6) != '_extra' && $module != 'contact_us')  $block['EXTRA_INFO']  = ''
    It seems to be some minor modification...

    I really need this Newsletter add-on to work properly.

    So, if you have clue, please tell me.

  10. #10
    Join Date
    Oct 2011
    Posts
    22
    Plugin Contributions
    0

    Default Re: Email Welcome stack error

    I set to "blank" this function

    $langfolder = (strtolower($_SESSION['languages_code']) == ' ') ? '' : strtolower($_SESSION['languages_code']) . '/';

    And I got the button_check_new_version.gif right in both languages, but the StackError again in that page only.

    I can't have both, can I?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Inserting message stack error in confirmation email
    By rjspomer in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 26 Jan 2011, 08:46 PM
  2. Error in welcome email
    By srwebguy in forum Basic Configuration
    Replies: 5
    Last Post: 20 Aug 2010, 06:59 PM
  3. Welcome Email Error
    By Aderra in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 22 Oct 2009, 07:27 PM
  4. "header" Message Stack Error in welcome email tool
    By koolos.com in forum General Questions
    Replies: 0
    Last Post: 8 Jan 2008, 03:24 AM
  5. Email Welcome goes through but creates error
    By frankiepol in forum General Questions
    Replies: 1
    Last Post: 4 Nov 2007, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg