Zen Cart Logo
Forums / General Questions / welcome email / store name / not sending confusion

welcome email / store name / not sending confusion

Locked

Views: 1,732

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
28 Apr 2008, 10:53 AM
#1
talisman_studios avatar

talisman_studios

New Zenner

Join Date:
Jul 2007
Posts:
42
Plugin Contributions:
0

welcome email / store name / not sending confusion

Hello,

I want to get emails when a new customer signs up to my store. So I turned it on, set the email address and started getting some emails. Great right? Except when I check in on the admin interface I noticed some new customers I hadn't received emails about. Email archiving is on so I took a look to see what was going on and here is the deal. The 'email_from_name' is sometimes:

Talisman Studios (corresponding to the admin value for store owner)

and other times:

talisman-studios.com (corresponding to the admin value for store name)

The customer gets emailed in both cases, but I only get a copy of the emails in the case of the talisman-studios.com instances. Why some have one value and some the other I don't know, Can anyone tell me? Any pointers on where I should be looking and what I should be looking for?

I'm tempted to just set store owner to the same value as store name to see if that cures the problem but that seems like taking the cowards way out.

28 Apr 2008, 9:02 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: welcome email / store name / not sending confusion

How did those customers sign up?
What version of Zen Cart?
What addons are installed?

29 Apr 2008, 9:00 AM
#3
talisman_studios avatar

talisman_studios

New Zenner

Join Date:
Jul 2007
Posts:
42
Plugin Contributions:
0

Re: welcome email / store name / not sending confusion

Can't say for sure how they signed up, whether they created an account in the normal fashion or whether it was an automatically created by virtue of paying with paypal account. I suspect that is the heart of the issue but don't know how to prove it. I've got one person who paid with paypalwpp that I did get the email for and one who I didn't.

The zen cart is up to date 1.3.8a

I've got super sales report and another simple sales reporting module installed but that is it for community add ons, nothing too frilly. For installed core modules the zen cart free charge card, paypal websites payment pro and paypal express checkout. And now I find out there are several shipping modules installed - flat rate, per item, free and store pick up but all of products for now are pdfs so only the free shipping gets used. All of the order total modules apart from COD Fee. But that should just be default options as I don't think I've had cause to look at that stuff before. Again nothing exotic there.

New detail I just noticed. The profile information for the customers I did get sign up emails for seem to be more complete. Particularly as they have a gender assigned. The customers I didn't get emails for have neither radio button for gender selected in their profile lending weight to the idea they didn't create their account through the shop interface - the mr/ms choice which seems a fair basis for assigning gender to me is a required when creating an account in the shop.

Any other information I can furnish you with?

And thank you.

29 Apr 2008, 9:11 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: welcome email / store name / not sending confusion

The lack of gender selection even though required, indicates that it was most likely generated by the PayPal Express Checkout process.

29 Apr 2008, 9:43 AM
#5
talisman_studios avatar

talisman_studios

New Zenner

Join Date:
Jul 2007
Posts:
42
Plugin Contributions:
0

Re: welcome email / store name / not sending confusion

So the problem is likely somewhere in the paypal express checkout module? Great..... touchwood it is something fairly easy to spot. Its a start point at least. Cheers.

29 Apr 2008, 12:18 PM
#6
talisman_studios avatar

talisman_studios

New Zenner

Join Date:
Jul 2007
Posts:
42
Plugin Contributions:
0

Re: welcome email / store name / not sending confusion

alright, I think I've found the source of the issue. In:

includes/modules/payment/paypallwpp.php

In the method ec_step2_finish there is section for handling creating accounts for new users that don't have one. The bit I'm looking at is:

        // send Welcome Email if appropriate
        if ($this->new_acct_notify == 'Yes') {
          // require the language file
          global $language_page_directory, $template_dir;
          if (!isset($language_page_directory)) $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
          if (file_exists($language_page_directory . $template_dir . '/create_account.php')) {
            $template_dir_select = $template_dir . '/';
          } else {
            $template_dir_select = '';
          }
          require($language_page_directory . $template_dir_select . '/create_account.php');

          // set the mail text
          $email_text = sprintf(EMAIL_GREET_NONE, $paypal_ec_payer_info['payer_firstname']) . EMAIL_WELCOME . EMAIL_TEXT;
          $email_text .= "\n\n" . EMAIL_EC_ACCOUNT_INFORMATION . "\nUsername: " . $paypal_ec_payer_info['payer_email'] . "\nPassword: " . $password . "\n\n";
          $email_text .= EMAIL_CONTACT;

          // send the mail
          zen_mail($paypal_ec_payer_info['payer_firstname'] . " " . $paypal_ec_payer_info['payer_lastname'], $paypal_ec_payer_info['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML'=>nl2br($email_text)), 'welcome');

          // set the express checkout temp -- false means the account is no longer "only" for EC ... it'll be permanent
          $_SESSION['paypal_ec_temp'] = false;
        } else {
          // Make it a temporary account that'll be deleted once they've checked out
          $sql = "UPDATE " . TABLE_CUSTOMERS . "
                  SET customers_paypal_ec = 1
                  WHERE customers_id = :custID ";
          $sql = $db->bindVars($sql, ':custID', $customer_id, 'integer');
          $db->Execute($sql);

          // set the boolean ec temp value since we created account strictly for EC purposes
          $_SESSION['paypal_ec_temp'] = true;
        }

Which does send the welcome email to the customer but doesn't even check to see if it should send one to the shop. I checked it against :

<shop>/includes/modules/create_account.php

for reference. So What I figure I need to do is insert a section like this one from create_account.php into the paypal code:

    // send welcome email
    zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');

    // send additional emails
    if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
      if ($_SESSION['customer_id']) {
        $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
                            from " . TABLE_CUSTOMERS . "
                            where customers_id = '" . (int)$_SESSION['customer_id'] . "'";

        $account = $db->Execute($account_query);
      }

      $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
      $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
      zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
      $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
    } //endif send extra emails

But that is a fair chunk of code going into the middle of code that affects how paypal works or doesn't work on my live site so I'd really I'd really appreciate someone with actual real php and zen cart skills to lay that out for me. It is something I'd rather not bodge and fumble my way through.

And if I am on track with that can/should a moderator pop a link to this in the paypal support section? And how would I go about requesting the fix be added to the source?

Cheerio for now,

Alan

30 Apr 2008, 8:42 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: welcome email / store name / not sending confusion

talisman-studios:

      // send the mail
      zen_mail($paypal_ec_payer_info['payer_firstname'] . " " . $paypal_ec_payer_info['payer_lastname'], $paypal_ec_payer_info['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML'=>nl2br($email_text)), 'welcome');

If you feel strongly that it's important for you to also receive those account-creation notices, just duplicate that zen_mail line again on the line below it, by adding the following:
  // send addtional email
  zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML'=>nl2br($email_text)), 'welcome_extra');
30 Apr 2008, 10:29 AM
#8
talisman_studios avatar

talisman_studios

New Zenner

Join Date:
Jul 2007
Posts:
42
Plugin Contributions:
0

Re: welcome email / store name / not sending confusion

Well that looks good. Thank you once again DrByte.

And yes I do want notices about account creations, or at the very least when I switch on being emailed about account creations I would like to hear about all of them, not just those done manually - not much use to me otherwise and I can't fathom how that would be useful to anyone :dontgetit.