Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Warning: Cannot modify header information - headers already sent by opencart


Liroykaz

Recommended Posts

Здравствуйте!
Такая ошибка вылазиет при оформлении заказа, ничего не могу поделать с ней. Пробовал и кодировки менять и пробелы подчищать. Что посоветуете?

Warning: Cannot modify header information - headers already sent by (output started at /home/сайт/public_html/catalog/language/russian/checkout/simplecheckout.php:1) in /home/сайт/public_html/catalog/controller/checkout/simplecheckout_shipping.php on line 204Warning: Cannot modify header information - headers already sent by (output started at /home/сайт/public_html/catalog/language/russian/checkout/simplecheckout.php:1) in /home/сайт/public_html/catalog/controller/checkout/simplecheckout_payment.php on line 212

код simplecheckout.php

<?php
// Heading 
$_['heading_title']                  = 'Оформление заказа';

$_['button_login']                   = 'Войти';
$_['button_order']                   = 'Оформить заказ';
$_['button_save_changes']            = 'Сохранить изменения';
$_['button_prev']                    = 'Назад';
$_['button_next']                    = 'Вперед';

// Text
$_['text_cart']                      = 'Корзина';
$_['text_checkout_customer']         = 'Покупатель';
$_['text_checkout_customer_login']   = 'Я зарегистрирован';
$_['text_checkout_customer_cancel']  = 'Отмена';
$_['text_checkout_shipping_method']  = 'Способ доставки';
$_['text_checkout_payment_method']   = 'Способ оплаты';
$_['text_city']                      = 'Начните набирать Ваш город и выберите его из списка';
$_['text_shipping_address']          = 'Введите Ваш адрес для получения полной информации по доставке';
$_['text_payment_address']           = 'Введите Ваш адрес для получения полной информации по оплате';
$_['text_forgotten']                 = 'Забыли пароль?';
$_['text_only']                      = 'Регион: %s';
$_['text_reward']                    = 'Бонусных баллов: %s';
$_['text_items']                     = 'Товаров: %s (%s)';
$_['text_empty']                     = 'Ваша корзина пуста!';
$_['text_login']                     = 'Необходимо войти в <a href="%s">личный кабинет</a> или создать <a href="%s">учетную запись</a> чтобы видеть цены!';
$_['text_agree']                     = 'Я прочитал и согласен с правилами <a class="colorbox fancybox" href="%s" alt="%s"><b>%s</b></a>';
$_['text_agree_shoppica']            = 'Я прочитал и согласен с правилами <a class="s_main_color" rel="prettyPhoto[ajax]" href="%s&iframe=true" alt="%s"><b>%s</b></a>';
$_['text_private']                   = 'Физ. лицо';
$_['text_company']                   = 'Юр. лицо';
$_['text_add_new']                   = 'Добавить новый адрес';
$_['text_your_company']              = 'Данные организации';
$_['text_select_address']            = 'Выберите адрес';
$_['text_proceed_payment']           = 'Подождите... Происходит переход к оплате';
$_['text_checkout_shipping_address'] = 'Адрес доставки';
$_['text_payment_form_title']        = 'Оплата';
$_['text_account_created']           = 'Ваш аккаунт создан! Вы можете перейти к оплате заказа!';
$_['text_need_save_changes']         = 'Необходимо сохранить изменения перед оплатой!';
$_['text_saving_changes']            = 'Сохранение изменений...';
$_['text_you_will_be_registered']    = 'Вы будете зарегистрированы!';
$_['text_please_confirm']            = 'Заказ не подтвержден и может быть потерян!';

// Column
$_['column_image']                   = 'Фото';
$_['column_name']                    = 'Наименование товара';
$_['column_model']                   = 'Модель';
$_['column_quantity']                = '<span title="Количество">Кол-во</span>';
$_['column_price']                   = 'Цена';
$_['column_total']                   = 'Итого';

// Entry
$_['entry_email']                    = 'Email:';
$_['entry_password']                 = 'Пароль:';
$_['entry_password_confirm']         = 'Подтвердите пароль:';
$_['entry_register']                 = 'Зарегистрироваться на сайте:';
$_['entry_coupon']                   = 'Купон:';
$_['entry_reward']                   = 'Использовать баллов (не более %s):';
$_['entry_voucher']                  = 'Подарочный сертификат:';
$_['entry_newsletter']               = 'Подписаться на новости:';
$_['entry_address_same'] 	         = 'Адрес доставки совпадает с адресом плательщика';
$_['entry_customer_type'] 	         = 'Тип покупателя';

// Error
$_['error_login']                    = 'Ошибка: Неверный E-Mail или пароль!';
$_['error_exists']                   = 'E-Mail уже зарегистрирован! Выполните вход для совершения заказа!';
$_['error_no_shipping']              = 'Доставка по данному адресу невозможна! Обратитесь к <a href="%s">Администрации</a>!';
$_['error_no_payment']               = 'Оплата по данному адресу невозможна! Обратитесь к <a href="%s">Администрации</a>!';
$_['error_stock']                    = 'Товары, отмеченные ***, недоступны в нужном количестве или их нет на складе!';
$_['error_minimum']                  = 'Минимальное количество для заказа товара %s составляет %s!';
$_['error_agree']                    = 'Вы должны согласиться с условиями соглашения "%s"!';
$_['error_password']                 = 'В пароле должно быть от 4 до 20 символов!';
$_['error_password_confirm']         = 'Пароль и подтверждение пароля должны совпадать!';
$_['error_coupon']                   = 'Ошибка: купон либо недействителен, либо истек срок его действия, либо достигнут предел его использования!';
$_['error_voucher']                  = 'Неверно указан код Подарочного Сертификата, либо он уже использован, либо истёк срок действия!';
$_['error_reward']                   = 'Пожалуйста введите количество бонусных баллов, которые Вы хотите использовать!';
$_['error_points']                   = 'У вас нет столько бонусных баллов!';
$_['error_maximum']                  = 'Можно потратить не более %s бонусных баллов!';
$_['error_shipping']                 = 'Вы должны выбрать способ доставки!';
$_['error_no_shipping']              = 'Доставка по данному адресу невозможна! Обратитесь к <a href="%s">Администрации</a>!';
$_['error_payment']                  = 'Вы должны выбрать способ оплаты!';
$_['error_no_payment']               = 'Оплата по данному адресу невозможна! Обратитесь к <a href="%s">Администрации</a>!';
$_['error_min_amount']               = 'Внимание: Минимальная сумма для заказа %s!';
$_['error_max_amount']               = 'Винмание: Максимальная сумма для заказа %s!';
$_['error_min_quantity']             = 'Внимание: Минимальное количество для заказа %s!';
$_['error_max_quantity']             = 'Внимание: Максимальное количество для заказа %s!';
$_['error_min_weight']               = 'Внимание: Минимальный вес для заказа %s!';
$_['error_max_weight']               = 'Внимание: Максимальный вес для заказа %s!';

$_['entry_email_confirm']            = 'Повторите e-mail';
$_['error_email_confirm']            = 'E-mail и подтверждение не совпадают!';
$_['text_show_selector']             = 'Изменить страну/регион';

$_['text_summary_comment']           = 'Комментарий';
$_['text_summary_shipping_address']  = 'Адрес доставки';
$_['text_summary_payment_address']   = 'Адрес оплаты';

?>


код simplecheckout_shipping.php

<?php 
/*
@author	Dmitriy Kubarev
@link	http://www.simpleopencart.com
@link	http://www.opencart.com/index.php?route=extension/extension/info&extension_id=4811
*/  

class ControllerCheckoutSimpleCheckoutShipping extends Controller {
    public function index() {

        if (!$this->cart->hasShipping()) {
            return;
        }
        
        $this->language->load('checkout/simplecheckout');

        $this->data['address_empty'] = false;
        
        $address = $this->simple->shipping_address;
        $address_fields = $this->simple->shipping_address_fields;

        $reload = explode(',', $this->config->get('simple_set_for_reload'));
        
        if ($address['country_id'] == '' && in_array('main_country_id', $reload) && !empty($address_fields['main_country_id']) && $address_fields['main_country_id']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['zone_id'] === '' && in_array('main_zone_id', $reload) && !empty($address_fields['main_zone_id']) && $address_fields['main_zone_id']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['city'] == '' && in_array('main_city', $reload) && !empty($address_fields['main_city']) && $address_fields['main_city']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['postcode'] == '' && in_array('main_postcode', $reload) && !empty($address_fields['main_postcode']) && $address_fields['main_postcode']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        $this->data['simple_debug'] = $this->config->get('simple_debug');
        $this->data['address'] = $address;
        
        $this->data['simple_shipping_view_title'] = $this->config->get('simple_shipping_view_title');
        $this->data['simple_shipping_view_address_empty'] = $this->config->get('simple_shipping_view_address_empty');
        $simple_shipping_view_address_full = $this->config->get('simple_shipping_view_address_full');
        $simple_shipping_view_autoselect_first = $this->config->get('simple_shipping_methods_hide') ? true : $this->config->get('simple_shipping_view_autoselect_first');
        $simple_shipping_methods_hide = $this->config->get('simple_shipping_methods_hide');
        
        if ($this->customer->isLogged()) {
            $customer_group_id = $this->customer->getCustomerGroupId();
        } else {
            $customer_group_id = $this->config->get('config_customer_group_id');
        }
  
        if ($this->config->get('simple_customer_view_customer_type')) {
            $customer_groups = $this->simple->get_customer_groups();
        
            if (isset($this->request->post['customer_group_id']) && array_key_exists($this->request->post['customer_group_id'], $customer_groups)) {
                $customer_group_id = $this->request->post['customer_group_id'];
            }
        } 

        $filter_methods = array();
        $simple_group_shipping = $this->config->get('simple_group_shipping');
        if (!empty($simple_group_shipping[$customer_group_id])) {
            $filter_methods = explode(',', $simple_group_shipping[$customer_group_id]);
        }

        $this->data['shipping_methods'] = array();
    
        $quote_data = array();
        
        $this->load->model('setting/extension');
        
        $results = $this->model_setting_extension->getExtensions('shipping');
        
        $simple_shipping_titles = $this->config->get('simple_shipping_titles');
        
        $simple_links = $this->config->get('simple_links_2');
        $simple_links = !empty($simple_links) && is_array($simple_links) ? $simple_links : array();

        $payment_method_code = false;

        if ($this->config->get('simple_childs_payment_first')) {
            $payment_method = $this->simple->payment_method;
            
            $payment_method_code = !empty($payment_method['code']) ? $payment_method['code'] : false;
        }

        foreach ($results as $result) {
            $show_module = true;

            if ($this->data['address_empty'] && !empty($simple_shipping_view_address_full[$result['code']])) {
                $show_module = false;
            } 

            if (is_array($filter_methods) && !empty($filter_methods)) {
                if (in_array($result['code'], $filter_methods)) {
                    $show_module = true;
                } else {
                    $show_module = false;
                }
            }
            
            if ($this->config->get($result['code'] . '_status') && $show_module) {
                $for_payment_methods = array();
                if ($this->config->get('simple_childs_payment_first') && !empty($simple_links[$result['code']])) {
                    $for_payment_methods = explode(",",$simple_links[$result['code']]);
                }

                if (empty($for_payment_methods) || ($payment_method_code && in_array($payment_method_code, $for_payment_methods))) {
                    $this->load->model('shipping/' . $result['code']);
                    
                    $quote = $this->{'model_shipping_' . $result['code']}->getQuote($address); 
        
                    if ($quote) {
                        $quote_data[$result['code']] = array( 
                            'title'      => $quote['title'],
                            'quote'      => $quote['quote'], 
                            'sort_order' => $quote['sort_order'],
                            'error'      => $quote['error'],
                            'warning'    => (isset($quote['warning']) ? $quote['warning'] : ''),
                            'description' => !empty($simple_shipping_titles[$result['code']]['use_description']) && !empty($simple_shipping_titles[$result['code']]['description'][$this->simple->get_language_code()]) ? html_entity_decode($simple_shipping_titles[$result['code']]['description'][$this->simple->get_language_code()]) : ''
                        );
                    }
                }
            }
        }

        $sort_order = array();
      
        foreach ($quote_data as $key => $value) {
            $sort_order[$key] = $value['sort_order'];
        }

        array_multisort($sort_order, SORT_ASC, $quote_data);
        
        $this->data['shipping_methods'] = $quote_data;
        $this->data['shipping_method'] = null;
        $this->data['error_warning'] = '';
        
        $this->data['checked_code'] = '';

        $this->data['disabled_methods'] = array();
        
        if (!empty($simple_shipping_titles)) {
            foreach ($simple_shipping_titles as $key => $value) {
                if (!array_key_exists($key, $this->data['shipping_methods']) && !empty($value['show']) && ($value['show'] == 1 || ($value['show'] == 2 && $this->data['address_empty']))) {
                    $this->data['disabled_methods'][$key]['title'] = !empty($value['title'][$this->simple->get_language_code()]) ? html_entity_decode($value['title'][$this->simple->get_language_code()]) : $key;
                    $this->data['disabled_methods'][$key]['description'] = !empty($value['description'][$this->simple->get_language_code()]) ? html_entity_decode($value['description'][$this->simple->get_language_code()]) : '';
                }
            }
        }

        if ($this->request->server['REQUEST_METHOD'] == 'POST' && !empty($this->request->post['shipping_method_checked'])) {
            $shipping = explode('.', $this->request->post['shipping_method_checked']);
            
            if (isset($this->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
                $this->data['checked_code'] = $this->request->post['shipping_method_checked'];
            }
        }
        
        if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['shipping_method'])) {
            $shipping = explode('.', $this->request->post['shipping_method']);
            
            if (isset($this->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
                $this->data['shipping_method'] = $this->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
               
                if (isset($this->request->post['shipping_method_current']) && $this->request->post['shipping_method_current'] != $this->request->post['shipping_method']) {
                    $this->data['checked_code'] = $this->request->post['shipping_method'];
                }
            }
        }

        if ($this->request->server['REQUEST_METHOD'] == 'GET' && (isset($this->session->data['shipping_method']) || isset($this->request->cookie['shipping_method']))) {
            $user_checked = false;
            if (isset($this->session->data['shipping_method'])) {
                $shipping = explode('.', $this->session->data['shipping_method']['code']);
                $user_checked = true;
            } elseif (isset($this->request->cookie['shipping_method'])) {
                $shipping = explode('.', $this->request->cookie['shipping_method']);
            }
            
            if (isset($this->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
                $this->data['shipping_method'] = $this->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
                if ($user_checked) {
                    $this->data['checked_code'] = $this->session->data['shipping_method']['code'];
                }
            }
        }
        
        if (!empty($this->data['shipping_methods'])) {
            $first = reset($this->data['shipping_methods']);
            if (!empty($first['quote'])) {
                $first_method = reset($first['quote']);
            }
        }
        
        if (!empty($first_method) && ($simple_shipping_methods_hide || ($simple_shipping_view_autoselect_first && $this->data['checked_code'] == ''))) {
            $this->data['shipping_method'] = $first_method;
        }
        
        if (isset($this->data['shipping_method'])) {
            setcookie('shipping_method', $this->data['shipping_method']['code'], time() + 60 * 60 * 24 * 30);
        }
        
        $this->data['code'] = !empty($this->data['shipping_method']) ? $this->data['shipping_method']['code'] : '';                
        
        $this->simple->shipping_methods = $this->data['shipping_methods'];
        $this->simple->shipping_method = $this->data['shipping_method'];
        
        $this->data['simple_show_errors'] = !empty($this->request->post['simple_create_order']) || (!empty($this->request->post['simple_step_next']) && !empty($this->request->post['simple_step']) && $this->request->post['simple_step'] == 'simplecheckout_shipping');
        
        $this->validate();
        
        $this->save_to_session();
        
        $this->data['text_checkout_shipping_method'] = $this->language->get('text_checkout_shipping_method');
        $this->data['text_shipping_address'] = $this->language->get('text_shipping_address');
        $this->data['error_no_shipping'] = sprintf($this->language->get('error_no_shipping'), $this->url->link('information/contact'));
                        
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/simplecheckout_shipping.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/checkout/simplecheckout_shipping.tpl';
        } else {
            $this->template = 'default/template/checkout/simplecheckout_shipping.tpl';
        }

        $this->response->setOutput($this->render());        
    }
    
    private function save_to_session() {
        $this->session->data['shipping_methods'] = $this->simple->shipping_methods;
        $this->session->data['shipping_method'] = $this->simple->shipping_method;
        
        if (empty($this->session->data['shipping_methods'])) {
            unset($this->session->data['shipping_method']);
        }
    }
    
    private function validate() {
        $error = false;
        
        if (empty($this->data['shipping_method'])) {
            $this->data['error_warning'] = $this->language->get('error_shipping');
            $error = true;
        } 
        
        if ($error) {
            $this->simple->add_error('shipping');
        }
        
    	return !$error;
    }
}
?>


код simplecheckout_payment.php

<?php  
/*
@author	Dmitriy Kubarev
@link	http://www.simpleopencart.com
@link	http://www.opencart.com/index.php?route=extension/extension/info&extension_id=4811
*/  

class ControllerCheckoutSimpleCheckoutPayment extends Controller {
    public function index() {
      
        $this->language->load('checkout/simplecheckout');

        $this->data['address_empty'] = false;
        
        $address = $this->simple->payment_address;
        $address_fields = $this->simple->payment_address_fields;

        $reload = explode(',', $this->config->get('simple_set_for_reload'));
        
        if ($address['country_id'] == '' && in_array('main_country_id', $reload) && !empty($address_fields['main_country_id']) && $address_fields['main_country_id']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['zone_id'] === '' && in_array('main_zone_id', $reload) && !empty($address_fields['main_zone_id']) && $address_fields['main_zone_id']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['city'] == '' && in_array('main_city', $reload) && !empty($address_fields['main_city']) && $address_fields['main_city']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        if ($address['postcode'] == '' && in_array('main_postcode', $reload) && !empty($address_fields['main_postcode']) && $address_fields['main_postcode']['type'] != 'hidden') {
            $this->data['address_empty'] = true;
        }
        
        $this->data['simple_debug'] = $this->config->get('simple_debug');
        $this->data['address'] = $address;
        
        $this->data['simple_payment_view_address_empty'] = $this->config->get('simple_payment_view_address_empty');
        
        $simple_payment_view_address_full = $this->config->get('simple_payment_view_address_full');
        $simple_payment_view_autoselect_first = $this->config->get('simple_payment_methods_hide') ? true : $this->config->get('simple_payment_view_autoselect_first');
        $simple_payment_methods_hide = $this->config->get('simple_payment_methods_hide');        
           
        $this->data['payment_methods'] = array();
      
        $total_data = array();                    
        $total = 0;
        $taxes = $this->cart->getTaxes();
        
        $this->load->model('setting/extension');
        
        $sort_order = array(); 
        
        $results = $this->model_setting_extension->getExtensions('total');
        
        foreach ($results as $key => $value) {
            $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
        }
        
        array_multisort($sort_order, SORT_ASC, $results);
        
        foreach ($results as $result) {
            if ($this->config->get($result['code'] . '_status')) {
                $this->load->model('total/' . $result['code']);
                $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
            }
        }

        $method_data = array();
        
        $this->load->model('setting/extension');
        
        $results = $this->model_setting_extension->getExtensions('payment');
        
        $simple_links = $this->cart->hasShipping() ? $this->config->get('simple_links') : array();
        
        $shipping_method_code = false;

        if (!$this->config->get('simple_childs_payment_first')) {
            $shipping_method = $this->simple->shipping_method;
            
            $shipping_method_code = !empty($shipping_method['code']) ? $shipping_method['code'] : false;
            $shipping_method_code = $shipping_method_code ? explode('.',$shipping_method_code) : false;
            $shipping_method_code = count($shipping_method_code) == 2 ? $shipping_method_code : false;
        }
        
        if ($this->customer->isLogged()) {
            $customer_group_id = $this->customer->getCustomerGroupId();
        } else {
            $customer_group_id = $this->config->get('config_customer_group_id');
        }
  
        if ($this->config->get('simple_customer_view_customer_type')) {
            $customer_groups = $this->simple->get_customer_groups();
        
            if (isset($this->request->post['customer_group_id']) && array_key_exists($this->request->post['customer_group_id'], $customer_groups)) {
                $customer_group_id = $this->request->post['customer_group_id'];
            }
        } 
    
        $filter_methods = array();
        $simple_group_payment = $this->config->get('simple_group_payment');
        if (!empty($simple_group_payment[$customer_group_id])) {
            $filter_methods = explode(',', $simple_group_payment[$customer_group_id]);
        }

        $simple_payment_titles = $this->config->get('simple_payment_titles');

        $version = $this->simple->opencart_version;

        $cart_has_recurring = 0;

        if ($version >= 156) {
            $cart_has_recurring = $this->cart->hasRecurringProducts();
        }
        
        foreach ($results as $result) {
            $show_module = true;

            if ($this->data['address_empty'] && !empty($simple_payment_view_address_full[$result['code']])) {
                $show_module = false;
            } 

            if (is_array($filter_methods) && !empty($filter_methods)) {
                if (in_array($result['code'], $filter_methods)) {
                    $show_module = true;
                } else {
                    $show_module = false;
                }
            }
            
            if ($this->config->get($result['code'] . '_status') && $show_module) {
                
                $for_shipping_methods = array();
                if (!$this->config->get('simple_childs_payment_first') && !empty($simple_links[$result['code']])) {
                    $for_shipping_methods = explode(",",$simple_links[$result['code']]);
                }
                
                if (empty($for_shipping_methods) || ($shipping_method_code && (in_array($shipping_method_code[0], $for_shipping_methods) || in_array($shipping_method_code[0].'.'.$shipping_method_code[1], $for_shipping_methods)))) {
                    $this->load->model('payment/' . $result['code']);
                    
                    $method = $this->{'model_payment_' . $result['code']}->getMethod($address, $total); 
                    
                    if ($method) {
                        $method['description'] = !empty($simple_payment_titles[$result['code']]['use_description']) && !empty($simple_payment_titles[$result['code']]['description'][$this->simple->get_language_code()]) ? html_entity_decode($simple_payment_titles[$result['code']]['description'][$this->simple->get_language_code()]) : (!empty($method['description']) ? $method['description'] : '');
                        
                        if ($cart_has_recurring > 0) {
                            if (method_exists($this->{'model_payment_' . $result['code']}, 'recurringPayments')) {
                                if($this->{'model_payment_' . $result['code']}->recurringPayments() == true){
                                    $method_data[$result['code']] = $method;
                                }
                            }
                        } else {
                            $method_data[$result['code']] = $method;
                        }
                    }
                }
            }
        }
                     
        $sort_order = array(); 
      
        foreach ($method_data as $key => $value) {
            $sort_order[$key] = $value['sort_order'];
        }

        array_multisort($sort_order, SORT_ASC, $method_data);            
        
        $this->data['payment_methods'] = $method_data;    
        $this->data['payment_method'] = null;
        $this->data['error_warning'] = '';

        $this->data['checked_code'] = '';

        $this->data['disabled_methods'] = array();
        
        if (!empty($simple_payment_titles)) {
            foreach ($simple_payment_titles as $key => $value) {
                if (!array_key_exists($key, $this->data['payment_methods']) && !empty($value['show']) && ($value['show'] == 1 || ($value['show'] == 2 && $this->data['address_empty']))) {
                    $this->data['disabled_methods'][$key]['title'] = !empty($value['title'][$this->simple->get_language_code()]) ? html_entity_decode($value['title'][$this->simple->get_language_code()]) : $key;
                    $this->data['disabled_methods'][$key]['description'] = !empty($value['description'][$this->simple->get_language_code()]) ? html_entity_decode($value['description'][$this->simple->get_language_code()]) : '';
                }
            }
        }

        if ($this->request->server['REQUEST_METHOD'] == 'POST' && !empty($this->request->post['payment_method_checked']) && !empty($this->data['payment_methods'][$this->request->post['payment_method_checked']])) {
            $this->data['checked_code'] = $this->request->post['payment_method_checked'];
        }
        
        if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['payment_method']) && !empty($this->data['payment_methods'][$this->request->post['payment_method']])) {
            $this->data['payment_method'] = $this->data['payment_methods'][$this->request->post['payment_method']];
            
            if (isset($this->request->post['payment_method_current']) && $this->request->post['payment_method_current'] != $this->request->post['payment_method']) {
                $this->data['checked_code'] = $this->request->post['payment_method'];
            }
        }
        
        if ($this->request->server['REQUEST_METHOD'] == 'GET' && isset($this->request->cookie['payment_method']) && !empty($this->data['payment_methods'][$this->request->cookie['payment_method']])) {
            $this->data['payment_method'] = $this->data['payment_methods'][$this->request->cookie['payment_method']];
        }
        
        if (!empty($this->data['payment_methods'])) {
            $first_method = reset($this->data['payment_methods']);
        }
        
        if (!empty($first_method) && ($simple_payment_methods_hide || ($simple_payment_view_autoselect_first && $this->data['checked_code'] == ''))) {
            $this->data['payment_method'] = $first_method;
        }
        
        if (isset($this->data['payment_method'])) {
            setcookie('payment_method', $this->data['payment_method']['code'], time() + 60 * 60 * 24 * 30);
        }
        
        $this->data['code'] = !empty($this->data['payment_method']) ? $this->data['payment_method']['code'] : '';                
        
        $this->simple->payment_methods = $this->data['payment_methods'];
        $this->simple->payment_method = $this->data['payment_method'];
        
        $this->data['simple_show_errors'] = !empty($this->request->post['simple_create_order']) || (!empty($this->request->post['simple_step_next']) && !empty($this->request->post['simple_step']) && $this->request->post['simple_step'] == 'simplecheckout_payment');
        
        $this->validate();
        
        $this->save_to_session();
        
        $this->data['text_payment_address'] = $this->language->get('text_payment_address');
        $this->data['error_no_payment'] = sprintf($this->language->get('error_no_payment'), $this->url->link('information/contact'));
        $this->data['text_checkout_payment_method'] = $this->language->get('text_checkout_payment_method');        
        
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/simplecheckout_payment.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/checkout/simplecheckout_payment.tpl';
        } else {
            $this->template = 'default/template/checkout/simplecheckout_payment.tpl';
        }
                
        $this->response->setOutput($this->render());
    }
    
    private function save_to_session() {
        $this->session->data['payment_methods'] = $this->simple->payment_methods;
        $this->session->data['payment_method'] = $this->simple->payment_method;
        
        if (empty($this->session->data['payment_methods'])) {
            unset($this->session->data['payment_method']);
        }
    }
    
    private function validate() {
        $error = false;
        
        if (empty($this->data['payment_method'])) {
  			$this->data['error_warning'] = $this->language->get('error_payment');
            $error = true;
        }
        
        if ($error) {
            $this->simple->add_error('payment');
        }
        
    	return !$error;
    }
}
?>



Благодарен за любую помощь

Надіслати
Поділитися на інших сайтах


  • 2 years later...

Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.