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

Ошибка в php


kuripka2222
 Share

Recommended Posts

Здравствуйте код в файле php вызывает ошибку на сайте, подскажите пожалуйси я правильно пишу путь 

Циии

Warning: file_exists() expects exactly 1 parameter, 2 given in /home/k/kuripka/***.ru/public_html/catalog/controller/ajax/index.php on line 36


 

 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/ajax/index', $data)) {
 $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/ajax/index', $data));
 } else {
 $this->response->setOutput($this->load->view('default/template/ajax/index', $data));
 }

 

Link to comment
Share on other sites


25 минут назад, nikifalex сказал:

уберите , data из первой строки

Спасипотому что, а не подскажете ггде в когде ошибка еещё ?  Страница на сайте недоступна 

 

<?php
// catalog/controller/ajax/index.php
class ControllerAjaxIndex extends Controller {
  public function index() {
 $this->load->language('ajax/index');
 $this->load->model('catalog/product');
 
 $this->document->setTitle($this->language->get('heading_title'));
 
 // загружаем все товары
 $products = $this->model_catalog_product->getProducts();
 $data['products'] = $products;
 
 $data['breadcrumbs'] = array();
 
 $data['breadcrumbs'][] = array(
 'href' => $this->url->link('common/home'),
 'text' => $this->language->get('text_home')
 );
 
 $data['breadcrumbs'][] = array(
 'href' => $this->url->link('ajax/index'),
 'text' => $this->language->get('heading_title')
 );
 
 $data['heading_title'] = $this->language->get('heading_title');
 $data['text_product_dropdown_label'] = $this->language->get('text_product_dropdown_label');
 
 
 
 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/ajax/index')) {
 $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/ajax/index', $data));
 } else {
 $this->response->setOutput($this->load->view('default/template/ajax/index', $data));
 }
  }
 
  // метод вызова ajax
  public function ajaxGetProduct() {
 if (isset($this->request->get['product_id'])) {
 $product_id = (int) $this->request->get['product_id'];
 
 if ($product_id > 0) {
 // загружаем опрегделенный товар, запрошенный в ajax
 $this->load->model('catalog/product');
 $product = $this->model_catalog_product->getProduct($product_id);
 $data['product'] = $product;
 
 // подгоивливаем превью изображения
 $this->load->model('tool/image');
 if ($product['image']) {
 $data['thumb'] = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
 }
 
 // форматируем этону
 $data['price'] = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
 
 $this->load->language('product/product');
 $data['text_manufacturer'] = $this->language->get('text_manufacturer');
 $data['text_model'] = $this->language->get('text_model');
 $data['text_note'] = $this->language->get('text_note');
 $data['tab_description'] = $this->language->get('tab_description');
 
 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/ajax/product')) {
 $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/ajax/product', $data));
 } else {
 $this->response->setOutput($this->load->view('default/template/ajax/product', $data));
 }
 }
 }
  }
  
  
  $data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');
 
}

 

Link to comment
Share on other sites


Путь до шаблона неполный.

Пример:

Спойлер

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/category.tpl', $data));
            } else {
                $this->response->setOutput($this->load->view('default/template/product/category.tpl', $data));
            }

 

И что вы забыли в ветке 3.0 опенкарт?

 

Даже этот код не в прегделах функции.

Спойлер
  $data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');

 

Link to comment
Share on other sites

14 часов назад, buslikdrev сказал:

Путь до шаблона неполный.

Пример:

  Скрыть контент

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {
                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/category.tpl', $data));
            } else {
                $this->response->setOutput($this->load->view('default/template/product/category.tpl', $data));
            }

 

И что вы забыли в ветке 3.0 опенкарт?

 

Даже этот код не в прегделах функции.

  Скрыть контент

  $data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');

 

Мне этот код нужен как раз для Opencart 3. Я хочу вывести пользовательскую страницу с ajax подгрузкой всех товаров, но ггде-то еещё ошибка в когде 

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

×
×
  • 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.