function process() { if (!$this->valid_cfg) { return; } global $order, $insert_id; $OSCOM_Db = Registry::get('Db'); $orderId = $insert_id; // just to make it obvious. $debug_email = ''; if ($this->debug) { $debug_email .= '------------[New Order ' . $orderId . ']-----------------' . "\n" . '$order =' . "\n" . print_r($order, true) . '$_COOKIE =' . "\n" . print_r($_COOKIE, true); } if (!isset($_COOKIE['mailchimp_campaign_id']) || !isset($_COOKIE['mailchimp_email_id'])) { return; } if ($this->debug) { $debug_email .= date('Y-m-d H:i:s') . ' current ids:' . "\n" . date('Y-m-d H:i:s') . ' eid =' . $_COOKIE['mailchimp_email_id'] . "\n" . date('Y-m-d H:i:s') . ' cid =' . $_COOKIE['mailchimp_campaign_id'] . "\n"; } $Qorder = $OSCOM_Db->get('orders', 'orders_id', ['customers_id' => $_SESSION['customer_id']], 'date_purchased desc', 1); $totals_array = array(); $Qtotals = $OSCOM_Db->get('orders_total', ['value', 'class'], ['orders_id' => $Qorder->valueInt('orders_id')]); while ($Qtotals->fetch()) { $totals_array[$Qtotals->value('class')] = $Qtotals->value('value'); } $products_array = array(); $Qproducts = $OSCOM_Db->get('orders_products', ['products_id', 'products_model', 'products_name', 'products_tax', 'products_quantity', 'final_price'], ['orders_id' => $Qorder->valueInt('orders_id')]); while ($Qproducts->fetch()) { $products_array[] = array('id' => $Qproducts->valueInt('products_id'), 'name' => $Qproducts->value('products_name'), 'model' => $Qproducts->value('products_model'), 'qty' => $Qproducts->value('products_quantity'), 'final_price' => $Qproducts->value('final_price')); $totals_array['ot_tax'] += $Qproducts->value('product_tax'); } $mcorder = array('id' => $Qorder->valueInt('orders_id'), 'total' => $totals_array['ot_total'], 'shipping' => $totals_array['ot_shipping'], 'tax' => $totals_array['ot_tax'], 'items' => array(), 'store_id' => $this->store_id, 'store_name' => $_SERVER['SERVER_NAME'], 'campaign_id' => $_COOKIE['mailchimp_campaign_id'], 'email_id' => $_COOKIE['mailchimp_email_id'], 'plugin_id' => 1216); foreach ($products_array as $product) { $item = array(); $item['line_num'] = $line; $item['product_id'] = $product['id']; $item['product_name'] = $product['name']; $item['sku'] = $product['model']; $item['qty'] = $product['qty']; $item['cost'] = $product['final_price']; //All this to get a silly category name from here $Qcat = $OSCOM_Db->get('products_to_categories', 'categories_id', ['products_id' => $product['id']], null, 1); $cat_id = $Qcat->valueInt('categories_id'); $item['category_id'] = $cat_id; $cat_name == ''; $continue = true; while ($continue) { //now recurse up the categories tree... $Qcat = $OSCOM_Db->prepare('select c.categories_id, c.parent_id, cd.categories_name from :table_categories c inner join :table_categories_description cd on c.categories_id = cd.categories_id where c.categories_id = :categories_id'); $Qcat->bindInt(':categories_id', $cat_id); $Qcat->execute(); if ($cat_name == '') { $cat_name = $Qcat->value('categories_name'); } else { $cat_name = $Qcat->value('categories_name') . ' - ' . $cat_name; } $cat_id = $Qcat->valueInt('parent_id'); if ($cat_id == 0) { $continue = false; } } $item['category_name'] = $cat_name; $mcorder['items'][] = $item; } $GLOBALS["mc_api_key"] = $this->apikey; $api = new MCAPI('notused', 'notused'); $res = $api->campaignEcommAddOrder($mcorder); if ($api->errorMessage != '') { if ($this->debug) { $debug_email .= 'Error:' . "\n" . $api->errorMessage . "\n"; } } else { //nothing } // send!() if ($this->debug && !empty($debug_email)) { $debugEmail = new Mail(MODULE_HEADER_TAGS_MAILCHIMP_360_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'MailChimp Debug E-Mail'); $debugEmail->setBody($debug_email); $debugEmail->send(); } }
} $actionRecorder = new actionRecorder('ar_tell_a_friend', isset($_SESSION['customer_id']) ? $_SESSION['customer_id'] : null, $from_name); if (!$actionRecorder->canPerform()) { $error = true; $actionRecorder->record(false); $messageStack->add('friend', OSCOM::getDef('error_action_recorder', ['module_action_recorder_tell_a_friend_email_minutes' => defined('MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES : 15])); } if ($error == false) { $email_subject = OSCOM::getDef('text_email_subject', ['from_name' => $from_name, 'store_name' => STORE_NAME]); $email_body = OSCOM::getDef('text_email_intro', ['to_name' => $to_name, 'from_name' => $from_name, 'products_name' => $Qproduct->value('products_name'), 'store_name' => STORE_NAME]) . "\n\n"; if (tep_not_null($message)) { $email_body .= $message . "\n\n"; } $email_body .= OSCOM::getDef('text_email_link', ['email_product_link' => OSCOM::link('product_info.php', 'products_id=' . $Qproduct->valueInt('products_id'), false)]) . "\n\n" . OSCOM::getDef('text_email_signature', ['email_store_name_link' => STORE_NAME . "\n" . OSCOM::link('index.php', null, false) . "\n"]); $tellfriendEmail = new Mail($to_email_address, $to_name, $from_email_address, $from_name, $email_subject); $tellfriendEmail->setBody($email_body); $tellfriendEmail->send(); $actionRecorder->record(); $messageStack->add_session('header', OSCOM::getDef('text_email_successful_sent', ['email_products_name' => $Qproduct->value('products_name'), 'to_name' => HTML::outputProtected($to_name)]), 'success'); OSCOM::redirect('product_info.php', 'products_id=' . $Qproduct->valueInt('products_id')); } } elseif (isset($_SESSION['customer_id'])) { $Qcustomer = $OSCOM_Db->get('customers', ['customers_firstname', 'customers_lastname', 'customers_email_address'], ['customers_id' => $_SESSION['customer_id']]); $from_name = $Qcustomer->value('customers_firstname') . ' ' . $Qcustomer->value('customers_lastname'); $from_email_address = $Qcustomer->value('customers_email_address'); } $breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('tell_a_friend.php', 'products_id=' . $Qproduct->valueInt('products_id'))); require $oscTemplate->getFile('template_top.php'); ?> <div class="page-header">
function sendDebugEmail($response = array()) { if (tep_not_null(MODULE_PAYMENT_SAGE_PAY_SERVER_DEBUG_EMAIL)) { $email_body = ''; if (!empty($response)) { $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n"; } if (!empty($_POST)) { $email_body .= '$_POST:' . "\n\n" . print_r($_POST, true) . "\n\n"; } if (!empty($_GET)) { $email_body .= '$_GET:' . "\n\n" . print_r($_GET, true) . "\n\n"; } if (!empty($email_body)) { $debugEmail = new Mail(MODULE_PAYMENT_SAGE_PAY_SERVER_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'Sage Pay Server Debug E-Mail'); $debugEmail->setBody($email_body); $debugEmail->send(); } } }
if ($order->content_type != 'virtual') { $email_order .= "\n" . OSCOM::getDef('email_text_delivery_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n"; } $email_order .= "\n" . OSCOM::getDef('email_text_billing_address') . "\n" . OSCOM::getDef('email_separator') . "\n" . tep_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n"; if (isset($OSCOM_PM)) { $email_order .= OSCOM::getDef('email_text_payment_method') . "\n" . OSCOM::getDef('email_separator') . "\n"; $email_order .= $order->info['payment_method'] . "\n\n"; if (isset($OSCOM_PM->email_footer)) { $email_order .= $OSCOM_PM->email_footer . "\n\n"; } } $orderEmail = new Mail($order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject')); $orderEmail->setBody($email_order); $orderEmail->send(); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { $extraEmail = new Mail(SEND_EXTRA_ORDER_EMAILS_TO, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject')); $extraEmail->setBody($email_order); $extraEmail->send(); } // load the after_process function from the payment modules $payment_modules->after_process(); $_SESSION['cart']->reset(true); // unregister session variables used during checkout unset($_SESSION['sendto']); unset($_SESSION['billto']); unset($_SESSION['shipping']); unset($_SESSION['payment']); unset($_SESSION['comments']); OSCOM::redirect('checkout_success.php'); require 'includes/application_bottom.php';
$name = HTML::sanitize($_POST['name']); $email_address = HTML::sanitize($_POST['email']); $enquiry = HTML::sanitize($_POST['enquiry']); if (!Is::email($email_address)) { $error = true; $messageStack->add('contact', OSCOM::getDef('entry_email_address_check_error')); } $actionRecorder = new actionRecorder('ar_contact_us', isset($_SESSION['customer_id']) ? $_SESSION['customer_id'] : null, $name); if (!$actionRecorder->canPerform()) { $error = true; $actionRecorder->record(false); $messageStack->add('contact', OSCOM::getDef('error_action_recorder', ['module_action_recorder_contact_us_email_minutes' => defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15])); } if ($error == false) { $contactEmail = new Mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $name, OSCOM::getDef('email_subject', ['store_name' => STORE_NAME])); $contactEmail->setBody($enquiry); $contactEmail->send(); $actionRecorder->record(); OSCOM::redirect('contact_us.php', 'action=success'); } } $breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('contact_us.php')); require $oscTemplate->getFile('template_top.php'); ?> <div class="page-header"> <h1><?php echo OSCOM::getDef('heading_title'); ?> </h1> </div>
function sendDebugEmail($response = array()) { if (tep_not_null(MODULE_PAYMENT_SAGE_PAY_DIRECT_DEBUG_EMAIL)) { $email_body = ''; if (!empty($response)) { $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n"; } if (!empty($_POST)) { if (isset($_POST['cc_number_nh-dns'])) { $_POST['cc_number_nh-dns'] = 'XXXX' . substr($_POST['cc_number_nh-dns'], -4); } if (isset($_POST['cc_cvc_tokens_nh-dns'])) { $_POST['cc_cvc_tokens_nh-dns'] = 'XXX'; } if (isset($_POST['cc_cvc_nh-dns'])) { $_POST['cc_cvc_nh-dns'] = 'XXX'; } if (isset($_POST['cc_issue_nh-dns'])) { $_POST['cc_issue_nh-dns'] = 'XXX'; } if (isset($_POST['cc_expires_month'])) { $_POST['cc_expires_month'] = 'XX'; } if (isset($_POST['cc_expires_year'])) { $_POST['cc_expires_year'] = 'XX'; } if (isset($_POST['cc_starts_month'])) { $_POST['cc_starts_month'] = 'XX'; } if (isset($_POST['cc_starts_year'])) { $_POST['cc_starts_year'] = 'XX'; } $email_body .= '$_POST:' . "\n\n" . print_r($_POST, true) . "\n\n"; } if (!empty($_GET)) { $email_body .= '$_GET:' . "\n\n" . print_r($_GET, true) . "\n\n"; } if (!empty($email_body)) { $debugEmail = new Mail(MODULE_PAYMENT_SAGE_PAY_DIRECT_DEBUG_EMAIL, null, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, 'Sage Pay Direct Debug E-Mail'); $debugEmail->setBody($email_body); $debugEmail->send(); } } }