gaspower Posted February 22, 2011 Share Posted February 22, 2011 Hello, I am trying to get two emails created when someone makes an account. Original welcome email and the second is one we generate. Below is the code I am trying to use, but for some reason it is not sending the second email. I am using SPPC, so second email is only meant to go to retail customers only. I have set Account Company to both false and true, same issue. Any help would be great. Thanks JR // build the message content $name = $firstname . ' ' . $lastname; if (ACCOUNT_GENDER == 'true') { if ($gender == 'm') { $email_text = sprintf(EMAIL_GREET_MR, $lastname); } else { $email_text = sprintf(EMAIL_GREET_MS, $lastname); } } else { $email_text = sprintf(EMAIL_GREET_NONE, $firstname); } $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING; tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); if (ACCOUNT_COMPANY == 'false' && tep_not_null($company_tax_id)) { $email_text_coupon .= EMAIL_WELCOME . EMAIL_TEXT_COUPON . EMAIL_CONTACT. EMAIL_WARNING; tep_mail($name, $email_address, EMAIL_SUBJECT_COUPON, $email_text_coupon, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } Link to comment Share on other sites More sharing options...
npn2531 Posted February 22, 2011 Share Posted February 22, 2011 You need to define the new variable, $email_text_coupon. But the real problem is that if (ACCOUNT_COMPANY == 'false' && tep_not_null($company_tax_id)) Is a condition that is probably impossible to meet. IE if the company is false, then there is no company tax id. In other words, you are saying I want a company tax id but no company. At least unless my dyslexia has kicked in that's how it reads to me. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gaspower Posted February 22, 2011 Author Share Posted February 22, 2011 Hello, Thank you for the reply. I did define the new $email_text_coupon, and if I remove if (ACCOUNT_COMPANY == 'false' && tep_not_null($company_tax_id)) { I will get two emails on new account setup. I just need to make sure the second email ($email_text_coupon) does not get sent to new accounts that setup as a company. Thanks JR Link to comment Share on other sites More sharing options...
gaspower Posted February 22, 2011 Author Share Posted February 22, 2011 Just a note, Just a few lines after the very firs code is this below, and if a account is created as a company a email is sent to owner of site. So not sure why the above is not working? Thanks JR if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) { $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account."; tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } Link to comment Share on other sites More sharing options...
npn2531 Posted February 22, 2011 Share Posted February 22, 2011 Make it simple. Since you are unlikely to have a tax id if you are not a company, maybe this will work: if (tep_not_null($company_tax_id)){ $email_text_coupon .= EMAIL_WELCOME . EMAIL_TEXT_COUPON . EMAIL_CONTACT. EMAIL_WARNING; tep_mail($name, $email_address, EMAIL_SUBJECT_COUPON, $email_text_coupon, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } PS, just a note, make sure that 'company_tax_id', or however that field is designated in the database, is included in the appropriate query above all this stuff. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gaspower Posted February 22, 2011 Author Share Posted February 22, 2011 Hello, Again, thank you. This may be the issue. I do not see a query, only real mention is a few lines above, $sql_data_array['entry_company_tax_id'] = $company_tax_id; What sort of query should I use? Thanks JR Link to comment Share on other sites More sharing options...
npn2531 Posted February 22, 2011 Share Posted February 22, 2011 I'm not sure where that query is, it could be in includes/application_top.php but it will start ' tep_db_query(select ' More than likely since you have stuff like $sql_data_array['entry_company_tax_id'] = $company_tax_id;, that field is already in the query and you don't need to worry about it. on create_account.php find this: tep_session_register('customer_id'); change it to: tep_session_register('customer_id'); tep_session_register('company_tax_id'); If you are lucky the email will now work, if it doesn't I'm out of ideas. Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gaspower Posted February 22, 2011 Author Share Posted February 22, 2011 We'll we are close. It sends the second email when the tax id in placed. I need it to send when tax id in not placed, and if tax id is placed not to send second email. Thank you for all the help, JR Link to comment Share on other sites More sharing options...
npn2531 Posted February 23, 2011 Share Posted February 23, 2011 It should be 'easy' now. Getting the tax_id field recognized could have gotten complicated if it hadn't already been coded in or if you had to figure out the correct syntax. You just need to figure out the correct logic of the if/else statement at this point. Good luck Oscommerce site: OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120 Link to comment Share on other sites More sharing options...
gaspower Posted February 23, 2011 Author Share Posted February 23, 2011 I thank you very much, JR Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.