I tried to add new mail type and made the following hack in the store module but I keep getting the error message "Mail template for ec_mail_notify_customer could not be found!". I also tried to uninstall and reinstall the store module but nothing changed.

One problem that I see is in variable table ec_mail_notify_customer is not listed while the other once
defined by ecommerce module are.

Why is the new mail type ( variable ) not in the variable database table. What is the source of the problem for the error message "Mail template for ec_mail_notify_customer could not be found!"

added in store.install

  ec_mail_reset_to_defaults(array(ECMAIL_TYPE_CUSTOMER_INVOICE,    
     ECMAIL_TYPE_PROCESSING_ERROR, ECMAIL_TYPE_CANCEL_TXN,   
     ECMAIL_TYPE_ASK_CUSTOMER,ECMAIL_TYPE_NOTIFY_CUSTOMER), 'store');

added in store.module

  define('ECMAIL_TYPE_NOTIFY_CUSTOMER','notify customer');
  define('MAILVAR_NOTIFY_CUSTOMER', 'ec_mail_notify_customer');

function store_mail_types() {
  return array( ECMAIL_TYPE_CUSTOMER_INVOICE => t('Customer invoice'),
    ECMAIL_TYPE_PROCESSING_ERROR => t('Processing error notification'),
    ECMAIL_TYPE_CANCEL_TXN => t('Transaction cancelled notice'),
    ECMAIL_TYPE_ASK_CUSTOMER => t('Query to customer'),
    ECMAIL_TYPE_NOTIFY_CUSTOMER => t('Notify customer'),
  );
}
function store_ec_settings() {
 
  $form['email_notification']['notify_customer'] =   
    ec_mail_selection_form_for_variable('store_settings_form', ECMAIL_TYPE_NOTIFY_CUSTOMER, 
    t('Notify customer'), MAILVAR_NOTIFY_CUSTOMER, t('This text is used as a template for sending 
    email to sender to notify order status update.'));

}

function store_token_values($type, $object = NULL) {
  if (in_array($type, array(STORE_TOKEN_TYPE, ECMAIL_TYPE_CUSTOMER_INVOICE, 
  ECMAIL_TYPE_PROCESSING_ERROR, ECMAIL_TYPE_CANCEL_TXN, ECMAIL_TYPE_ASK_CUSTOMER, 
  ECMAIL_TYPE_NOTIFY_CUSTOMER))) {
   
}

function store_mail_reset($type) {
  
  switch ($type) {
    case ECMAIL_TYPE_NOTIFY_CUSTOMER:
      $defsub = t('Notification of your order status from %site');
      $defbody = t("Dear %billing_name,\n\n We have status update of your order from 
      %site.\n\nRegards,\n%site team\n%uri");
      $mid = ec_mail_import_old_mail('Customer status update', $type, 
      'store_email_notify_customer_template_subject', $defsub, 
      'store_notify_sender_receiver_contacted_template_body', $defbody);
      $var = MAILVAR_NOTIFY_CUSTOMER;  
      break;
}

Comments

wisdom’s picture

Status: Active » Fixed

Seems it works now after I saved the email template in admin/store.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

queenielow’s picture

Hi Wisdom,

Well i'm having the same situation with you, but the problem is when i go to admin/store, the view is adding a new transaction.
I've been wasting most of my time trying to find out where I've missed.

I've got this message "Mail template for ec_mail_delivered_notify could not be found!" which ec_mail_delivered_notify is the template i'm trying to create. Anyone know where and how is this ec_mail_delivered_notify created? i'm totally lost.

Thanks
Queenie