function _process()
 {
     global $osC_Language, $messageStack, $osC_Product;
     if (empty($_POST['from_name'])) {
         $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_customers_name_empty'));
     }
     if (!osc_validate_email_address($_POST['from_email_address'])) {
         $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_customers_email_address'));
     }
     if (empty($_POST['to_name'])) {
         $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_friends_name_empty'));
     }
     if (!osc_validate_email_address($_POST['to_email_address'])) {
         $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_friends_email_address'));
     }
     if ($messageStack->size('tell_a_friend') < 1) {
         include 'includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('tell_a_friend');
         $email_template->setData($_POST['from_name'], $_POST['from_email_address'], $_POST['to_name'], $_POST['to_email_address'], $_POST['message'], $osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID(), 'NONSSL', false, true, true));
         $email_template->buildMessage();
         $email_template->sendEmail();
         $messageStack->add_session('header', sprintf($osC_Language->get('success_tell_a_friend_email_sent'), $osC_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success');
         osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID()));
     }
 }
Exemplo n.º 2
0
 function createEntry($data, $restore_cart_contents = true, $send_email = true)
 {
     global $osC_Database, $osC_Session, $osC_Language, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $toC_Wishlist;
     $Qcustomer = $osC_Database->query('insert into :table_customers (customers_firstname, customers_lastname, customers_email_address, customers_newsletter, customers_status, customers_ip_address, customers_password, customers_gender, customers_dob, number_of_logons, date_account_created) values (:customers_firstname, :customers_lastname, :customers_email_address, :customers_newsletter, :customers_status, :customers_ip_address, :customers_password, :customers_gender, :customers_dob, :number_of_logons, :date_account_created)');
     $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomer->bindValue(':customers_firstname', $data['firstname']);
     $Qcustomer->bindValue(':customers_lastname', $data['lastname']);
     $Qcustomer->bindValue(':customers_email_address', $data['email_address']);
     $Qcustomer->bindValue(':customers_newsletter', isset($data['newsletter']) && $data['newsletter'] == '1' ? '1' : '');
     $Qcustomer->bindValue(':customers_status', '1');
     $Qcustomer->bindValue(':customers_ip_address', osc_get_ip_address());
     $Qcustomer->bindValue(':customers_password', osc_encrypt_string($data['password']));
     $Qcustomer->bindValue(':customers_gender', ACCOUNT_GENDER > -1 && isset($data['gender']) && ($data['gender'] == 'm' || $data['gender'] == 'f') ? $data['gender'] : '');
     $Qcustomer->bindValue(':customers_dob', ACCOUNT_DATE_OF_BIRTH == '1' ? date('Ymd', $data['dob']) : '');
     $Qcustomer->bindInt(':number_of_logons', 0);
     $Qcustomer->bindRaw(':date_account_created', 'now()');
     $Qcustomer->execute();
     if ($Qcustomer->affectedRows() === 1) {
         $customer_id = $osC_Database->nextID();
         $QcustomerGroup = $osC_Database->query('select customers_groups_id from :table_customers_groups where is_default = 1');
         $QcustomerGroup->bindTable(':table_customers_groups', TABLE_CUSTOMERS_GROUPS);
         $QcustomerGroup->execute();
         if ($QcustomerGroup->numberOfRows() == 1) {
             $osC_Database->simpleQuery('update ' . TABLE_CUSTOMERS . ' set customers_groups_id = ' . $QcustomerGroup->valueInt('customers_groups_id') . ' where customers_id = ' . $customer_id);
         }
         if (SERVICE_SESSION_REGENERATE_ID == '1') {
             $osC_Session->recreate();
         }
         $osC_Customer->setCustomerData($customer_id);
         //restore cart contents
         if ($restore_cart_contents === true) {
             $osC_ShoppingCart->synchronizeWithDatabase();
         }
         //restore wishlist contents
         $toC_Wishlist->synchronizeWithDatabase();
         $osC_NavigationHistory->removeCurrentPage();
         include 'email_template.php';
         $email = toC_Email_Template::getEmailTemplate('create_account_email');
         $email->setData($osC_Customer, $data['password']);
         $email->buildMessage();
         $email->sendEmail();
         return true;
     }
     return false;
 }
 function _process()
 {
     global $messageStack, $osC_Database, $osC_Language;
     $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             include 'includes/classes/email_template.php';
             $email_template = toC_Email_Template::getEmailTemplate('password_forgotten');
             $email_template->setData($Qcheck->valueProtected('customers_firstname'), $Qcheck->valueProtected('customers_lastname'), getenv('REMOTE_ADDR'), $password, $Qcheck->valueProtected('customers_gender'), $Qcheck->valueProtected('customers_email_address'));
             $email_template->buildMessage();
             $email_template->sendEmail();
             $messageStack->add_session('login', $osC_Language->get('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     } else {
         $messageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found'));
     }
 }
Exemplo n.º 4
0
 function setStatus($id, $flag)
 {
     global $osC_Database;
     $Qstatus = $osC_Database->query('update :table_orders_products_download set status = :status where orders_products_download_id = :orders_products_download_id');
     $Qstatus->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
     $Qstatus->bindInt(':status', $flag);
     $Qstatus->bindInt(':orders_products_download_id', $id);
     $Qstatus->setLogging($_SESSION['module'], $id);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         if ($flag == '1') {
             require_once '../includes/classes/email_template.php';
             $email = toC_Email_Template::getEmailTemplate('active_downloadable_product');
             $data = self::getData($id);
             $email->setData($data['customers_name'], $data['customers_email_address'], $data['products_name']);
             $email->buildMessage();
             $email->sendEmail();
         }
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 function setStatus($id, $flag)
 {
     global $osC_Database;
     $Qstatus = $osC_Database->query('update :table_gift_certificates set status = :gift_certificates_status where gift_certificates_id = :gift_certificates_id');
     $Qstatus->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
     $Qstatus->bindInt(':gift_certificates_status', $flag);
     $Qstatus->bindInt(':gift_certificates_id', $id);
     $Qstatus->setLogging($_SESSION['module'], $id);
     $Qstatus->execute();
     if (!$osC_Database->isError()) {
         $data = self::getData($id);
         if ($flag == '1' && $data['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
             require_once 'includes/classes/currencies.php';
             $osC_Currencies = new osC_Currencies_Admin();
             require_once '../includes/classes/email_template.php';
             $email = toC_Email_Template::getEmailTemplate('active_gift_certificate');
             $email->setData($data['senders_name'], $data['senders_email'], $data['recipients_name'], $data['recipients_email'], $osC_Currencies->format($data['amount']), $data['gift_certificates_code'], $data['messages']);
             $email->buildMessage();
             $email->sendEmail();
         }
         return true;
     }
     return false;
 }
Exemplo n.º 6
0
 function sendEmail($customers_id, $addtional_message)
 {
     global $osC_Database, $osC_Language;
     $contents = self::getCartContents($customers_id);
     $Qcustomer = $osC_Database->query('select * from :table_customers where customers_id = :customers_id');
     $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomer->bindInt(':customers_id', $customers_id);
     $Qcustomer->execute();
     include_once '../includes/classes/email_template.php';
     $email = toC_Email_Template::getEmailTemplate('abandoned_cart_inquiry');
     $email->setData($Qcustomer->value('customers_gender'), $Qcustomer->value('customers_firstname'), $Qcustomer->value('customers_lastname'), $contents, $addtional_message, $Qcustomer->value('customers_email_address'));
     $email->buildMessage();
     $email->sendEmail();
     $Qcustomer = $osC_Database->query('update :table_customers set abandoned_cart_last_contact_date = :abandoned_cart_last_contact_date where customers_id = :customers_id');
     $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomer->bindRaw(':abandoned_cart_last_contact_date', 'now()');
     $Qcustomer->bindInt(':customers_id', $customers_id);
     $Qcustomer->setLogging($_SESSION['module'], $customers_id);
     $Qcustomer->execute();
     if ($osC_Database->isError()) {
         return false;
     }
     return true;
 }
 function generatePassword($email)
 {
     global $osC_Database;
     $password = osc_create_random_string(8);
     $Qpassword = $osC_Database->query('update :table_administrators set user_password = :user_password where email_address = :email_address');
     $Qpassword->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
     $Qpassword->bindValue(':user_password', osc_encrypt_string($password));
     $Qpassword->bindValue(':email_address', $email);
     $Qpassword->execute();
     if (!$osC_Database->isError()) {
         $Qadmin = $osC_Database->query('select id, user_name, email_address from :table_administrators where email_address = :email_address');
         $Qadmin->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
         $Qadmin->bindValue(':email_address', $email);
         $Qadmin->execute();
         include '../includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('admin_password_forgotten');
         $email_template->setData($Qadmin->value('user_name'), osc_get_ip_address(), $password, $email);
         $email_template->buildMessage();
         $email_template->sendEmail();
         return true;
     }
     return false;
 }
 function toC_Email_Template_admin_create_order_credit_slip()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 9
0
 function outstockAlert($products_name, $stock, $variants_name = '')
 {
     require_once 'includes/classes/email_template.php';
     $email_template = toC_Email_Template::getEmailTemplate('out_of_stock_alerts');
     $email_template->setData($products_name, $stock, $variants_name);
     $email_template->buildMessage();
     $email_template->sendEmail();
 }
 function toC_Email_Template_admin_create_purchase_order()
 {
     parent::toC_Email_Template($this->_template_name);
 }
 function toC_Email_Template_admin_order_status_updated()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 12
0
 function sendEmail($id)
 {
     require_once 'email_template.php';
     $email_template = toC_Email_Template::getEmailTemplate('new_order_created');
     $email_template->setData($id);
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $email_template->addRecipient('', SEND_EXTRA_ORDER_EMAILS_TO);
     }
     $email_template->buildMessage();
     $email_template->sendEmail();
 }
Exemplo n.º 13
0
 function saveBlance($data)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     $Qcredits = $osC_Database->query('insert into :table_customers_credits_history (customers_id, date_added, action_type, amount, comments) values(:customers_id, now(), :action_type, :amount, :comments)');
     $Qcredits->bindTable(':table_customers_credits_history', TABLE_CUSTOMERS_CREDITS_HISTORY);
     $Qcredits->bindInt(':customers_id', $data['customers_id']);
     $Qcredits->bindInt(':action_type', STORE_CREDIT_ACTION_TYPE_ADMIN);
     $Qcredits->bindRaw(':amount', $data['amount']);
     $Qcredits->bindValue(':comments', $data['comments']);
     $Qcredits->setLogging($_SESSION['module'], $data['customers_id']);
     $Qcredits->execute();
     if ($osC_Database->isError()) {
         $error = true;
     }
     if ($error === false) {
         $Qcustomer = $osC_Database->query('update :table_customers set customers_credits = (customers_credits + :customers_credits) where customers_id = :customers_id');
         $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
         $Qcustomer->bindRaw(':customers_credits', $data['amount']);
         $Qcustomer->bindInt(':customers_id', $data['customers_id']);
         $Qcustomer->setLogging($_SESSION['module'], $data['customers_id']);
         $Qcustomer->execute();
         if (!$osC_Database->isError()) {
             $osC_Database->commitTransaction();
             if ($data['notify'] == 1) {
                 include '../includes/classes/email_template.php';
                 $data = osC_Customers_Admin::getData($data['customers_id']);
                 $emailTemplate = toC_Email_Template::getEmailTemplate('admin_customer_credits_change_notification');
                 $emailTemplate->setData($data['customers_firstname'], $data['customers_lastname'], $data['customers_email_address'], $data['customers_gender'], $data['customers_credits']);
                 $emailTemplate->buildMessage();
                 $emailTemplate->sendEmail();
             }
             return true;
         }
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
 function toC_Email_Template_active_downloadable_product()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 15
0
 function createStoreCredit($data)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     //order refund
     $Qinsert = $osC_Database->query('insert into :table_orders_refunds (orders_refunds_type, orders_id, credit_slips_id, sub_total, shipping, handling, refund_total, comments, date_added) values (:orders_refunds_type, :orders_id, :credit_slips_id, :sub_total, :shipping, :handling, :refund_total, :comments, now())');
     $Qinsert->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
     $Qinsert->bindInt(':orders_refunds_type', ORDERS_RETURNS_TYPE_STORE_CREDIT);
     $Qinsert->bindInt(':orders_id', $data['orders_id']);
     $Qinsert->bindRaw(':credit_slips_id', 'null');
     $Qinsert->bindValue(':sub_total', $data['sub_total']);
     $Qinsert->bindValue(':shipping', $data['shipping_fee']);
     $Qinsert->bindValue(':handling', $data['handling']);
     $Qinsert->bindValue(':refund_total', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
     $Qinsert->bindValue(':comments', $data['comments']);
     $Qinsert->setLogging($_SESSION['module'], null);
     $Qinsert->execute();
     if ($osC_Database->isError()) {
         $error = true;
     } else {
         $orders_refunds_id = $osC_Database->nextID();
         //orders refunds products
         $return_products = explode(';', $data['return_quantity']);
         foreach ($return_products as $product) {
             list($orders_products_id, $quantity) = explode(':', $product);
             $Qproduct = $osC_Database->query('insert into :table_orders_refunds_products (orders_refunds_id, orders_products_id, products_quantity) values (:orders_refunds_id, :orders_products_id, :products_quantity)');
             $Qproduct->bindTable(':table_orders_refunds_products', TABLE_ORDERS_REFUNDS_PRODUCTS);
             $Qproduct->bindInt(':orders_refunds_id', $orders_refunds_id);
             $Qproduct->bindInt(':orders_products_id', $orders_products_id);
             $Qproduct->bindInt(':products_quantity', $quantity);
             $Qproduct->setLogging($_SESSION['module'], $orders_refunds_id);
             $Qproduct->execute();
             if ($osC_Database->isError()) {
                 $error = true;
                 break;
             }
             if ($error === false) {
                 $Qupdate = $osC_Database->query('update :table_orders_products set products_return_quantity = products_return_quantity + :products_return_quantity where orders_products_id = :orders_products_id');
                 $Qupdate->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qupdate->bindInt(':products_return_quantity', $quantity);
                 $Qupdate->bindInt(':orders_products_id', $orders_products_id);
                 $Qupdate->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qupdate->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false && $data['restock_quantity'] === true) {
                 $Qcheck = $osC_Database->query('select products_id from :table_orders_products where orders_products_id = :orders_products_id and orders_id = :orders_id');
                 $Qcheck->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qcheck->bindInt(':orders_products_id', $orders_products_id);
                 $Qcheck->bindInt(':orders_id', $data['orders_id']);
                 $Qcheck->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qcheck->execute();
                 $products_id = $Qcheck->valueInt('products_id');
                 if (!osC_Product::restock($data['orders_id'], $orders_products_id, $products_id, $quantity)) {
                     $error = true;
                     break;
                 }
             }
         }
     }
     if ($error === false) {
         $Qreturn = $osC_Database->query('update :table_orders_returns set orders_returns_status_id = :orders_returns_status_id, admin_comments = :admin_comments, date_updated = now() where orders_returns_id = :id');
         $Qreturn->bindTable(':table_orders_returns', TABLE_ORDERS_RETURNS);
         $Qreturn->bindInt(':orders_returns_status_id', ORDERS_RETURNS_STATUS_REFUNDED_STORE_CREDIT);
         $Qreturn->bindValue(':admin_comments', $data['comment']);
         $Qreturn->bindInt(':id', $data['orders_returns_id']);
         $Qreturn->setLogging($_SESSION['module'], $data['orders_returns_id']);
         $Qreturn->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qcustomer = $osC_Database->query('select customers_id from :table_orders where orders_id = :orders_id');
         $Qcustomer->bindTable(':table_orders', TABLE_ORDERS);
         $Qcustomer->bindInt(':orders_id', $data['orders_id']);
         $Qcustomer->execute();
         $customers_id = $Qcustomer->valueInt('customers_id');
         $Qhistory = $osC_Database->query('insert into :table_customers_credits_history (customers_id, action_type, date_added, amount, comments) values (:customers_id, :action_type, now(), :amount, :comments)');
         $Qhistory->bindTable(':table_customers_credits_history', TABLE_CUSTOMERS_CREDITS_HISTORY);
         $Qhistory->bindInt(':customers_id', $customers_id);
         $Qhistory->bindInt(':action_type', STORE_CREDIT_ACTION_TYPE_ORDER_REFUNDED);
         $Qhistory->bindValue(':amount', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
         $Qhistory->bindValue(':comments', sprintf($osC_Language->get('infomation_store_credit_from_order'), $data['orders_id']));
         $Qhistory->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($error === false) {
             $Qupdate = $osC_Database->query('update :table_customers set customers_credits = (customers_credits + :customers_credits) where customers_id = :customers_id');
             $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
             $Qupdate->bindRaw(':customers_credits', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
             $Qupdate->bindInt(':customers_id', $customers_id);
             $Qupdate->setLogging($_SESSION['module'], $data['$orders_refunds_id']);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
                 $error = true;
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         $osC_Order = new osC_Order($data['orders_id']);
         $return_products_ids = array();
         $return_products_qty = array();
         $return_products = explode(';', $data['return_quantity']);
         foreach ($return_products as $product) {
             list($orders_products_id, $quantity) = explode(':', $product);
             $return_products_ids[] = $orders_products_id;
             $return_products_qty[$orders_products_id] = $quantity;
         }
         $products = array();
         foreach ($osC_Order->getProducts() as $product) {
             if (in_array($product['orders_products_id'], $return_products_ids)) {
                 $product_info = $return_products_qty[$product['orders_products_id']] . '&nbsp;x&nbsp;' . $product['name'];
                 if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_name') . ': ' . $product['senders_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('senders_email') . ': ' . $product['senders_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_name') . ': ' . $product['recipients_name'] . '</i></nobr>';
                     if ($product['gift_certificates_type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('recipients_email') . ': ' . $product['recipients_email'] . '</i></nobr>';
                     }
                     $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $osC_Language->get('messages') . ': ' . $product['messages'] . '</i></nobr>';
                 }
                 if (isset($product['variants']) && is_array($product['variants']) && sizeof($product['variants']) > 0) {
                     foreach ($product['variants'] as $variants) {
                         $product_info .= '<br /><nobr>&nbsp;&nbsp;&nbsp;<i>' . $variants['groups_name'] . ': ' . $variants['values_name'] . '</i></nobr>';
                     }
                 }
                 $products[] = $product_info;
             }
         }
         $customers_name = $osC_Order->getCustomer('name');
         $customers_email_address = $osC_Order->getCustomer('email_address');
         require_once 'includes/classes/currencies.php';
         $osC_Currencies = new osC_Currencies_Admin();
         include '../includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('admin_create_order_store_credit');
         $email_template->setData($customers_name, $customers_email_address, implode('<br />', $products), $data['orders_id'], $osC_Currencies->format($data['sub_total'] + $data['shipping_fee'] + $data['handling']));
         $email_template->buildMessage();
         $email_template->sendEmail();
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
 function toC_Email_Template_new_order_created()
 {
     parent::toC_Email_Template($this->_template_name);
 }
 function toC_Email_Template_admin_create_account_email()
 {
     parent::toC_Email_Template($this->_template_name);
 }
 function toC_Email_Template_active_gift_certificate()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 19
0
 function _share_wishlist()
 {
     global $osC_Language, $messageStack, $toC_Wishlist;
     $data = array();
     if (isset($_POST['wishlist_customer']) && !empty($_POST['wishlist_customer'])) {
         $data['wishlist_customer'] = $_POST['wishlist_customer'];
     } else {
         $messageStack->add($this->_module, $osC_Language->get('field_share_wishlist_customer_name_error'));
     }
     if (isset($_POST['wishlist_from_email']) && !empty($_POST['wishlist_from_email'])) {
         $data['wishlist_from_email'] = $_POST['wishlist_from_email'];
     } else {
         $messageStack->add($this->_module, $osC_Language->get('field_share_wishlist_customer_email_error'));
     }
     if (isset($_POST['wishlist_emails']) && !empty($_POST['wishlist_emails'])) {
         $data['wishlist_emails'] = $_POST['wishlist_emails'];
     } else {
         $messageStack->add($this->_module, $osC_Language->get('field_share_wishlist_emails_error'));
     }
     if (isset($_POST['wishlist_message']) && !empty($_POST['wishlist_message'])) {
         $data['wishlist_message'] = $_POST['wishlist_message'];
     } else {
         $messageStack->add($this->_module, $osC_Language->get('field_share_wishlist_message_error'));
     }
     if ($messageStack->size($this->_module) === 0) {
         include 'includes/classes/email_template.php';
         $wishlist_url = osc_href_link(FILENAME_ACCOUNT, 'wishlist=display_wishlist&token=' . $toC_Wishlist->getToken(), 'NONSSL', true, true, true);
         $email = toC_Email_Template::getEmailTemplate('share_wishlist');
         $email->setData($data['wishlist_customer'], $data['wishlist_from_email'], $data['wishlist_emails'], $data['wishlist_message'], $wishlist_url);
         $email->buildMessage();
         $email->sendEmail();
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'wishlist', 'SSL'));
     }
 }
Exemplo n.º 20
0
 function sendEmail()
 {
     global $toC_Json, $osC_Database, $osC_Language;
     $coupons_id = isset($_REQUEST['coupons_id']) && is_numeric($_REQUEST['coupons_id']) ? $_REQUEST['coupons_id'] : null;
     $customers_id = $_REQUEST['customers_id'];
     $message = $_REQUEST['message'];
     $Qcustomer = $osC_Database->query('select customers_email_address, customers_id, customers_firstname, customers_lastname, customers_gender from :table_customers where customers_id = :customers_id');
     $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcustomer->bindInt(':customers_id', $customers_id);
     $Qcustomer->execute();
     $Qcoupons = $osC_Database->query('select * from :table_coupons c, :table_coupons_description cd where c.coupons_id=cd.coupons_id and cd.language_id=:language_id and c.coupons_id = :coupons_id');
     $Qcoupons->bindTable(':table_coupons', TABLE_COUPONS);
     $Qcoupons->bindTable(':table_coupons_description', TABLE_COUPONS_DESCRIPTION);
     $Qcoupons->bindInt(':language_id', $osC_Language->getID());
     $Qcoupons->bindInt(':coupons_id', $coupons_id);
     $Qcoupons->execute();
     if (!$osC_Database->isError) {
         $email = $Qcustomer->value('customers_email_address');
         $customers_firstname = $Qcustomer->value('customers_firstname');
         $customers_lastname = $Qcustomer->value('customers_lastname');
         include '../includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('send_coupon');
         $email_template->setData($Qcustomer->value('customers_gender'), $customers_firstname, $customers_lastname, $Qcoupons->value('coupons_code'), $message, $email);
         $email_template->buildMessage();
         $email_template->sendEmail();
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Exemplo n.º 21
0
 function toC_Email_Template_password_forgotten()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 22
0
 function toC_Email_Template_send_coupon()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 23
0
 function activeGiftCertificates($orders_id)
 {
     global $osC_Database;
     require_once 'includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies_Admin();
     //create email template object
     require_once '../includes/classes/email_template.php';
     $email = toC_Email_Template::getEmailTemplate('active_gift_certificate');
     //retrieve gift certifcates
     $Qcertificates = $osC_Database->query('select * from :table_gift_certificates where orders_id = :orders_id');
     $Qcertificates->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
     $Qcertificates->bindInt(':orders_id', $orders_id);
     $Qcertificates->execute();
     while ($Qcertificates->next()) {
         if ($Qcertificates->valueInt('status') == 0) {
             //update gift certificate status
             $Qupdate = $osC_Database->query('update :table_gift_certificates set status = :status where gift_certificates_id = :gift_certificates_id');
             $Qupdate->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
             $Qupdate->bindInt(':status', 1);
             $Qupdate->bindInt(':gift_certificates_id', $Qcertificates->valueInt('gift_certificates_id'));
             $Qupdate->setLogging($_SESSION['module'], $orders_id);
             $Qupdate->execute();
             //send notification email
             if ($Qcertificates->valueInt('type') == GIFT_CERTIFICATE_TYPE_EMAIL) {
                 $email->resetRecipients();
                 $email->setData($Qcertificates->value('senders_name'), $Qcertificates->value('senders_email'), $Qcertificates->value('recipients_name'), $Qcertificates->value('recipients_email'), $osC_Currencies->format($Qcertificates->value('amount')), $Qcertificates->value('gift_certificates_code'), $Qcertificates->value('messages'));
                 $email->buildMessage();
                 $email->sendEmail();
             }
         }
     }
 }
Exemplo n.º 24
0
 function toC_Email_Template_tell_a_friend()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 25
0
 function sendEmail($id)
 {
     require_once 'email_template.php';
     $email_template = toC_Email_Template::getEmailTemplate('new_order_created');
     $email_template->setData($id);
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $extra_emials = explode(',', SEND_EXTRA_ORDER_EMAILS_TO);
         if (is_array($extra_emials) && !osc_empty($extra_emials)) {
             foreach ($extra_emials as $email) {
                 $email_template->addRecipient('', trim($email));
             }
         }
     }
     $email_template->buildMessage();
     $email_template->sendEmail();
 }
Exemplo n.º 26
0
 function toC_Email_Template_Create_Account_Email()
 {
     parent::toC_Email_Template($this->_template_name);
 }
Exemplo n.º 27
0
 function _updateStatus($id, $data)
 {
     global $osC_Database, $osC_Language, $orders_status_array;
     $error = false;
     $osC_Database->startTransaction();
     $orders_status = osC_OrdersStatus_Admin::getData($data['status_id']);
     if ($orders_status['downloads_flag'] == 1) {
         osC_Order::activeDownloadables($id);
     }
     if ($orders_status['gift_certificates_flag'] == 1) {
         osC_Order::activeGiftCertificates($id);
     }
     if ($data['status_id'] == ORDERS_STATUS_CANCELLED && $data['restock_products'] == true) {
         $Qproducts = $osC_Database->query('select orders_products_id, products_id, products_type, products_quantity from :table_orders_products where orders_id = :orders_id');
         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $result = osC_Product::restock($id, $Qproducts->valueInt('orders_products_id'), $Qproducts->valueInt('products_id'), $Qproducts->valueInt('products_quantity'));
             if ($result == false) {
                 $error = true;
                 break;
             }
         }
     }
     $Qupdate = $osC_Database->query('update :table_orders set orders_status = :orders_status, last_modified = now() where orders_id = :orders_id');
     $Qupdate->bindTable(':table_orders', TABLE_ORDERS);
     $Qupdate->bindInt(':orders_status', $data['status_id']);
     $Qupdate->bindInt(':orders_id', $id);
     $Qupdate->setLogging($_SESSION['module'], $id);
     $Qupdate->execute();
     if (!$osC_Database->isError()) {
         $Qupdate = $osC_Database->query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, now(), :customer_notified, :comments)');
         $Qupdate->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
         $Qupdate->bindInt(':orders_id', $id);
         $Qupdate->bindInt(':orders_status_id', $data['status_id']);
         $Qupdate->bindInt(':customer_notified', $data['notify_customer'] === true ? '1' : '0');
         $Qupdate->bindValue(':comments', $data['comment']);
         $Qupdate->setLogging($_SESSION['module'], $id);
         $Qupdate->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($data['notify_customer'] === true) {
             $Qorder = $osC_Database->query('select o.customers_name, o.customers_email_address, s.orders_status_name, o.date_purchased from :table_orders o, :table_orders_status s where o.orders_status = s.orders_status_id and s.language_id = :language_id and o.orders_id = :orders_id');
             $Qorder->bindTable(':table_orders', TABLE_ORDERS);
             $Qorder->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
             $Qorder->bindInt(':language_id', $osC_Language->getID());
             $Qorder->bindInt(':orders_id', $id);
             $Qorder->execute();
             require_once '../includes/classes/email_template.php';
             $email_template = toC_Email_Template::getEmailTemplate('admin_order_status_updated');
             $email_template->setData($id, osc_href_link(FILENAME_ACCOUNT, 'orders=' . $id, 'SSL', false, true, true), osC_DateTime::getLong($Qorder->value('date_purchased')), $data['append_comment'], $data['comment'], $Qorder->value('orders_status_name'), $Qorder->value('customers_name'), $Qorder->value('customers_email_address'));
             $email_template->buildMessage();
             $email_template->sendEmail();
         }
     } else {
         $error = true;
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
Exemplo n.º 28
0
 function toC_Email_Template_out_of_stock_alerts()
 {
     parent::toC_Email_Template($this->_template_name);
 }
 function toC_Email_Template_admin_customer_credits_change_notification()
 {
     parent::toC_Email_Template($this->_template_name);
 }
 function toC_Email_Template_abandoned_cart_inquiry()
 {
     parent::toC_Email_Template($this->_template_name);
 }