Помощь Как в opencart отключить уведомления о заказе?

grebovich

Гуру форума
Регистрация
19 Мар 2012
Сообщения
362
Реакции
81
Ребята подскажите пожалуйста как в opencart отключить отправку письма клиенту после заказа, в админке насколько я знаю такого нет...
Именно не вырубить всю почту по сайту :) А только уведомление чтоб не отправлялось клиенту после того как он сделал заказ.
 
Идём сюда
Код:
catalog->model->checkout
Находим файл
Код:
order.php
Если у вас чекаут сделан через другую систему - значит открываем и правим аналогичный файл (должен быть в этой же папке).
Находим строчку вроде этой
Код:
$mail->send();
И комментируем а-ля
Код:
//$mail->send(); // отключили отправку письма о заказе
Сохраняем и тестируем :)
 
Идём сюда
Код:
catalog->model->checkout
Находим файл
Код:
order.php
Если у вас чекаут сделан через другую систему - значит открываем и правим аналогичный файл (должен быть в этой же папке).
Находим строчку вроде этой
Код:
$mail->send();
И комментируем а-ля
Код:
//$mail->send(); // отключили отправку письма о заказе
Сохраняем и тестируем :)
Хех, там их четире штуки....
 
Какая версия движка? Если 1.5.5.1.2 то как было сказано ранее - catalog\model\checkout\order.php
В нем перед строкой
// Admin Alert Mail

закомментируйте
$mail->send();
 
Для вашей версии тоже должно подойти
catalog\model\checkout\order.php
В нем перед строкой
// Admin Alert Mail

закомментируйте
$mail->send();
 
Подскажите, закомментировал 4 этих параметра, письма все равно идут.

Код:
..........
   
                // Comment
                if ($order_info['comment']) {
                    $text .= $language->get('text_new_comment') . "\n\n";
                    $text .= $order_info['comment'] . "\n\n";
                }
   
                $text .= $language->get('text_new_footer') . "\n\n";
   
                //$mail = new Mail();
                //$mail->protocol = $this->config->get('config_mail_protocol');
                //$mail->parameter = $this->config->get('config_mail_parameter');
                //$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
                //$mail->smtp_username = $this->config->get('config_mail_smtp_username');
                //$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
                //$mail->smtp_port = $this->config->get('config_mail_smtp_port');
                //$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
   
                //$mail->setTo($order_info['email']);
                //$mail->setFrom($this->config->get('config_email'));
                //$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
                //$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
                //$mail->setHtml($this->load->view('mail/order', $data));
                //$mail->setText($text);
                //$mail->send(); // отключили отправку письма о заказе
   
                // Admin Alert Mail
                if (in_array('order', (array)$this->config->get('config_mail_alert'))) {
                    $subject = sprintf($language->get('text_new_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id);
   
                    // HTML Mail
                    $data['text_greeting'] = $language->get('text_new_received');
   
                    if ($comment) {
                        if ($order_info['comment']) {
                            $data['comment'] = nl2br($comment) . '<br/><br/>' . $order_info['comment'];
                        } else {
                            $data['comment'] = nl2br($comment);
                        }
                    } else {
                        if ($order_info['comment']) {
                            $data['comment'] = $order_info['comment'];
                        } else {
                            $data['comment'] = '';
                        }
                    }
   
                    $data['text_download'] = '';
   
                    $data['text_footer'] = '';
   
                    $data['text_link'] = '';
                    $data['link'] = '';
                    $data['download'] = '';
   
                    // Text
                    $text  = $language->get('text_new_received') . "\n\n";
                    $text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
                    $text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
                    $text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
                    $text .= $language->get('text_new_products') . "\n";
   
                    foreach ($order_product_query->rows as $product) {
                        $text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
   
                        $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $product['order_product_id'] . "'");
   
                        foreach ($order_option_query->rows as $option) {
                            if ($option['type'] != 'file') {
                                $value = $option['value'];
                            } else {
                                $value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
                            }
   
                            $text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
                        }
                    }
   
                    foreach ($order_voucher_query->rows as $voucher) {
                        $text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']);
                    }
   
                    $text .= "\n";
   
                    $text .= $language->get('text_new_order_total') . "\n";
   
                    foreach ($order_total_query->rows as $total) {
                        $text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
                    }
   
                    $text .= "\n";
   
                    if ($order_info['comment']) {
                        $text .= $language->get('text_new_comment') . "\n\n";
                        $text .= $order_info['comment'] . "\n\n";
                    }
   
                    //$mail = new Mail();
                    //$mail->protocol = $this->config->get('config_mail_protocol');
                    //$mail->parameter = $this->config->get('config_mail_parameter');
                    //$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
                    //$mail->smtp_username = $this->config->get('config_mail_smtp_username');
                    //$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
                    //$mail->smtp_port = $this->config->get('config_mail_smtp_port');
                    //$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
   
                    //$mail->setTo($this->config->get('config_email'));
                    //$mail->setFrom($this->config->get('config_email'));
                    //$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
                    //$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
                    //$mail->setHtml($this->load->view('mail/order', $data));
                    //$mail->setText($text);
                    //$mail->send(); // отключили отправку письма о заказе
   
                    // Send to additional alert emails
                    $emails = explode(',', $this->config->get('config_alert_email'));
   
                    foreach ($emails as $email) {
                        if ($email && filter_var($email, FILTER_VALIDATE_EMAIL)) {
                            $mail->setTo($email);
                            //$mail->send();
                        }
                    }
                }
            }
   
            // If order status is not 0 then send update text email
            if ($order_info['order_status_id'] && $order_status_id && $notify) {
                $language = new Language($order_info['language_code']);
                $language->load($order_info['language_code']);
                $language->load('mail/order');
   
                $subject = sprintf($language->get('text_update_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_id);
   
                $message  = $language->get('text_update_order') . ' ' . $order_id . "\n";
                $message .= $language->get('text_update_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n\n";
   
                $order_status_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_status WHERE order_status_id = '" . (int)$order_status_id . "' AND language_id = '" . (int)$order_info['language_id'] . "'");
   
                if ($order_status_query->num_rows) {
                    $message .= $language->get('text_update_order_status') . "\n\n";
                    $message .= $order_status_query->row['name'] . "\n\n";
                }
   
                if ($order_info['customer_id']) {
                    $message .= $language->get('text_update_link') . "\n";
                    $message .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n";
                }
   
                if ($comment) {
                    $message .= $language->get('text_update_comment') . "\n\n";
                    $message .= strip_tags($comment) . "\n\n";
                }
   
                $message .= $language->get('text_update_footer');
   
                //$mail = new Mail();
                //$mail->protocol = $this->config->get('config_mail_protocol');
                //$mail->parameter = $this->config->get('config_mail_parameter');
                //$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
                //$mail->smtp_username = $this->config->get('config_mail_smtp_username');
                //$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
                //$mail->smtp_port = $this->config->get('config_mail_smtp_port');
                //$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
   
                //$mail->setTo($order_info['email']);
                //$mail->setFrom($this->config->get('config_email'));
                //$mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
                //$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
                //$mail->setText($message);
                //$mail->send();
            }
        }
    }
}
 
Назад
Сверху