$html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT);
            $html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE);
            // include create-account-specific disclaimer
            $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
            $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
            // send welcome email
            if (trim(EMAIL_SUBJECT) != 'n/a') {
                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\n                            from " . TABLE_CUSTOMERS . "\n                            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'];
                if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') {
                    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
        }
        zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
    }
    //endif !error
}
/*
 * Set flags for template use:
 */
$selected_country = isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '' ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
Exemplo n.º 2
0
        }
        $email_body .= sprintf(EMAIL_TEXT_LINK, zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']), '', false) . "\n\n" . sprintf(EMAIL_TEXT_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");
        $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
        $html_msg['EMAIL_PRODUCT_LINK'] = sprintf(str_replace('\\n\\n', '<br />', EMAIL_TEXT_LINK), '<a href="' . zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']) . '">' . $product_info->fields['products_name'] . '</a>', '', false);
        $html_msg['EMAIL_TEXT_SIGNATURE'] = sprintf(str_replace('\\n', '', EMAIL_TEXT_SIGNATURE), '');
        // include disclaimer
        $email_body .= "\n\n" . EMAIL_ADVISORY . "\n\n";
        //send the email
        zen_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address, $html_msg, 'tell_a_friend');
        // send additional emails
        if (SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO_STATUS == '1' and SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO != '') {
            if ($_SESSION['customer_id']) {
                $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n                          FROM " . TABLE_CUSTOMERS . "\n                          WHERE customers_id = :customersID";
                $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
                $account = $db->Execute($account_query);
            }
            $extra_info = email_collect_extra_info($from_name, $from_email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address']);
            $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
            zen_mail('', SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO, SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO_SUBJECT . ' ' . $email_subject, $email_body . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'tell_a_friend_extra');
        }
        $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info->fields['products_name'], zen_output_string_protected($to_name)), 'success');
        zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']));
    }
} elseif ($_SESSION['customer_id']) {
    $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n                    FROM " . TABLE_CUSTOMERS . "\n                    WHERE customers_id = :customersID";
    $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $account = $db->Execute($account_query);
    $from_name = $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'];
    $from_email_address = $account->fields['customers_email_address'];
}
$breadcrumb->add(NAVBAR_TITLE);
Exemplo n.º 3
0
         $customer_name = NOT_LOGGED_IN_TEXT;
     }
     // use contact us dropdown if defined
     if (CONTACT_US_LIST != '') {
         $send_to_array = explode(",", CONTACT_US_LIST);
         preg_match('/\\<[^>]+\\>/', $send_to_array[$_POST['send_to']], $send_email_array);
         $send_to_email = eregi_replace(">", "", $send_email_array[0]);
         $send_to_email = eregi_replace("<", "", $send_to_email);
         $send_to_name = preg_replace('/\\<[^*]*/', '', $send_to_array[$_POST['send_to']]);
     } else {
         //otherwise default to EMAIL_FROM and store name
         $send_to_email = EMAIL_FROM;
         $send_to_name = STORE_NAME;
     }
     // Prepare extra-info details
     $extra_info = email_collect_extra_info($name, $email_address, $customer_name, $customer_email);
     // Prepare Text-only portion of message
     $text_message = OFFICE_FROM . "\t" . $name . "\n" . OFFICE_EMAIL . "\t" . $email_address . "\n\n" . '------------------------------------------------------' . "\n\n" . strip_tags($_POST['enquiry']) . "\n\n" . '------------------------------------------------------' . "\n\n" . $extra_info['TEXT'];
     // Prepare HTML-portion of message
     $html_msg['EMAIL_MESSAGE_HTML'] = strip_tags($_POST['enquiry']);
     $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $email_address . ')';
     $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
     // Send message
     zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg, 'contact_us');
     zen_redirect(zen_href_link(FILENAME_CONTACT_US, 'action=success'));
 } else {
     $error = true;
     if (empty($name)) {
         $messageStack->add('contact', ENTRY_EMAIL_NAME_CHECK_ERROR);
     }
     if ($zc_validate_email == false) {
        $name = TEXT_EASY_SIGNUP_CUSTOMER_NAME;
        //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_query = "select  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']);*/
            $extra_info = email_collect_extra_info($name, $email_address, ' ', $email_address, '', '');
            $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
        //user
        if (function_exists('addRewardPointersForRecommender')) {
            addRewardPointersForRecommender();
        }
        //end user
        zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
    }
    //endif !error
}
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_MODULE_END_EASY_CREATE_ACCOUNT');
Exemplo n.º 5
0
        }
        $sql = "insert into " . TABLE_REVIEWS . "\r\n                              (products_id, customers_id, customers_name, reviews_rating, date_added, status)\r\n                     values ('" . (int) $_GET['products_id'] . "', '" . (int) $_SESSION['customer_id'] . "', '" . zen_db_input($customer->fields['customers_firstname']) . ' ' . zen_db_input($customer->fields['customers_lastname']) . "', '" . zen_db_input($rating) . "', now(), " . zen_db_input($review_status) . ")";
        $rs = $db->Execute($sql);
        $insert_id = $db->Insert_ID();
        $sql = "insert into " . TABLE_REVIEWS_DESCRIPTION . "\r\n                          (reviews_id, languages_id, reviews_text)\r\n                     values ('" . (int) $insert_id . "', '" . (int) $_SESSION['languages_id'] . "', '" . zen_db_input($review_text) . "')";
        $db->Execute($sql);
        // send review-notification email to admin
        if (REVIEWS_APPROVAL == '1' && SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO_STATUS == '1' and defined('SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO') and SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO != '') {
            $email_text = sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name']) . "\n\n";
            $email_text .= sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text) . "\n\n";
            $email_subject = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']);
            $html_msg['EMAIL_SUBJECT'] = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']);
            $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name']));
            $html_msg['EMAIL_MESSAGE_HTML'] .= '<br />';
            $html_msg['EMAIL_MESSAGE_HTML'] .= str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text));
            $extra_info = email_collect_extra_info($name, $email_address, $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], $customer->fields['customers_email_address']);
            $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
            zen_mail('', SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO, $email_subject, $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'reviews_extra');
        }
        // end send email
        zen_redirect(zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params(array('action'))));
    }
}
$products_price = zen_get_products_display_price($product_info->fields['products_id']);
$products_name = $product_info->fields['products_name'];
if ($product_info->fields['products_model'] != '') {
    $products_model = '<br /><span class="smallText">[' . $product_info->fields['products_model'] . ']</span>';
} else {
    $products_model = '';
}
// set image
Exemplo n.º 6
0
 function module_visitor_to_account($return = array())
 {
     global $db, $messageStack, $zco_notifier;
     $return = $this->zoneOptions($return);
     $process = false;
     /**
      * Process form contents
      */
     if (isset($_POST['action']) && $_POST['action'] == 'process') {
         $process = true;
         $return['error'] = false;
         $return['error_messages'] = array();
         $return = $this->prosessPrivacyConditions($return);
         $return = $this->processGender($return);
         $return = $this->processNames($return);
         $return = $this->processNick($return);
         $return = $this->processDOB($return);
         $return = $this->processEmailAddress($return);
         $return = $this->processAddress($return);
         $return = $this->processEmailFormat($return);
         $return = $this->processCustomersAuthorization($return);
         $return = $this->processCustomersReferral($return);
         $return = $this->processNewsletter($return);
         $return = $this->processPassword($return);
         if (count($return['error_messages']) > 0) {
             foreach ($return['error_messages'] as $error_message) {
                 $messageStack->add('create_account', $error_message['message'], $error_message['type']);
             }
         }
         if ($return['error'] == true) {
             // hook notifier class
             $zco_notifier->notify('NOTIFY_FAILURE_DURING_VISITOR_TO_ACCOUNT');
         } else {
             extract($return);
             $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_nick' => $nick, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => (int) $newsletter, 'customers_email_format' => $email_format, 'customers_password' => zen_encrypt_password($password), 'customers_authorization' => (int) CUSTOMERS_APPROVAL_AUTHORIZATION);
             // ->furikana
             if (FURIKANA_NESESSARY) {
                 $sql_data_array['customers_firstname_kana'] = $firstname_kana;
                 $sql_data_array['customers_lastname_kana'] = $lastname_kana;
             }
             // <-furikana
             if (CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '') {
                 $sql_data_array['customers_referral'] = $customers_referral;
             }
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['customers_gender'] = $gender;
             }
             //      if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = zen_date_raw($dob);
             if (ACCOUNT_DOB == 'true') {
                 $sql_data_array['customers_dob'] = empty($_POST['dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_date_raw($_POST['dob']);
             }
             zen_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $_SESSION['customer_id'] . "'");
             // delete a visitor
             $db->Execute("delete from " . TABLE_VISITORS . "\r\n                        where visitors_id = '" . (int) $_SESSION['visitors_id'] . "'");
             unset($_SESSION['visitors_id']);
             $sql_data_array = array('entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_telephone' => $telephone, 'entry_fax' => $fax, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country);
             // ->furikana
             if (FURIKANA_NESESSARY) {
                 $sql_data_array['entry_firstname_kana'] = $firstname_kana;
                 $sql_data_array['entry_lastname_kana'] = $lastname_kana;
             }
             // <-furikana
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['entry_gender'] = $gender;
             }
             if (ACCOUNT_COMPANY == 'true') {
                 $sql_data_array['entry_company'] = $company;
             }
             if (ACCOUNT_SUBURB == 'true') {
                 $sql_data_array['entry_suburb'] = $suburb;
             }
             if (ACCOUNT_STATE == 'true') {
                 if ($zone_id > 0) {
                     $sql_data_array['entry_zone_id'] = $zone_id;
                     $sql_data_array['entry_state'] = '';
                 } else {
                     $sql_data_array['entry_zone_id'] = '0';
                     $sql_data_array['entry_state'] = $state;
                 }
             }
             zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int) $_SESSION['customer_id'] . "' and address_book_id = '" . (int) $_SESSION['customer_default_address_id'] . "'");
             $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "\r\n                  SET    customers_info_date_account_last_modified = now()\r\n                  WHERE  customers_info_id = :customersID";
             $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
             // phpBB create account
             if ($phpBB->phpBB['installed'] == true) {
                 $phpBB->phpbb_create_account($nick, $password, $email_address);
             }
             // End phppBB create account
             $_SESSION['customer_first_name'] = $firstname;
             $_SESSION['customer_last_name'] = $lastname;
             // ->furikana
             if (FURIKANA_NESESSARY) {
                 $_SESSION['customer_first_name_kana'] = $firstname_kana;
                 $_SESSION['customer_last_name_kana'] = $lastname_kana;
             }
             // <-furikana
             $_SESSION['customer_country_id'] = $country;
             $_SESSION['customer_zone_id'] = $zone_id;
             // restore cart contents
             $_SESSION['cart']->restore_contents();
             // hook notifier class
             $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_VISITOR_TO_ACCOUNT');
             // build the message content
             $name = $firstname . ' ' . $lastname;
             if (ACCOUNT_GENDER == 'true') {
                 if ($gender == 'm') {
                     $email_text = sprintf(EMAIL_GREET_MR, $name);
                 } else {
                     $email_text = sprintf(EMAIL_GREET_MS, $name);
                 }
             } else {
                 $email_text = sprintf(EMAIL_GREET_NONE, $name);
             }
             $html_msg['EMAIL_GREETING'] = str_replace('\\n', '', $email_text);
             $html_msg['EMAIL_FIRST_NAME'] = $firstname;
             $html_msg['EMAIL_LAST_NAME'] = $lastname;
             // initial welcome
             $email_text .= EMAIL_WELCOME;
             $html_msg['EMAIL_WELCOME'] = str_replace('\\n', '', EMAIL_WELCOME);
             if (NEW_SIGNUP_DISCOUNT_COUPON != '' and NEW_SIGNUP_DISCOUNT_COUPON != '0') {
                 $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
                 $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
                 $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
                 $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                 // if on, add in Discount Coupon explanation
                 //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
                 $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER . (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
                 $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER;
                 $html_msg['COUPON_DESCRIPTION'] = !empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '';
                 $html_msg['COUPON_TEXT_TO_REDEEM'] = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
                 $html_msg['COUPON_CODE'] = $coupon->fields['coupon_code'];
             }
             //endif coupon
             if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
                 $coupon_code = zen_create_coupon_code();
                 $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
                 $insert_id = $db->Insert_ID();
                 $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                 // if on, add in GV explanation
                 $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . sprintf(EMAIL_GV_REDEEM, $coupon_code) . EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" . EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
                 $html_msg['GV_WORTH'] = str_replace('\\n', '', sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)));
                 $html_msg['GV_REDEEM'] = str_replace('\\n', '', str_replace('\\n\\n', '<br />', sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
                 $html_msg['GV_CODE_NUM'] = $coupon_code;
                 $html_msg['GV_CODE_URL'] = str_replace('\\n', '', EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
                 $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
             }
             // endif voucher
             // add in regular email welcome text
             $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
             $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT);
             $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT);
             $html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE);
             // include create-account-specific disclaimer
             $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
             $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
             // 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\r\n                                from " . TABLE_CUSTOMERS . "\r\n                                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']);
                 $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
             $_SESSION['navigation']->clear_snapshot();
             zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
         }
         //endif !error
     } else {
         $return = $this->getFormDefault($return);
     }
     return $return;
 }
Exemplo n.º 7
0
    $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
}
// add in regular email welcome text
$email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
$html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT);
$html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT);
$html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE);
// include create-account-specific disclaimer
$email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
$html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
$html_msg['EMAIL_TO_NAME'] = $name;
$html_msg['EMAIL_TO_ADDRESS'] = $email_address;
$html_msg['EMAIL_SUBJECT'] = $EMAIL_SUBJECT;
$html_msg['EMAIL_FROM_NAME'] = $STORE_NAME;
$html_msg['EMAIL_FROM_ADDRESS'] = $EMAIL_FROM;
$extra_info = email_collect_extra_info(STORE_NAME, EMAIL_FROM, $name, $email_address);
$html_msg['EXTRA_INFO'] = $extra_info['HTML'];
$email_html = zen_build_html_email_from_template('welcome_extra', $html_msg);
//   zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
Exemplo n.º 8
0
 function send_order_email($zf_insert_id, $zf_mode)
 {
     global $currencies, $db, $order_totals, $zco_notifier;
     //      print_r($this);
     //      die();
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     // COWOA Conditional
     if ($_SESSION['COWOA']) {
         $invoiceInfo = "";
         $htmlInvoiceURL = "";
         $htmlInvoiceValue = "";
     } else {
         $invoiceInfo = EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
         $htmlInvoiceURL = EMAIL_TEXT_INVOICE_URL_CLICK;
         $htmlInvoiceValue = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     }
     //intro area
     //added by john 2010-05-04 afterbuy
     $afterbuy_id = '';
     $afterbuy_id_chk = false;
     $email_module_template = 'checkout';
     $afterbuy_id_db = $db->Execute('select afterbuy_id,afterbuy_success,payment_module_code  from ' . TABLE_ORDERS . ' where orders_id=' . (int) $zf_insert_id);
     if ($afterbuy_id_db->RecordCount() == 1) {
         if ($afterbuy_id_db->fields['afterbuy_success'] == 1) {
             $afterbuy_id_chk = true;
             $afterbuy_id = $afterbuy_id_db->fields['afterbuy_id'];
             $html_msg['AFTERBUY_ID'] = $afterbuy_id;
             $html_msg['EMAIL_TEXT_AFTERBUY_ID_TIP1'] = EMAIL_TEXT_AFTERBUY_ID_TIP1;
         } else {
             $html_msg['AFTERBUY_ID'] = '';
             $html_msg['EMAIL_TEXT_AFTERBUY_ID_TIP1'] = '';
         }
     }
     //end
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . ($afterbuy_id_chk == true ? EMAIL_TEXT_AFTERBUY_ID_TIP1 . $afterbuy_id . "\n" : '') . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $html_msg['INTRO_URL_TEXT'] = $htmlInvoiceURL;
     $html_msg['INTRO_URL_VALUE'] = $htmlInvoiceValue;
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td> </tr>' . "\n" . '<tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td> </tr>' . "\n" . '<tr>';
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
     //addresses area: Delivery
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $cc_num_display = isset($this->info['cc_number']) && $this->info['cc_number'] != '' ? substr($this->info['cc_number'], 0, 4) . str_repeat('X', strlen($this->info['cc_number']) - 8) . substr($this->info['cc_number'], -4) . "\n\n" : '';
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         $email_order .= isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
         $email_order .= $GLOBALS[$payment_class]->email_footer ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '' ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     $zco_notifier->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, $email_module_template, $this->attachArray);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
             $pmt_details = 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id . "\n\n";
             $email_order = $pmt_details . $email_order;
             $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
         }
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, $email_module_template, $this->attachArray);
     }
     $zco_notifier->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL');
 }
Exemplo n.º 9
0
        $gv_email .= EMAIL_GV_LINK . ' ' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1, 'NONSSL');
        $gv_email .= "\n\n";
        $gv_email .= EMAIL_GV_FIXED_FOOTER . "\n\n";
        $gv_email .= EMAIL_GV_SHOP_FOOTER;
        $gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, $_POST['send_name']);
        // include disclaimer
        $gv_email .= "\n\n" . EMAIL_ADVISORY . "\n\n";
        $html_msg['EMAIL_GV_FIXED_FOOTER'] = str_replace(array("\r\n", "\n", "\r", "-----"), '', EMAIL_GV_FIXED_FOOTER);
        $html_msg['EMAIL_GV_SHOP_FOOTER'] = EMAIL_GV_SHOP_FOOTER;
        // send the email
        zen_mail('', $_POST['email'], $gv_email_subject, nl2br($gv_email), STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send');
        // send additional emails
        if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') {
            if ($_SESSION['customer_id']) {
                $account_query = "select customers_firstname, customers_lastname, customers_email_address\r\n                            from " . TABLE_CUSTOMERS . "\r\n                            where customers_id = '" . (int) $_SESSION['customer_id'] . "'";
                $account = $db->Execute($account_query);
            }
            $extra_info = email_collect_extra_info($_POST['to_name'], $_POST['email'], $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address']);
            $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
            zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_SUBJECT . ' ' . $gv_email_subject, $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra');
        }
        // do a fresh calculation after sending an email
        $gv_query = "select amount\r\n                   from " . TABLE_COUPON_GV_CUSTOMER . "\r\n                   where customer_id = '" . $_SESSION['customer_id'] . "'";
        $gv_result = $db->Execute($gv_query);
    }
}
$gv_current_balance = $gv_result->fields['amount'];
if ($_GET['action'] == 'complete') {
    zen_redirect(zen_href_link(FILENAME_GV_SEND, 'action=doneprocess'));
}
$breadcrumb->add(NAVBAR_TITLE);
Exemplo n.º 10
0
        $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
        $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
        // send welcome email
        zen_mail($name, $faqs_contact_mail, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'faqssubmit');
        // send additional emails
        if (SEND_FAQ_SUBMIT_EMAILS_TO_EMAILS_TO != '') {
            if ($_SESSION['customer_id']) {
                $account_query = "select customers_firstname, customers_lastname, customers_email_address\n                            from " . TABLE_CUSTOMERS . "\n                            where customers_id = '" . (int) $_SESSION['customer_id'] . "'";
                $account = $db->Execute($account_query);
                $customers_sname = $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'];
                $customers_email_address = $account->fields['customers_email_address'];
            } else {
                $customers_sname = 'Not logged in';
                $customers_email_address = 'Not logged in';
            }
            $extra_info = email_collect_extra_info($name, $faqs_contact_mail, $customers_sname, $customers_email_address);
            $html_msg['EMAIL_MESSAGE_HTML'] = $faqs_name . '<br />' . $faqs_description . '<br />';
            $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $faqs_contact_mail . ')';
            $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
            zen_mail('', SEND_FAQ_SUBMIT_EMAILS_TO_EMAILS_TO, SEND_EXTRA_SUBMIT_FAQ_TO_SUBJECT . ' ' . EMAIL_SUBJECT, $email_text . $extra_info['HTML'], STORE_NAME, EMAIL_FROM, $html_msg, 'contact_us');
        }
        $messageStack->add_session('submit_success', EMAIL_TEXT_APPROVED, 'success');
        zen_redirect(zen_href_link(FILENAME_FAQS_SUBMIT, '', 'SSL'));
    }
}
// faqs breadcrumb
if ($_SESSION['customer_id']) {
    $check_customer = $db->Execute("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'");
    $email = $check_customer->fields['customers_email_address'];
    $name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
}
 function checkout_process($notifier)
 {
     global $currencies, $order_totals, $order;
     global $messageStack;
     global $request_type;
     // send lowstock email to admin
     if ($order->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         return true;
     }
     // prepare data
     $customer = $order->customer;
     $GLOBALS['phpmailer']['comments'] = $order->info['comments'];
     $GLOBALS['phpmailer']['content_type'] = $order->content_type;
     $oID = $_SESSION['order_number_created'];
     // get template id
     if ($_SESSION['customer_id'] > 0 && !isset($_SESSION['visitors_id'])) {
         // members
         $email_template_id = MODULE_EMAIL_TEMPLATE_CHECKOUT_SUCCESS_MAIL_ID;
     } else {
         //visitors
         $email_template_id = MODULE_EMAIL_TEMPLATE_CHECKOUT_SUCCESS_VISITOR_MAIL_ID;
     }
     switch ($notifier) {
         case 'NOTIFY_BEFORE_CREATE_HEADER':
             if (!empty($email_template_id) && is_numeric($email_template_id)) {
                 // template本文取得
                 $id = $email_template_id;
                 $order_id = null;
                 $language_id = $_SESSION['language_id'];
                 $subject = get_email_template_contents($id, $order_id, $language_id, 'subject');
                 if ($subject === false) {
                     // template取得できなければ何もしない
                     return false;
                 }
                 if (strpos($GLOBALS['phpmailer']['Subject'], SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT) !== false) {
                     // admin 宛のメールはsubjectにprefixを付ける
                     $GLOBALS['phpmailer']['Subject'] = SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . zen_db_prepare_input($subject) . EMAIL_ORDER_NUMBER_SUBJECT . $oID;
                 } else {
                     $GLOBALS['phpmailer']['Subject'] = zen_db_prepare_input($subject) . EMAIL_ORDER_NUMBER_SUBJECT . $oID;
                 }
             } else {
                 // idが無効なら何もしない
                 return false;
             }
             break;
         case 'NOTIFY_BEFORE_CREATE_BODY':
             if (!empty($email_template_id) && is_numeric($email_template_id)) {
                 // template本文取得
                 $id = $email_template_id;
                 $order_id = null;
                 $language_id = $_SESSION['language_id'];
                 $contents = get_email_template_contents($id, $order_id, $language_id, 'contents');
                 if ($contents === false) {
                     // template取得できなければ何もしない
                     return false;
                 }
                 // GLOBALSにテンプレートをセット
                 $GLOBALS['phpmailer']['Body'] = zen_db_prepare_input($contents);
                 if (!empty($GLOBALS['phpmailer']['AltBody'])) {
                     $GLOBALS['phpmailer']['AltBody'] = zen_db_prepare_input($contents);
                 }
                 // 置換開始
                 $GLOBALS['phpmailer']['Body'] = replace_order_email($oID, $GLOBALS['phpmailer']['Body'], $id);
                 $GLOBALS['phpmailer']['Body'] = $this->_cleanup_email($GLOBALS['phpmailer']['Body']);
                 if (!empty($GLOBALS['phpmailer']['AltBody'])) {
                     $GLOBALS['phpmailer']['AltBody'] = replace_order_email($oID, $GLOBALS['phpmailer']['AltBody'], $id);
                     $GLOBALS['phpmailer']['AltBody'] = $this->_cleanup_email($GLOBALS['phpmailer']['AltBody']);
                 }
                 // admin 宛には追加情報を付加
                 if (strpos($GLOBALS['phpmailer']['Subject'], SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT) !== false) {
                     $extra_info = email_collect_extra_info('', '', $customer['firstname'] . ' ' . $customer['lastname'], $customer['email_address'], $customer['telephone']);
                     $GLOBALS['phpmailer']['Body'] .= strip_tags($extra_info['TEXT']);
                     if (!empty($GLOBALS['phpmailer']['AltBody'])) {
                         $GLOBALS['phpmailer']['AltBody'] .= strip_tags($extra_info['TEXT']);
                     }
                 }
             } else {
                 // idが無効なら何もしない
                 return false;
             }
             break;
     }
 }
Exemplo n.º 12
0
 function customerSendCoupon($pFromUser, $pRecipient, $pAmount)
 {
     global $gBitDb, $gBitSmarty, $gCommerceSystem, $currencies;
     $ret = NULL;
     $gBitDb->StartTrans();
     $code = CommerceVoucher::generateCouponCode();
     $gvBalance = CommerceVoucher::getGiftAmount(FALSE);
     $newBalance = $gvBalance - $pAmount;
     if ($new_amount < 0) {
         $error = ERROR_ENTRY_AMOUNT_CHECK;
     } else {
         $gv_query = "UPDATE " . TABLE_COUPON_GV_CUSTOMER . "\n\t\t\t\t\t\t SET `amount` = ?\n\t\t\t\t\t\t WHERE `customer_id` = ?";
         $gBitDb->query($gv_query, array($newBalance, $pFromUser->mUserId));
         $gv_query = "INSERT INTO " . TABLE_COUPONS . " (`coupon_type`, `coupon_code`, `date_created`, `coupon_amount`) values ('G', ?, NOW(), ?)";
         $gv = $gBitDb->query($gv_query, array($code, $pAmount));
         $gvId = zen_db_insert_id(TABLE_COUPONS, 'coupon_id');
         $gv_query = "insert into " . TABLE_COUPON_EMAIL_TRACK . "\t(`coupon_id`, `customer_id_sent`, `emailed_to`, `date_sent`)\n\t\t\t\t\t\tvalues ( ?, ?, ?, now())";
         $gBitDb->query($gv_query, array($gvId, $pFromUser->mUserId, $pRecipient['email']));
         $ret = $code;
         $gv_email_subject = tra('A gift from') . ' ' . $pFromUser->getDisplayName() . ' ' . tra('to') . ' ' . $gCommerceSystem->getConfig('STORE_NAME');
         $gBitSmarty->assign('gvCode', $code);
         $gBitSmarty->assign('gvSender', $pFromUser->getDisplayName());
         $gBitSmarty->assign('gvAmount', $currencies->format($pAmount, false));
         $gBitSmarty->assign('gvRedeemUrl', BITCOMMERCE_PKG_URI . 'index.php?main_page=gv_redeem&gv_no=' . $code);
         if (!empty($pRecipient['message'])) {
             $gBitSmarty->assign('gvMessage', $pRecipient['message']);
         }
         $textMessage = $gBitSmarty->fetch('bitpackage:bitcommerce/gv_send_email_text.tpl');
         $htmlMessage = $gBitSmarty->fetch('bitpackage:bitcommerce/gv_send_email_html.tpl');
         // send the email
         zen_mail('', $pRecipient['email'], $gv_email_subject, $textMessage, STORE_NAME, EMAIL_FROM, $htmlMessage, 'gv_send');
         // send additional emails
         if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') {
             zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, $gv_email_subject, $textMessage, STORE_NAME, EMAIL_FROM, $htmlMessage, 'gv_send');
             if ($_SESSION['customer_id']) {
                 $account_query = "select `customers_firstname`, `customers_lastname`, `customers_email_address`\n\t\t\t\t\t\t\t\t\t\tfrom " . TABLE_CUSTOMERS . "\n\t\t\t\t\t\t\t\t\t\twhere `customers_id` = '" . (int) $_SESSION['customer_id'] . "'";
                 $account = $gBitDb->Execute($account_query);
             }
             $extra_info = email_collect_extra_info($pRecipient['to_name'], $pRecipient['email'], $pFromUser->getDisplayName(), $pFromUser->getField('email'));
             $html_msg['EXTRA_INFO'] = $gCommerceSystem->getConfig('TEXT_GV_NAME') . ' Code: ' . $code . '<br/>' . $extra_info['HTML'];
             zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, tra('[GV CUSTOMER SENT]') . ' ' . $gv_email_subject, $gCommerceSystem->getConfig('TEXT_GV_NAME') . ' Code: ' . $code . "\n" . $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra');
         }
     }
     $gBitDb->CompleteTrans();
     return $ret;
 }
 public static function send_gift_certificate_email()
 {
     global $db, $error, $messageStack, $mail, $gv_current_balance, $gv_amount;
     require_once 'includes/classes/http_client.php';
     require 'includes/languages/english/gv_send.php';
     // verify no timeout has occurred on the send or process
     if (!$_SESSION['customer_id']) {
         zen_redirect(zen_href_link(FILENAME_TIME_OUT));
     }
     // if the customer is not logged on, redirect them to the login page (for
     // cowoa customers, just a check the session is good)
     if (!$_SESSION['customer_id']) {
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     }
     require DIR_WS_MODULES . zen_get_module_directory('require_languages.php');
     // extract sender's name+email from database, since logged-in customer is the one who is sending this GV email
     $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n                      FROM " . TABLE_CUSTOMERS . "\n                      WHERE customers_id = :customersID";
     $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $account = $db->Execute($account_query);
     $send_firstname = $account->fields['customers_firstname'];
     $send_name = $send_firstname . ' ' . $account->fields['customers_lastname'];
     $send_email_address = $account->fields['customers_email_address'];
     $gv_query = "SELECT amount\n                FROM " . TABLE_COUPON_GV_CUSTOMER . "\n                WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_result = $db->Execute($gv_query);
     $gv_amount = $gv_result->fields['amount'];
     if ($currencies->value($gv_amount, true, DEFAULT_CURRENCY) > $gv_amount || $gv_amount == 0) {
         $error = true;
         $messageStack->add('gv_send', ERROR_ENTRY_AMOUNT_CHECK, 'error');
     }
     $id1 = zen_create_coupon_code($mail['customers_email_address']);
     $new_amount = 0;
     $new_db_amount = 0;
     $gv_query = "UPDATE " . TABLE_COUPON_GV_CUSTOMER . "\n    SET amount = '" . $new_amount . "'\n    WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $db->Execute($gv_query);
     $gv_query = "INSERT INTO " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount)\n    VALUES ('G', :couponCode, NOW(), :amount)";
     $gv_query = $db->bindVars($gv_query, ':couponCode', $id1, 'string');
     $gv_query = $db->bindVars($gv_query, ':amount', $currencies->value($gv_amount, true, DEFAULT_CURRENCY), 'currency');
     $gv = $db->Execute($gv_query);
     $insert_id = $db->Insert_ID();
     $gv_query = "INSERT INTO " . TABLE_COUPON_EMAIL_TRACK . "\n           (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent)\n    VALUES (:insertID, :customersID, :firstname, :lastname, :email, now())";
     $gv_query = $db->bindVars($gv_query, ':insertID', $insert_id, 'integer');
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_query = $db->bindVars($gv_query, ':firstname', $send_firstname, 'string');
     $gv_query = $db->bindVars($gv_query, ':lastname', $account->fields['customers_lastname'], 'string');
     $gv_query = $db->bindVars($gv_query, ':email', $account->fields['customers_email_address'], 'string');
     $db->Execute($gv_query);
     // build email content:
     $gv_email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_AUTO_AMOUNT, $currencies->format($gv_amount, false)) . "\n" . EMAIL_SEPARATOR . "\n\n";
     $gv_email .= sprintf(EMAIL_GV_AUTO_CODE, '<strong>' . $id1 . '</strong>');
     $gv_email .= "\n\n";
     $gv_email .= EMAIL_GV_SHOP_FOOTER;
     $gv_email_subject = EMAIL_GV_AUTO_SUBJECT;
     $html_msg['EMAIL_GV_SHOP_FOOTER'] = EMAIL_GV_SHOP_FOOTER;
     // send the email
     zen_mail($send_name, $send_email_address, $gv_email_subject, nl2br($gv_email), STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send');
     // send additional emails
     if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info(ENTRY_NAME . $_POST['to_name'], ENTRY_EMAIL . $_POST['email'], $send_name, $account->fields['customers_email_address']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_SUBJECT . ' ' . $gv_email_subject, $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra');
     }
     // do a fresh calculation after sending an email
     $gv_query = "SELECT amount\n      FROM " . TABLE_COUPON_GV_CUSTOMER . "\n      WHERE customer_id = :customersID";
     $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $gv_result = $db->Execute($gv_query);
     $gv_current_balance = $currencies->format($gv_result->fields['amount']);
     // validate entries
     $gv_amount = (double) $gv_amount;
 }
Exemplo n.º 14
0
 function send_order_email($pOrdersId, $pEmailRecipient = NULL, $pFormat = NULL)
 {
     global $currencies, $order_totals, $gBitCustomer;
     $language_page_directory = DIR_WS_LANGUAGES . $gBitCustomer->getLanguage() . '/';
     require_once BITCOMMERCE_PKG_PATH . $language_page_directory . 'checkout_process.php';
     require_once BITCOMMERCE_PKG_PATH . './includes/functions/functions_customers.php';
     if (empty($pEmailRecipient)) {
         $pEmailRecipient = $this->customer['email_address'];
     }
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock', '', $pFormat);
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $emailVars = array();
     $emailVars['order'] = $this;
     //intro area
     if (!empty($this->customer['firstname'])) {
         $customerName = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
     } else {
         $customerName = BitUser::getDisplayNameFromHash(FALSE, $this->customer);
     }
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $customerName . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $pOrdersId . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $pOrdersId, 'SSL', false) . "\n\n";
     $emailVars['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $emailVars['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $emailVars['INTRO_STORE_NAME'] = STORE_NAME;
     $emailVars['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $emailVars['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $emailVars['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $emailVars['INTRO_ORDER_NUMBER'] = $pOrdersId;
     $emailVars['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $emailVars['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $emailVars['INTRO_URL_TEXT'] = EMAIL_TEXT_INVOICE_URL_CLICK;
     $emailVars['INTRO_URL_VALUE'] = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $pOrdersId, 'SSL', false);
     //comments area
     if (!empty($this->info['comments'])) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $emailVars['ORDER_COMMENTS'] = zen_db_output($this->info['comments']);
     } else {
         $emailVars['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n";
     foreach (array_keys($this->contents) as $productsKey) {
         $email_order .= $this->contents[$productsKey]['products_quantity'] . ' x ' . $this->contents[$productsKey]['name'] . ($this->contents[$productsKey]['model'] != '' ? ' (' . $this->contents[$productsKey]['model'] . ') ' : '') . ' = ' . $currencies->display_price($this->contents[$productsKey]['final_price'], $this->contents[$productsKey]['tax'], $this->contents[$productsKey]['products_quantity'], $this->getField('currency'), $this->getField('currency_value')) . ($this->contents[$productsKey]['onetime_charges'] != 0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->contents[$productsKey]['onetime_charges'], $this->contents[$productsKey]['tax'], 1) : '');
         foreach (array_keys($this->contents[$productsKey]['attributes']) as $j) {
             $optionValues = zen_get_option_value((int) $this->contents[$productsKey]['attributes'][$j]['options_id'], (int) $this->contents[$productsKey]['attributes'][$j]['options_values_id']);
             $email_order .= "\n    + " . $optionValues['products_options_name'] . ' ' . zen_decode_specialchars($this->contents[$productsKey]['attributes'][$j]['value']);
         }
         $email_order .= "\n\n";
     }
     $email_order .= EMAIL_SEPARATOR . "\n";
     $emailVars['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     if (!empty($this->products_ordered_html)) {
         $emailVars['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     }
     //order totals area
     $html_ot = '<td class="order-totals-text alignright" width="100%">' . '&nbsp;' . '</td><td class="order-totals-num alignright" nowrap="nowrap">' . '---------' . '</td></tr><tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td></tr><tr>';
     }
     $emailVars['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . $html_ot . '</table>';
     //addresses area: Delivery
     $emailVars['HEADING_ADDRESS_INFORMATION'] = tra('Address Information');
     $emailVars['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $emailVars['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($this->customer['user_id'], $this->delivery, true, '', "<br />") : 'n/a';
     $emailVars['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $emailVars['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_format($this->delivery['format_id'], $this->delivery, FALSE, '', "\n") . "\n\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_format($this->billing['format_id'], $this->billing, FALSE, '', "\n") . "\n\n";
     $emailVars['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $emailVars['ADDRESS_BILLING_DETAIL'] = zen_address_label($this->customer['user_id'], $this->billing, true, '', "<br />");
     $emailVars['PAYMENT_METHOD_TITLE'] = $emailVars['PAYMENT_METHOD_DETAIL'] = $emailVars['PAYMENT_METHOD_FOOTER'] = '';
     if (!empty($_SESSION['payment']) && is_object($GLOBALS[$_SESSION['payment']])) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         if (!empty($GLOBALS[$payment_class]->email_footer)) {
             $email_order .= $GLOBALS[$payment_class]->email_footer . "\n\n";
         }
         $emailVars['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
         $emailVars['PAYMENT_METHOD_DETAIL'] = $GLOBALS[$payment_class]->title;
         $emailVars['PAYMENT_METHOD_FOOTER'] = !empty($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer : '';
     }
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $emailVars['EMAIL_FIRST_NAME'] = $this->getFirstName();
     //		$emailVars['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //	$emailVars['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $emailVars['EXTRA_INFO'] = '';
     zen_mail($customerName, $pEmailRecipient, EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $pOrdersId, $email_order, STORE_NAME, EMAIL_FROM, $emailVars, 'checkout', '', $pFormat);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $customerName, $this->customer['email_address'], $this->customer['telephone']);
         $emailVars['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, tra('[NEW ORDER]') . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $pOrdersId, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $emailVars, 'checkout_extra', '', $pFormat);
     }
 }
 function send_order_email($zf_insert_id, $zf_mode)
 {
     global $currencies, $order_totals;
     //      print_r($this);
     //      die();
     if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') {
         // send an email
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     //intro area
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . EMAIL_GREET . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n" . ($html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER);
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = zen_db_output($this->info['comments']);
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td></tr><tr>';
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td></tr><tr>';
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . $html_ot . '</table>';
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_CUSTOMER_TITLE'] = EMAIL_TEXT_CUSTOMER_ADDRESS;
     $html_msg['ADDRESS_CUSTOMER_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, '', "<br />") . '<br />' . ENTRY_EMAIL_ADDRESS . $this->customer['email_address'];
     $email_order .= "\n" . EMAIL_TEXT_CUSTOMER_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], 0, '', "\n") . "\n" . ENTRY_EMAIL_ADDRESS . $this->customer['email_address'] . "\n";
     //addresses area: Delivery
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         if ($GLOBALS[$payment_class]->email_footer) {
             $email_order .= $GLOBALS[$payment_class]->email_footer . "\n\n";
         }
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->email_footer : '';
     $html_msg['EMAIL_VISITORS_DISCLAIMER'] = sprintf(EMAIL_VISITORS_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>');
     // include disclaimer
     $email_order .= "\n-----\n" . sprintf(EMAIL_VISITORS_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     // include copyright
     $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     while (strstr($email_order, '&nbsp;')) {
         $email_order = str_replace('&nbsp;', ' ', $email_order);
     }
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     $html_msg['EMAIL_GREET'] = EMAIL_GREET;
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors');
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_VISITORS_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors_extra');
     }
 }
Exemplo n.º 16
0
            $html_msg['GV_REDEEM_CODE'] = $id1;
            $gv_email .= sprintf(EMAIL_GV_REDEEM, $id1) . "\n\n";
            $gv_email .= EMAIL_GV_LINK . ' ' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1, 'NONSSL', false);
            $gv_email .= "\n\n";
            $gv_email .= EMAIL_GV_FIXED_FOOTER . "\n\n";
            $gv_email .= EMAIL_GV_SHOP_FOOTER;
            $gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, $send_name);
            // include disclaimer
            $gv_email .= "\n\n" . EMAIL_ADVISORY . "\n\n";
            $html_msg['EMAIL_GV_FIXED_FOOTER'] = str_replace(array("\r\n", "\n", "\r", "-----"), '', EMAIL_GV_FIXED_FOOTER);
            $html_msg['EMAIL_GV_SHOP_FOOTER'] = EMAIL_GV_SHOP_FOOTER;
            // send the email
            zen_mail($_POST['to_name'], $_POST['email'], $gv_email_subject, nl2br($gv_email), STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send');
            // send additional emails
            if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') {
                $extra_info = email_collect_extra_info(ENTRY_NAME . $_POST['to_name'], ENTRY_EMAIL . $_POST['email'], $send_name, $account->fields['customers_email_address']);
                $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
                zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_SUBJECT . ' ' . $gv_email_subject, $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra');
            }
            // do a fresh calculation after sending an email
            $gv_query = "SELECT amount\n                   FROM " . TABLE_COUPON_GV_CUSTOMER . "\n                   WHERE customer_id = :customersID";
            $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer');
            $gv_result = $db->Execute($gv_query);
        }
    } else {
        // customer DID click the back button
        $_GET['action'] = '';
    }
}
$gv_current_balance = $currencies->format($gv_result->fields['amount']);
if ($_GET['action'] == 'complete') {
Exemplo n.º 17
0
 function send_order_email($zf_insert_id, $zf_mode = FALSE)
 {
     global $currencies, $order_totals;
     $this->notify('NOTIFY_ORDER_SEND_EMAIL_INITIALIZE', array(), $zf_insert_id, $order_totals, $zf_mode);
     if (!defined('ORDER_EMAIL_DATE_FORMAT')) {
         define('ORDER_EMAIL_DATE_FORMAT', 'M-d-Y h:iA');
     }
     $this->send_low_stock_emails = TRUE;
     $this->notify('NOTIFY_ORDER_SEND_LOW_STOCK_EMAILS');
     if ($this->send_low_stock_emails && $this->email_low_stock != '' && SEND_LOWSTOCK_EMAIL == '1') {
         $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
         zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock');
     }
     // lets start with the email confirmation
     // make an array to store the html version
     $html_msg = array();
     //intro area
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM;
     $html_msg['INTRO_STORE_NAME'] = STORE_NAME;
     $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
     $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW;
     $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
     $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id;
     $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED;
     $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG);
     $html_msg['INTRO_URL_TEXT'] = EMAIL_TEXT_INVOICE_URL_CLICK;
     $html_msg['INTRO_URL_VALUE'] = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     $html_msg['EMAIL_CUSTOMER_PHONE'] = $this->customer['telephone'];
     $html_msg['EMAIL_ORDER_DATE'] = date(ORDER_EMAIL_DATE_FORMAT);
     $invoiceInfo = EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     $htmlInvoiceURL = EMAIL_TEXT_INVOICE_URL_CLICK;
     $htmlInvoiceValue = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
     //comments area
     if ($this->info['comments']) {
         $email_order .= zen_db_output($this->info['comments']) . "\n\n";
         $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
     } else {
         $html_msg['ORDER_COMMENTS'] = '';
     }
     $this->notify('NOTIFY_ORDER_EMAIL_BEFORE_PRODUCTS', array(), $email_order, $html_msg);
     //products area
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n";
     $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
     $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
     //order totals area
     $html_ot = '<tr><td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td> </tr>' . "\n";
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
         $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td> </tr>' . "\n";
     }
     $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
     //addresses area: Delivery
     $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION;
     $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS;
     $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
     $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD;
     $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a';
     if ($this->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
     }
     //addresses area: Billing
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
     $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS;
     $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
     if (is_object($GLOBALS[$_SESSION['payment']])) {
         $cc_num_display = isset($this->info['cc_number']) && $this->info['cc_number'] != '' ? str_repeat('X', strlen($this->info['cc_number']) - 8) . substr($this->info['cc_number'], -4) . "\n\n" : '';
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = $_SESSION['payment'];
         $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
         $email_order .= isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
         $email_order .= $GLOBALS[$payment_class]->email_footer ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
     } else {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $email_order .= PAYMENT_METHOD_GV . "\n\n";
     }
     $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD;
     $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV;
     $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '' ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
     // include disclaimer
     if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '') {
         $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     }
     // include copyright
     if (defined('EMAIL_FOOTER_COPYRIGHT')) {
         $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
     }
     $email_order = str_replace('&nbsp;', ' ', $email_order);
     $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
     //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
     $html_msg['EXTRA_INFO'] = '';
     $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg), $email_order, $html_msg);
     zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
     // send additional emails
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
         $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
         // include authcode and transaction id in admin-copy of email
         if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
             $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ? 'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n";
             $email_order = $pmt_details . $email_order;
             $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
         }
         // Add extra heading stuff via observer class
         $this->extra_header_text = '';
         $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', $zf_insert_id, $email_order, $html_msg);
         $email_order = $this->extra_header_text . $email_order;
         $html_msg['EMAIL_TEXT_HEADER'] = nl2br($this->extra_header_text) . $html_msg['EMAIL_TEXT_HEADER'];
         zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray, $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address']);
     }
     $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', $zf_insert_id, $email_order, $extra_info, $html_msg);
 }
Exemplo n.º 18
0
 function page_product_reviews_write()
 {
     global $db, $template, $breadcrumb, $products_image, $current_page_base, $customer, $products_name, $products_model, $products_price, $messageStack;
     if (!$_SESSION['customer_id'] || !empty($_SESSION['visitors_id'])) {
         $_SESSION['navigation']->set_snapshot();
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     }
     require DIR_WS_MODULES . zen_get_module_directory('require_languages.php');
     $product_info_query = "SELECT p.products_id, p.products_model, p.products_image,\r\n                                    p.products_price, p.products_tax_class_id, pd.products_name\r\n                             FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n                             WHERE p.products_id = :productsID\r\n                             AND p.products_status = '1'\r\n                             AND p.products_id = pd.products_id\r\n                             AND pd.language_id = :languagesID";
     $product_info_query = $db->bindVars($product_info_query, ':productsID', $_GET['products_id'], 'integer');
     $product_info_query = $db->bindVars($product_info_query, ':languagesID', $_SESSION['languages_id'], 'integer');
     $product_info = $db->Execute($product_info_query);
     if (!$product_info->RecordCount()) {
         zen_redirect(zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params(array('action'))));
     }
     $customer_query = "SELECT customers_firstname, customers_lastname, customers_email_address\r\n                         FROM " . TABLE_CUSTOMERS . "\r\n                         WHERE customers_id = :customersID";
     $customer_query = $db->bindVars($customer_query, ':customersID', $_SESSION['customer_id'], 'integer');
     $customer = $db->Execute($customer_query);
     if (isset($_GET['action']) && $_GET['action'] == 'process') {
         $rating = zen_db_prepare_input($_POST['rating']);
         $review_text = zen_db_prepare_input($_POST['review_text']);
         $error = false;
         if (strlen($review_text) < REVIEW_TEXT_MIN_LENGTH) {
             $error = true;
             $messageStack->add('review_text', JS_REVIEW_TEXT);
         }
         if ($rating < 1 || $rating > 5) {
             $error = true;
             $messageStack->add('review_text', JS_REVIEW_RATING);
         }
         if ($error == false) {
             if (REVIEWS_APPROVAL == '1') {
                 $review_status = '0';
             } else {
                 $review_status = '1';
             }
             $sql = "INSERT INTO " . TABLE_REVIEWS . " (products_id, customers_id, customers_name, reviews_rating, date_added, status)\r\n                  VALUES (:productsID, :cutomersID, :customersName, :rating, now(), " . $review_status . ")";
             $sql = $db->bindVars($sql, ':productsID', $_GET['products_id'], 'integer');
             $sql = $db->bindVars($sql, ':cutomersID', $_SESSION['customer_id'], 'integer');
             $sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], 'string');
             $sql = $db->bindVars($sql, ':rating', $rating, 'string');
             $db->Execute($sql);
             $insert_id = $db->Insert_ID();
             $sql = "INSERT INTO " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text)\r\n                  VALUES (:insertID, :languagesID, :reviewText)";
             $sql = $db->bindVars($sql, ':insertID', $insert_id, 'integer');
             $sql = $db->bindVars($sql, ':languagesID', $_SESSION['languages_id'], 'integer');
             $sql = $db->bindVars($sql, ':reviewText', $review_text, 'string');
             $db->Execute($sql);
             // send review-notification email to admin
             if (REVIEWS_APPROVAL == '1' && SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO_STATUS == '1' and defined('SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO') and SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO != '') {
                 $email_text = sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name']) . "\n\n";
                 $email_text .= sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text) . "\n\n";
                 $email_subject = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']);
                 $html_msg['EMAIL_SUBJECT'] = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']);
                 $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name']));
                 $html_msg['EMAIL_MESSAGE_HTML'] .= '<br />';
                 $html_msg['EMAIL_MESSAGE_HTML'] .= str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text));
                 $extra_info = email_collect_extra_info($name, $email_address, $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], $customer->fields['customers_email_address']);
                 $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
                 zen_mail('', SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO, $email_subject, $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'reviews_extra');
             }
             // end send email
             zen_redirect(zen_href_link(FILENAME_ADDON, 'module=easy_reviews/product_reviews_write_complete&products_id=' . $_GET['products_id']));
         }
     }
     $products_price = zen_get_products_display_price($product_info->fields['products_id']);
     $products_name = $product_info->fields['products_name'];
     if ($product_info->fields['products_model'] != '') {
         $products_model = '<br /><span class="smallText">[' . $product_info->fields['products_model'] . ']</span>';
     } else {
         $products_model = '';
     }
     // set image
     //  $products_image = $product_info->fields['products_image'];
     if ($product_info->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
         $products_image = PRODUCTS_IMAGE_NO_IMAGE;
     } else {
         $products_image = $product_info->fields['products_image'];
     }
     $breadcrumb->add(MODULE_EASY_REVIEWS_NAVBAR_TITLE);
     $return = array();
     return $return;
 }