Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

ошибка в оформлении заказа


Recommended Posts

Добрый гдень, всем!  Есть ошибка на сайте в поле адрес досивки Notice: Error: Could not load template /home/ij399786/autokindercenter.com.ua/www/catalog/view/theme/checkout/shipping_address! in /home/ij399786/autokindercenter.com.ua/www/system/storage/modification/system/engine/loader.php on line 86
Понимаю, что этот вопрос мог обсуждаться, но я новичок и не знаю как исправить ошибку 
ВОТ ФАЙЛ
 

<?php
final class Loader {
    private $registry;

    public function __construct($registry) {
        $this->registry = $registry;
    }

    public function controller($route, $data = array()) {
        // $this->event->trigger('pre.controller.' . $route, $data);

        $parts = explode('/', str_replace('../', '', (string)$route));

        // Break apart the route
        while ($parts) {
            $file = DIR_APPLICATION . 'controller/' . implode('/', $parts) . '.php';
            $class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', implode('/', $parts));

            if (is_file($file)) {
                include_once(modification($file));

                break;
            } else {
                $method = array_pop($parts);
            }
        }

        $controller = new $class($this->registry);

        if (!isset($method)) {
            $method = 'index';
        }

        // Stop any magical methods being called
        if (substr($method, 0, 2) == '__') {
            return false;
        }

        $output = '';

        if (is_callable(array($controller, $method))) {
            $output = call_user_func(array($controller, $method), $data);
        }

        // $this->event->trigger('post.controller.' . $route, $output);

        return $output;
    }

    public function model($model, $data = array()) {
        // $this->event->trigger('pre.model.' . str_replace('/', '.', (string)$model), $data);

        $model = str_replace('../', '', (string)$model);

        $file = DIR_APPLICATION . 'model/' . $model . '.php';
        $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $model);

        if (file_exists($file)) {
            include_once(modification($file));

            $this->registry->set('model_' . str_replace('/', '_', $model), new $class($this->registry));
        } else {
            trigger_error('Error: Could not load model ' . $file . '!');
            exit();
        }

        // $this->event->trigger('post.model.' . str_replace('/', '.', (string)$model), $output);
    }

    public function view($template, $data = array()) {
        // $this->event->trigger('pre.view.' . str_replace('/', '.', $template), $data);

        $file = DIR_TEMPLATE . $template;

        if (file_exists($file)) {
            extract($data);

            ob_start();

            require(modification($file));

            $output = ob_get_contents();

            ob_end_clean();
        } else {
            trigger_error('Error: Could not load template ' . $file . '!');     // Сгдесь ошибка
            exit();
        }

        // $this->event->trigger('post.view.' . str_replace('/', '.', $template), $output);

        return $output;
    }

    public function helper($helper) {
        $file = DIR_SYSTEM . 'helper/' . str_replace('../', '', (string)$helper) . '.php';

        if (file_exists($file)) {
            include_once(modification($file));
        } else {
            trigger_error('Error: Could not load helper ' . $file . '!');
            exit();
        }
    }

    public function config($config) {
        $this->registry->get('config')->load($config);
    }

    public function language($language) {
        return $this->registry->get('language')->load($language);
    }
}

 

 

/home/ij399786/autokindercenter.com.ua/www/catalog/view/theme/checkout/shipping_address  -  не верный путь

Link to comment
Share on other sites


Вам говорит, что у не может найти файл /home/ij399786/autokindercenter.com.ua/www/catalog/view/theme/checkout/shipping_address!

Обратите внимание, что пропуещёна одна директория /home/ij399786/autokindercenter.com.ua/www/catalog/view/theme/default/checkout/shipping_address!

Edited by neonox
Link to comment
Share on other sites


7 минут назад, Matveevns сказал:

/home/ij399786/autokindercenter.com.ua/www/catalog/view/theme/checkout/shipping_address  -  не верный путь

Ошибка говорит что файл шаблона по данному пути отсутствует. Смотрите что у вас творится в контролере catalog/controller/checkout/shipping_method.php, им ггде $this->response->setOutput. Там должен быть указан путь к шаблону, у вас возможно пропуещёна директория.. Должно быть примерно ик: $this->config->get('config_template') . '/template/checkout/shipping_method.tpl. Можете сверить с исходным кодом вашей версии движка на гитхабе. Если все нормально, то проверьте папку system/storage/modification/(путь к контроллеру) и сравните данную секцию кода с исходниками.. Модификатор какой-то может что-то испортил.. Если ик - ищите модификатор и редактируйте путь.

Link to comment
Share on other sites

Файл - catalog/controller/checkout/shipping_method.php 

 

 

<?php
// *    @source        See SOURCE.txt for source and other copyright.
// *    @license    GNU General Public License version 3; see LICENSE.txt

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

        if (isset($this->session->data['shipping_address'])) {
            // Shipping Methods
            $method_data = array();

            $this->load->model('setting/extension');

            $results = $this->model_setting_extension->getExtensions('shipping');

            foreach ($results as $result) {
                if ($this->config->get('shipping_' . $result['code'] . '_status')) {
                    $this->load->model('extension/shipping/' . $result['code']);

                    $quote = $this->{'model_extension_shipping_' . $result['code']}->getQuote($this->session->data['shipping_address']);

                    if ($quote) {
                        $method_data[$result['code']] = array(
                            'title'      => $quote['title'],
                            'quote'      => $quote['quote'],
                            'sort_order' => $quote['sort_order'],
                            'error'      => $quote['error']
                        );
                    }
                }
            }

            $sort_order = array();

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

            array_multisort($sort_order, SORT_ASC, $method_data);

            $this->session->data['shipping_methods'] = $method_data;
        }

        if (empty($this->session->data['shipping_methods'])) {
            $data['error_warning'] = sprintf($this->language->get('error_no_shipping'), $this->url->link('information/contact'));
        } else {
            $data['error_warning'] = '';
        }

        if (isset($this->session->data['shipping_methods'])) {
            $data['shipping_methods'] = $this->session->data['shipping_methods'];
        } else {
            $data['shipping_methods'] = array();
        }

        if (isset($this->session->data['shipping_method']['code'])) {
            $data['code'] = $this->session->data['shipping_method']['code'];
        } else {
            $data['code'] = '';
        }

        if (isset($this->session->data['comment'])) {
            $data['comment'] = $this->session->data['comment'];
        } else {
            $data['comment'] = '';
        }

        $this->response->setOutput($this->load->view('/default/template/checkout/shipping_method', $data));   // сюда всивляю ?? 
    }

    public function save() {
        $this->load->language('checkout/checkout');

        $json = array();

        // Validate if shipping is required. If not the customer should not have reached this page.
        if (!$this->cart->hasShipping()) {
            $json['redirect'] = $this->url->link('checkout/checkout', '', true);
        }

        // Validate if shipping address has been set.
        if (!isset($this->session->data['shipping_address'])) {
            $json['redirect'] = $this->url->link('checkout/checkout', '', true);
        }

        // Validate cart has products and has stock.
        if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
            $json['redirect'] = $this->url->link('checkout/cart');
        }

        // Validate minimum quantity requirements.
        $products = $this->cart->getProducts();

        foreach ($products as $product) {
            $product_total = 0;

            foreach ($products as $product_2) {
                if ($product_2['product_id'] == $product['product_id']) {
                    $product_total += $product_2['quantity'];
                }
            }

            if ($product['minimum'] > $product_total) {
                $json['redirect'] = $this->url->link('checkout/cart');

                break;
            }
        }

        if (!isset($this->request->post['shipping_method'])) {
            $json['error']['warning'] = $this->language->get('error_shipping');
        } else {
            $shipping = explode('.', $this->request->post['shipping_method']);

            if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
                $json['error']['warning'] = $this->language->get('error_shipping');
            }
        }

        if (!$json) {
            $this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];

            $this->session->data['comment'] = strip_tags($this->request->post['comment']);
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }
}

 

 

 

В обещём что то не ик, ошибка осилась

И без /default тоже не рилииет

Link to comment
Share on other sites


1 час назад, Matveevns сказал:

$this->load->model('extension/shipping/' . $result['code']);

 

7 минут назад, Matveevns сказал:

OpenCart  2.1.0.2

тогда у вас какая-то каша из разных версий

Link to comment
Share on other sites


В обещём скачала версию 2.1 заново, залила на хостинг, затем залила бекапы сайи на них
подшаманила с настройками сайи (конфиг, .htaccess) и оформление заказа рилииет, 

Спасипотому что, что помогли!!!

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.