Перейти к содержанию

Рекомендуемые сообщения

Переношу модуль со старого опенкарта 1,5,6,4,1 на новый 2,3,0,2
Поменял все как в статьи http://sv2109.com/en/node/207 модуль появился в админке при включении Internal Server Error , но после перезагрузки страницы показывает что включен, после чего иду редактировать и выдает ошибку 500

в логах:

2017/12/05 16:40:28 [warn] 24749#24749: *29649 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000111, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0"
2017/12/05 16:40:36 [warn] 24749#24749: *29649 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000112, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=extension/installer/upload&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=extension/installer&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0"
2017/12/05 16:41:00 [warn] 24749#24749: *29653 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000115, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0"
2017/12/05 16:41:04 [warn] 24749#24749: *29653 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000116, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=extension/installer/upload&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=extension/installer&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0"
2017/12/05 16:44:07 [warn] 24749#24749: *31019 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000122, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=setting/setting&token=z1Fz1SpNsalTSRlanBQQKVazt0MXmnP0"
[Tue Dec 05 18:18:32.896077 2017] [cgi:error] [pid 27984] [client 194.44.17.85:34095] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=yaThWVFodbI1oUkncpj4frem9iTTi9S4
[Tue Dec 05 18:18:47.058537 2017] [cgi:error] [pid 28290] [client 194.44.17.85:34249] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=yaThWVFodbI1oUkncpj4frem9iTTi9S4
[Tue Dec 05 18:22:18.739379 2017] [cgi:error] [pid 31859] [client 194.44.17.85:36110] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=yaThWVFodbI1oUkncpj4frem9iTTi9S4
[Tue Dec 05 18:23:19.133255 2017] [cgi:error] [pid 744] [client 194.44.17.85:36783] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:23:39.258690 2017] [cgi:error] [pid 1461] [client 194.44.17.85:36975] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:24:07.626310 2017] [cgi:error] [pid 1757] [client 194.44.17.85:37162] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:25:17.161041 2017] [cgi:error] [pid 2286] [client 194.44.17.85:37552] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:25:28.913475 2017] [cgi:error] [pid 2335] [client 194.44.17.85:37605] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:25:45.592339 2017] [cgi:error] [pid 2680] [client 194.44.17.85:37724] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
[Tue Dec 05 18:30:55.378432 2017] [cgi:error] [pid 10697] [client 194.44.17.85:39850] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw
2017/12/05 18:36:44 [warn] 32729#32729: *53785 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000284, client: 194.44.17.85, server: colordom.com, request: "POST /admin/index.php?route=extension/module/themecontrol&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=extension/module/themecontrol&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw"
[Tue Dec 05 18:39:10.751335 2017] [cgi:error] [pid 19135] [client 194.44.17.85:45241] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module
[Tue Dec 05 18:39:12.047013 2017] [cgi:error] [pid 19160] [client 194.44.17.85:45264] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85
[Tue Dec 05 18:39:12.621171 2017] [cgi:error] [pid 19179] [client 194.44.17.85:45278] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85
[Tue Dec 05 18:39:13.134334 2017] [cgi:error] [pid 19186] [client 194.44.17.85:45289] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85
[Tue Dec 05 18:39:18.442083 2017] [cgi:error] [pid 19274] [client 194.44.17.85:45357] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module
[Tue Dec 05 18:39:24.178523 2017] [cgi:error] [pid 19348] [client 194.44.17.85:45427] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module
[Tue Dec 05 18:39:26.652511 2017] [cgi:error] [pid 19388] [client 194.44.17.85:45463] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module
[Tue Dec 05 18:39:31.542066 2017] [cgi:error] [pid 19464] [client 194.44.17.85:45536] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module
[Tue Dec 05 18:47:50.379431 2017] [cgi:error] [pid 27150] [client 194.44.17.85:50942] AH01215: PHP Fatal error:  Call to undefined method ControllerModuleGlasses::render() in /var/www/colordom/data/www/colordom.com/admin/controller/module/glasses.php on line 85, referer: http://colordom.com/admin/index.php?route=extension/extension&token=bZZKUOhgoeHm8dUnkGmd9F1ham0Hb0Lw&type=module

Строка это $this->response->setOutput($this->render());

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Опенкарт 2.0 - это не опенкарт 2.3
Скиньте исходный код модуля controller до и после.

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
14 минут назад, buslikdrev сказал:

Опенкарт 2.0 - это не опенкарт 2.3
Скиньте исходный код модуля controller до и после.

 

 

Исходный

admin/controller

<?php
class ControllerModuleGlasses extends Controller {
	private $error = array(); 

	public function index() {   
		$this->language->load('module/glasses');

		$this->document->setTitle($this->language->get('heading_title'));

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

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('glasses', $this->request->post);		

			$this->session->data['success'] = $this->language->get('text_success');

			$this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
		}

		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['text_enabled'] = $this->language->get('text_enabled');
		$this->data['text_disabled'] = $this->language->get('text_disabled');
		$this->data['text_content_top'] = $this->language->get('text_content_top');
		$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');		
		$this->data['text_column_left'] = $this->language->get('text_column_left');
		$this->data['text_column_right'] = $this->language->get('text_column_right');

		$this->data['entry_layout'] = $this->language->get('entry_layout');
		$this->data['entry_position'] = $this->language->get('entry_position');
		$this->data['entry_status'] = $this->language->get('entry_status');
		$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');

		$this->data['button_save'] = $this->language->get('button_save');
		$this->data['button_cancel'] = $this->language->get('button_cancel');
		$this->data['button_add_module'] = $this->language->get('button_add_module');
		$this->data['button_remove'] = $this->language->get('button_remove');

		if (isset($this->error['warning'])) {
			$this->data['error_warning'] = $this->error['warning'];
		} else {
			$this->data['error_warning'] = '';
		}

		$this->data['breadcrumbs'] = array();

		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => false
		);

		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_module'),
			'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => ' :: '
		);

		$this->data['breadcrumbs'][] = array(
			'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('module/glasses', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => ' :: '
		);

		$this->data['action'] = $this->url->link('module/glasses', 'token=' . $this->session->data['token'], 'SSL');

		$this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

		$this->data['modules'] = array();

		if (isset($this->request->post['glasses_module'])) {
			$this->data['modules'] = $this->request->post['glasses_module'];
		} elseif ($this->config->get('glasses_module')) { 
			$this->data['modules'] = $this->config->get('glasses_module');
		}	

		$this->load->model('design/layout');

		$this->data['layouts'] = $this->model_design_layout->getLayouts();

		$this->template = 'module/glasses.tpl';
		$this->children = array(
			'common/header',
			'common/footer'
		);

		$this->response->setOutput($this->render());
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'module/glasses')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		if (!$this->error) {
			return true;
		} else {
			return false;
		}	
	}
}
?>

catalog/controller

<?php  
class ControllerModuleGlasses extends Controller {
	protected function index($setting) {

		$this->language->load('module/glasses');
		$this->load->model('tool/image');	

		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['text_mark'] = $this->language->get('text_mark');
		$this->data['text_model'] = $this->language->get('text_model');
		$this->data['text_kuzov'] = $this->language->get('text_kuzov');
		$this->data['text_year'] = $this->language->get('text_year');
		$this->data['text_search'] = $this->language->get('text_search');
		$this->data['text_zap'] = $this->language->get('text_zap');
		$this->data['text_inst'] = $this->language->get('text_inst');
                
               $this->data['logged'] = $this->customer->isLogged();

		if (isset($this->request->get['path'])) {
			$parts = explode('_', (string)$this->request->get['path']);
		} else {
			$parts = array();
		}

		if (isset($parts[0])) {
			$this->data['category_id'] = $parts[0];
		} else {
			$this->data['category_id'] = 0;
		}

		if (isset($parts[1])) {
			$this->data['child_id'] = $parts[1];
		} else {
			$this->data['child_id'] = 0;
		}

		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$this->data['categories'] = array();

		$categories = $this->model_catalog_category->getCategories(0);

		foreach ($categories as $category) {
			//$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category['category_id']));

			$children_data = array();

			$children = $this->model_catalog_category->getCategories($category['category_id']);

			foreach ($children as $child) {
				$data = array(
					'filter_category_id'  => $child['category_id'],
					'filter_sub_category' => true
				);

				//$product_total = $this->model_catalog_product->getTotalProducts($data);
			

				$children_data[] = array(
					'category_id' => $child['category_id'],
					'name'        => $child['name'],
					'parent_id' => $category['category_id']
					//'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
				);		
			}



			$this->data['categories'][] = array(
				'category_id' => $category['category_id'],
				'image' 	  => $image = $this->model_tool_image->resize($category['image'], 100, 100),
				'name'        => $category['name'],
				'top'		  => $category['top'],
				'children'    => $children_data
			);	
		}

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/glasses.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/glasses.tpl';
		} else {
			$this->template = 'default/template/module/glasses.tpl';
		}

		$this->render();
	}

	public function getmodel() {
		$json = array();
		$this->load->model('catalog/category');

		(int)$id_cat = $this->request->post['cat_id'];

		$categories = $this->model_catalog_category->getCategories($id_cat);
		$leng = count($categories);

		foreach ($categories as $category) {
			$json[] = array(
				'category_id' => $category['category_id'],
				'name_'        => $category['name'],
				'length' => $leng
			);	
		}

		//var_dump($json);

		$this->response->setOutput(json_encode($json));
		
	}

	public function last() {
		$this->load->model('catalog/category');
		$this->load->model('catalog/product');
		$this->data['categories'] = array();



		if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }

        $categories = $this->model_catalog_category->getCategories($category_id);
		
		//$leng = count($categories);


		foreach ($categories as $category) {
			$ou = 0;
			$dat = array(
				'filter_category_id' => $category['category_id']
			);

			$res = $this->model_catalog_product->getProducts($dat);
			if ($res) {
				$ou = 1;
			} 

			$this->data['categories'][] = array(
				'id' => $category['category_id'],
				'name'        => $category['name'],
				'count_p' => $ou
			);	
		}

		//var_dump($json);


		// Get template
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/last_glass.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/last_glass.tpl';
        } else {
            $this->template = 'default/template/module/last_glass.tpl';
        }

        $this->response->setOutput($this->render());
	}

	public function get_parts() {

		$this->language->load('module/glasses');
		$this->load->model('sale/customer_group');
		$this->load->model('catalog/product');
		$this->load->model('tool/image');
		$this->load->model('catalog/category');

		$this->data['text_evro'] = $this->language->get('text_evro');
		$this->data['text_opis'] = $this->language->get('text_opis');
		$this->data['text_manuf'] = $this->language->get('text_manuf');
		$this->data['text_price'] = $this->language->get('text_price');
		$this->data['text_att'] = $this->language->get('text_att');
		$this->data['heading_title'] = $this->language->get('heading_title');
		$this->data['button_cart'] = $this->language->get('button_cart');
		$this->data['text_car'] = $this->language->get('text_car');

		if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }


		$this->data['products'] = array();
		
		$data = array(
				'filter_category_id' => $category_id
		);

					// Set the last category breadcrumb		
			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}
			
			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}


					$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}	

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

		$results = $this->model_catalog_product->getProducts($data);
		$thumb = '';

		if ($this->customer->isLogged()) {
			$customer_group_info = $this->model_sale_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
		}

		if (isset($customer_group_info['customer_group_sales']) && $customer_group_info['customer_group_sales']) {
			$sales = $customer_group_info['customer_group_sales'];
		}

		foreach ($results as $result) {

			$parcat = $this->model_catalog_product->getProductCategoryPath($result['product_id']);
			$showp = $this->model_catalog_category->getCategory($parcat[0]);

			if ($result['image']) {
				if ($this->customer->isLogged()) {
					$image = $this->model_tool_image->resize($result['image'], 450, 450);
				}else{
					$image = $this->model_tool_image->resize($this->chekCat($showp['name']), 150, 150);
				}
			} else {
				$image = false;
			}

			if ($this->customer->getCustomerGroupId() == 2 && $sales) {
				if ($result['jan']) {
					$result['price'] = $result['jan'] - ($result['jan']*($sales/100));
				} else{
					$result['price'] = $result['price'] - ($result['price']*($sales/100));
				}
				
			} else{
				if ($result['jan']) {
					$result['price'] = $result['jan'];
				}
			}

			
						
			if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
				$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$price = false;
			}
					
			if ((float)$result['special']) {
				$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$special = false;
			}
			
			if ($this->config->get('config_review_status')) {
				$rating = $result['rating'];
			} else {
				$rating = false;
			}

			$this->load->model('catalog/manufacturer');

			$stickers = $this->getStickers($result['product_id']) ;
			$ids = (int)$result['manufacturer_id'];

			if ($result['manufacturer_id']) {
				$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($ids);

			} else{
				$manufacturer_info = 0;
				$thumb = '';
			}

			if ($manufacturer_info) {
				if ($manufacturer_info['image']) {
				$thumb = $this->model_tool_image->resize($manufacturer_info['image'], '130', '130');
				} else {
				$thumb = '';
				}
			}
			 
			$this->data['products'][] = array(
				'product_id' => $result['product_id'],
				'model'		 => $result['model'],
				'thumb'   	 => $image,
				'name'    	 => $result['name'],
				'manufacturer' => $result['manufacturer'],
				'manuf_img' => $thumb,
				'description' =>  $description = trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))),
				'price'   	 => $price,
				'special' 	 => $special,
				'rating'     => $rating,
				'sticker'    => $stickers,
				'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
				'href'        => $this->url->link('product/product', 'path=' . '&product_id=' . $result['product_id'] . $url)
			);
		}

		$this->data['logged'] = $this->customer->isLogged();

		// Get template
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/glass_parts.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/glass_parts.tpl';
        } else {
            $this->template = 'default/template/module/glass_parts.tpl';
        }

        $this->response->setOutput($this->render());
	}

	private function getStickers($product_id) {
	
 	$stickers = $this->model_catalog_product->getProductStickerbyProductId($product_id) ;	
		
		if (!$stickers) {
			return;
		}
		
		$this->data['stickers'] = array();
		
		foreach ($stickers as $sticker) {
			$this->data['stickers'][] = array(
				'position' => $sticker['position'],
				'image'    => HTTP_SERVER . 'image/' . $sticker['image']
			);		
		}

	
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/stickers.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/product/stickers.tpl';
		} else {
			$this->template = 'default/template/product/stickers.tpl';
		}
	
		return $this->render();
	
	}

		private function chekCat($name){
		$name = trim($name);
		switch ($name) {
			case 'A':
				return 'data/zag/A.png';
				break;
			case 'B':
				return 'data/zag/B.png';
				break;
			case 'AL':
				return 'no_image.jpg';
				break;
			case 'AR':
				return 'no_image.jpg';
				break;
			case 'LFQ':
				return 'no_image.jpg';
				break;
			case 'LFV':
				return 'no_image.jpg';
				break;
			case 'LFD':
				return 'data/zag/LFD.png';
				break;
			case 'LMQ':
				return 'no_image.jpg';
				break;
			case 'LRD':
				return 'data/zag/LRD.png';
				break;
			case 'LRV':
				return 'no_image.jpg';
				break;
			case 'LRQ':
				return 'data/zag/LRQ.png';
				break;
			case 'L1P':
				return 'no_image.jpg';
				break;
			case 'L2P':
				return 'no_image.jpg';
				break;
			case 'L3P':
				return 'no_image.jpg';
				break;
			case 'RG':
				return 'no_image.jpg';
				break;
			case 'RFQ':
				return 'no_image.jpg';
				break;
			case 'RFV':
				return 'no_image.jpg';
				break;
			case 'RFD':
				return 'data/zag/RFD.png';
				break;
			case 'RMQ':
				return 'no_image.jpg';
				break;
			case 'RRD':
				return 'data/zag/RRD.png';
				break;
			case 'RRV':
				return 'no_image.jpg';
				break;
			case 'RRQ':
				return 'data/zag/RRQ.png';
				break;
			case 'R1P':
				return 'no_image.jpg';
				break;
			case 'R2P':
				return 'no_image.jpg';
				break;
			case 'R3P':
				return 'no_image.jpg';
				break;
			case 'BL':
				return 'no_image.jpg';
				break;
			case 'BR':
				return 'no_image.jpg';
				break;
			default:
				return 'no_image.jpg';
				break;
		}
	}



}
?>

После

admin/controller

<?php
class ControllerModuleGlasses extends Controller {
	private $error = array(); 

	public function index() {   
		$this->language->load('module/glasses');

		$this->document->setTitle($this->language->get('heading_title'));

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

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('glasses', $this->request->post);		

			$this->session->data['success'] = $this->language->get('text_success');

			$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
		}

		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_enabled'] = $this->language->get('text_enabled');
		$data['text_disabled'] = $this->language->get('text_disabled');
		$data['text_content_top'] = $this->language->get('text_content_top');
		$data['text_content_bottom'] = $this->language->get('text_content_bottom');		
		$data['text_column_left'] = $this->language->get('text_column_left');
		$data['text_column_right'] = $this->language->get('text_column_right');

		$data['entry_layout'] = $this->language->get('entry_layout');
		$data['entry_position'] = $this->language->get('entry_position');
		$data['entry_status'] = $this->language->get('entry_status');
		$data['entry_sort_order'] = $this->language->get('entry_sort_order');

		$data['button_save'] = $this->language->get('button_save');
		$data['button_cancel'] = $this->language->get('button_cancel');
		$data['button_add_module'] = $this->language->get('button_add_module');
		$data['button_remove'] = $this->language->get('button_remove');

		if (isset($this->error['warning'])) {
			$data['error_warning'] = $this->error['warning'];
		} else {
			$data['error_warning'] = '';
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => false
		);

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('text_module'),
			'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => ' :: '
		);

		$data['breadcrumbs'][] = array(
			'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('module/glasses', 'token=' . $this->session->data['token'], 'SSL'),
			'separator' => ' :: '
		);

		$data['action'] = $this->url->link('module/glasses', 'token=' . $this->session->data['token'], 'SSL');

		$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

		$data['modules'] = array();

		if (isset($this->request->post['glasses_module'])) {
			$data['modules'] = $this->request->post['glasses_module'];
		} elseif ($this->config->get('glasses_module')) { 
			$data['modules'] = $this->config->get('glasses_module');
		}	

		$this->load->model('design/layout');

		$data['layouts'] = $this->model_design_layout->getLayouts();

		$this->response->setOutput($this->load->view( 'module/glasses.tpl'));
		$data['header'] = $this->load->controller('common/header');
		$data['footer'] = $this->load->controller('common/footer');

		$this->response->setOutput($this->render());
	}

	protected function validate() {
		if (!$this->user->hasPermission('modify', 'module/glasses')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}

		if (!$this->error) {
			return true;
		} else {
			return false;
		}	
		if (isset($this->request->post['module_name_status'])) {
  $data['featured_status'] = $this->request->post['module_name_status'];
} else {
  $data['featured_status'] = $this->config->get('module_name_status');
}
	}
}
?>

catalog/controller

<?php  
class ControllerModuleGlasses extends Controller {
	protected function index($setting) {

		$this->language->load('module/glasses');
		$this->load->model('tool/image');	

		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_mark'] = $this->language->get('text_mark');
		$data['text_model'] = $this->language->get('text_model');
		$data['text_kuzov'] = $this->language->get('text_kuzov');
		$data['text_year'] = $this->language->get('text_year');
		$data['text_search'] = $this->language->get('text_search');
		$data['text_zap'] = $this->language->get('text_zap');
		$data['text_inst'] = $this->language->get('text_inst');
                
               $data['logged'] = $this->customer->isLogged();

		if (isset($this->request->get['path'])) {
			$parts = explode('_', (string)$this->request->get['path']);
		} else {
			$parts = array();
		}

		if (isset($parts[0])) {
			$data['category_id'] = $parts[0];
		} else {
			$data['category_id'] = 0;
		}

		if (isset($parts[1])) {
			$data['child_id'] = $parts[1];
		} else {
			$data['child_id'] = 0;
		}

		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$data['categories'] = array();

		$categories = $this->model_catalog_category->getCategories(0);

		foreach ($categories as $category) {
			//$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category['category_id']));

			$children_data = array();

			$children = $this->model_catalog_category->getCategories($category['category_id']);

			foreach ($children as $child) {
				$data = array(
					'filter_category_id'  => $child['category_id'],
					'filter_sub_category' => true
				);

				//$product_total = $this->model_catalog_product->getTotalProducts($data);
			

				$children_data[] = array(
					'category_id' => $child['category_id'],
					'name'        => $child['name'],
					'parent_id' => $category['category_id']
					//'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])	
				);		
			}



			$data['categories'][] = array(
				'category_id' => $category['category_id'],
				'image' 	  => $image = $this->model_tool_image->resize($category['image'], 100, 100),
				'name'        => $category['name'],
				'top'		  => $category['top'],
				'children'    => $children_data
			);	
		}

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

		$this->render();
	}

	public function getmodel() {
		$json = array();
		$this->load->model('catalog/category');

		(int)$id_cat = $this->request->post['cat_id'];

		$categories = $this->model_catalog_category->getCategories($id_cat);
		$leng = count($categories);

		foreach ($categories as $category) {
			$json[] = array(
				'category_id' => $category['category_id'],
				'name_'        => $category['name'],
				'length' => $leng
			);	
		}

		//var_dump($json);

		$this->response->setOutput(json_encode($json));
		
	}

	public function last() {
		$this->load->model('catalog/category');
		$this->load->model('catalog/product');
		$data['categories'] = array();



		if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }

        $categories = $this->model_catalog_category->getCategories($category_id);
		
		//$leng = count($categories);


		foreach ($categories as $category) {
			$ou = 0;
			$dat = array(
				'filter_category_id' => $category['category_id']
			);

			$res = $this->model_catalog_product->getProducts($dat);
			if ($res) {
				$ou = 1;
			} 

			$data['categories'][] = array(
				'id' => $category['category_id'],
				'name'        => $category['name'],
				'count_p' => $ou
			);	
		}

		//var_dump($json);


		// Get template
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/last_glass.tpl')) {
            $this->response->setOutput($this->load->view( $this->config->get('config_template') . '/template/module/last_glass.tpl'));
        } else {
            $this->response->setOutput($this->load->view( 'default/template/module/last_glass.tpl'));
        }

        $this->response->setOutput($this->render());
	}

	public function get_parts() {

		$this->language->load('module/glasses');
		$this->load->model('sale/customer_group');
		$this->load->model('catalog/product');
		$this->load->model('tool/image');
		$this->load->model('catalog/category');

		$data['text_evro'] = $this->language->get('text_evro');
		$data['text_opis'] = $this->language->get('text_opis');
		$data['text_manuf'] = $this->language->get('text_manuf');
		$data['text_price'] = $this->language->get('text_price');
		$data['text_att'] = $this->language->get('text_att');
		$data['heading_title'] = $this->language->get('heading_title');
		$data['button_cart'] = $this->language->get('button_cart');
		$data['text_car'] = $this->language->get('text_car');

		if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }


		$data['products'] = array();
		
		$data = array(
				'filter_category_id' => $category_id
		);

					// Set the last category breadcrumb		
			$url = '';

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}
			
			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}


					$url = '';

			if (isset($this->request->get['filter'])) {
				$url .= '&filter=' . $this->request->get['filter'];
			}	

			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}	

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['coolfilter'])) {
	          $url .= '&coolfilter=' . $this->request->get['coolfilter'];
	        }

			if (isset($this->request->get['limit'])) {
				$url .= '&limit=' . $this->request->get['limit'];
			}

		$results = $this->model_catalog_product->getProducts($data);
		$thumb = '';

		if ($this->customer->isLogged()) {
			$customer_group_info = $this->model_sale_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
		}

		if (isset($customer_group_info['customer_group_sales']) && $customer_group_info['customer_group_sales']) {
			$sales = $customer_group_info['customer_group_sales'];
		}

		foreach ($results as $result) {

			$parcat = $this->model_catalog_product->getProductCategoryPath($result['product_id']);
			$showp = $this->model_catalog_category->getCategory($parcat[0]);

			if ($result['image']) {
				if ($this->customer->isLogged()) {
					$image = $this->model_tool_image->resize($result['image'], 450, 450);
				}else{
					$image = $this->model_tool_image->resize($this->chekCat($showp['name']), 150, 150);
				}
			} else {
				$image = false;
			}

			if ($this->customer->getCustomerGroupId() == 2 && $sales) {
				if ($result['jan']) {
					$result['price'] = $result['jan'] - ($result['jan']*($sales/100));
				} else{
					$result['price'] = $result['price'] - ($result['price']*($sales/100));
				}
				
			} else{
				if ($result['jan']) {
					$result['price'] = $result['jan'];
				}
			}

			
						
			if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
				$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$price = false;
			}
					
			if ((float)$result['special']) {
				$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$special = false;
			}
			
			if ($this->config->get('config_review_status')) {
				$rating = $result['rating'];
			} else {
				$rating = false;
			}

			$this->load->model('catalog/manufacturer');

			$stickers = $this->getStickers($result['product_id']) ;
			$ids = (int)$result['manufacturer_id'];

			if ($result['manufacturer_id']) {
				$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($ids);

			} else{
				$manufacturer_info = 0;
				$thumb = '';
			}

			if ($manufacturer_info) {
				if ($manufacturer_info['image']) {
				$thumb = $this->model_tool_image->resize($manufacturer_info['image'], '130', '130');
				} else {
				$thumb = '';
				}
			}
			 
			$data['products'][] = array(
				'product_id' => $result['product_id'],
				'model'		 => $result['model'],
				'thumb'   	 => $image,
				'name'    	 => $result['name'],
				'manufacturer' => $result['manufacturer'],
				'manuf_img' => $thumb,
				'description' =>  $description = trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))),
				'price'   	 => $price,
				'special' 	 => $special,
				'rating'     => $rating,
				'sticker'    => $stickers,
				'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
				'href'        => $this->url->link('product/product', 'path=' . '&product_id=' . $result['product_id'] . $url)
			);
		}

		$data['logged'] = $this->customer->isLogged();

		// Get template
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/glass_parts.tpl')) {
            $this->response->setOutput($this->load->view( $this->config->get('config_template') . '/template/module/glass_parts.tpl'));
        } else {
            $this->response->setOutput($this->load->view( 'default/template/module/glass_parts.tpl'));
        }

        $this->response->setOutput($this->render());
	}

	private function getStickers($product_id) {
	
 	$stickers = $this->model_catalog_product->getProductStickerbyProductId($product_id) ;	
		
		if (!$stickers) {
			return;
		}
		
		$data['stickers'] = array();
		
		foreach ($stickers as $sticker) {
			$data['stickers'][] = array(
				'position' => $sticker['position'],
				'image'    => HTTP_SERVER . 'image/' . $sticker['image']
			);		
		}

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

		private function chekCat($name){
		$name = trim($name);
		switch ($name) {
			case 'A':
				return 'data/zag/A.png';
				break;
			case 'B':
				return 'data/zag/B.png';
				break;
			case 'AL':
				return 'no_image.jpg';
				break;
			case 'AR':
				return 'no_image.jpg';
				break;
			case 'LFQ':
				return 'no_image.jpg';
				break;
			case 'LFV':
				return 'no_image.jpg';
				break;
			case 'LFD':
				return 'data/zag/LFD.png';
				break;
			case 'LMQ':
				return 'no_image.jpg';
				break;
			case 'LRD':
				return 'data/zag/LRD.png';
				break;
			case 'LRV':
				return 'no_image.jpg';
				break;
			case 'LRQ':
				return 'data/zag/LRQ.png';
				break;
			case 'L1P':
				return 'no_image.jpg';
				break;
			case 'L2P':
				return 'no_image.jpg';
				break;
			case 'L3P':
				return 'no_image.jpg';
				break;
			case 'RG':
				return 'no_image.jpg';
				break;
			case 'RFQ':
				return 'no_image.jpg';
				break;
			case 'RFV':
				return 'no_image.jpg';
				break;
			case 'RFD':
				return 'data/zag/RFD.png';
				break;
			case 'RMQ':
				return 'no_image.jpg';
				break;
			case 'RRD':
				return 'data/zag/RRD.png';
				break;
			case 'RRV':
				return 'no_image.jpg';
				break;
			case 'RRQ':
				return 'data/zag/RRQ.png';
				break;
			case 'R1P':
				return 'no_image.jpg';
				break;
			case 'R2P':
				return 'no_image.jpg';
				break;
			case 'R3P':
				return 'no_image.jpg';
				break;
			case 'BL':
				return 'no_image.jpg';
				break;
			case 'BR':
				return 'no_image.jpg';
				break;
			default:
				return 'no_image.jpg';
				break;
		}
	}



}
?>

 

Изменено пользователем btrotsky

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

В catalog/controller попробуйте так:
 

Спойлер

<?php  
class ControllerExtensionModuleGlasses extends Controller {
    protected function index($setting) {

        $this->language->load('extension/module/glasses');
        $this->load->model('tool/image');    

        $data['heading_title'] = $this->language->get('heading_title');

        $data['text_mark'] = $this->language->get('text_mark');
        $data['text_model'] = $this->language->get('text_model');
        $data['text_kuzov'] = $this->language->get('text_kuzov');
        $data['text_year'] = $this->language->get('text_year');
        $data['text_search'] = $this->language->get('text_search');
        $data['text_zap'] = $this->language->get('text_zap');
        $data['text_inst'] = $this->language->get('text_inst');
                
               $data['logged'] = $this->customer->isLogged();

        if (isset($this->request->get['path'])) {
            $parts = explode('_', (string)$this->request->get['path']);
        } else {
            $parts = array();
        }

        if (isset($parts[0])) {
            $data['category_id'] = $parts[0];
        } else {
            $data['category_id'] = 0;
        }

        if (isset($parts[1])) {
            $data['child_id'] = $parts[1];
        } else {
            $data['child_id'] = 0;
        }

        $this->load->model('catalog/category');

        $this->load->model('catalog/product');

        $data['categories'] = array();

        $categories = $this->model_catalog_category->getCategories(0);

        foreach ($categories as $category) {
            //$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category['category_id']));

            $children_data = array();

            $children = $this->model_catalog_category->getCategories($category['category_id']);

            foreach ($children as $child) {
                $data = array(
                    'filter_category_id'  => $child['category_id'],
                    'filter_sub_category' => true
                );

                //$product_total = $this->model_catalog_product->getTotalProducts($data);
            

                $children_data[] = array(
                    'category_id' => $child['category_id'],
                    'name'        => $child['name'],
                    'parent_id' => $category['category_id']
                    //'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])    
                );        
            }

            $data['categories'][] = array(
                'category_id' => $category['category_id'],
                'image'       => $image = $this->model_tool_image->resize($category['image'], 100, 100),
                'name'        => $category['name'],
                'top'          => $category['top'],
                'children'    => $children_data
            );    
        }


    return $this->load->view('extension/module/glasses', $data);
    }

    public function getmodel() {
        $json = array();
        $this->load->model('catalog/category');

        (int)$id_cat = $this->request->post['cat_id'];

        $categories = $this->model_catalog_category->getCategories($id_cat);
        $leng = count($categories);

        foreach ($categories as $category) {
            $json[] = array(
                'category_id' => $category['category_id'],
                'name_'        => $category['name'],
                'length' => $leng
            );    
        }

        //var_dump($json);

        $this->response->setOutput(json_encode($json));
        
    }

    public function last() {
        $this->load->model('catalog/category');
        $this->load->model('catalog/product');
        $data['categories'] = array();

        if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }

        $categories = $this->model_catalog_category->getCategories($category_id);
        
        //$leng = count($categories);


        foreach ($categories as $category) {
            $ou = 0;
            $dat = array(
                'filter_category_id' => $category['category_id']
            );

            $res = $this->model_catalog_product->getProducts($dat);
            if ($res) {
                $ou = 1;
            } 

            $data['categories'][] = array(
                'id' => $category['category_id'],
                'name'        => $category['name'],
                'count_p' => $ou
            );    
        }

        //var_dump($json);


        // Get template


    return $this->load->view('extension/module/last_glass', $data);
    }

    public function get_parts() {

        $this->language->load('module/glasses');
        $this->load->model('sale/customer_group');
        $this->load->model('catalog/product');
        $this->load->model('tool/image');
        $this->load->model('catalog/category');

        $data['text_evro'] = $this->language->get('text_evro');
        $data['text_opis'] = $this->language->get('text_opis');
        $data['text_manuf'] = $this->language->get('text_manuf');
        $data['text_price'] = $this->language->get('text_price');
        $data['text_att'] = $this->language->get('text_att');
        $data['heading_title'] = $this->language->get('heading_title');
        $data['button_cart'] = $this->language->get('button_cart');
        $data['text_car'] = $this->language->get('text_car');

        if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }


        $data['products'] = array();
        
        $data = array(
                'filter_category_id' => $category_id
        );

                    // Set the last category breadcrumb        
            $url = '';

            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }    

            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }

            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
            
            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['limit'])) {
                $url .= '&limit=' . $this->request->get['limit'];
            }


                    $url = '';

            if (isset($this->request->get['filter'])) {
                $url .= '&filter=' . $this->request->get['filter'];
            }    

            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }    

            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }

            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['limit'])) {
                $url .= '&limit=' . $this->request->get['limit'];
            }

        $results = $this->model_catalog_product->getProducts($data);
        $thumb = '';

        if ($this->customer->isLogged()) {
            $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
        }

        if (isset($customer_group_info['customer_group_sales']) && $customer_group_info['customer_group_sales']) {
            $sales = $customer_group_info['customer_group_sales'];
        }

        foreach ($results as $result) {

            $parcat = $this->model_catalog_product->getProductCategoryPath($result['product_id']);
            $showp = $this->model_catalog_category->getCategory($parcat[0]);

            if ($result['image']) {
                if ($this->customer->isLogged()) {
                    $image = $this->model_tool_image->resize($result['image'], 450, 450);
                }else{
                    $image = $this->model_tool_image->resize($this->chekCat($showp['name']), 150, 150);
                }
            } else {
                $image = false;
            }

            if ($this->customer->getCustomerGroupId() == 2 && $sales) {
                if ($result['jan']) {
                    $result['price'] = $result['jan'] - ($result['jan']*($sales/100));
                } else{
                    $result['price'] = $result['price'] - ($result['price']*($sales/100));
                }
                
            } else{
                if ($result['jan']) {
                    $result['price'] = $result['jan'];
                }
            }

            
                        
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $price = false;
            }
                    
            if ((float)$result['special']) {
                $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $special = false;
            }
            
            if ($this->config->get('config_review_status')) {
                $rating = $result['rating'];
            } else {
                $rating = false;
            }

            $this->load->model('catalog/manufacturer');

            $stickers = $this->getStickers($result['product_id']) ;
            $ids = (int)$result['manufacturer_id'];

            if ($result['manufacturer_id']) {
                $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($ids);

            } else{
                $manufacturer_info = 0;
                $thumb = '';
            }

            if ($manufacturer_info) {
                if ($manufacturer_info['image']) {
                $thumb = $this->model_tool_image->resize($manufacturer_info['image'], '130', '130');
                } else {
                $thumb = '';
                }
            }
             
            $data['products'][] = array(
                'product_id' => $result['product_id'],
                'model'         => $result['model'],
                'thumb'        => $image,
                'name'         => $result['name'],
                'manufacturer' => $result['manufacturer'],
                'manuf_img' => $thumb,
                'description' =>  $description = trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))),
                'price'        => $price,
                'special'      => $special,
                'rating'     => $rating,
                'sticker'    => $stickers,
                'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'        => $this->url->link('product/product', 'path=' . '&product_id=' . $result['product_id'] . $url)
            );
        }

        $data['logged'] = $this->customer->isLogged();

        // Get template

    return $this->load->view('extension/module/glass_parts', $data);
    }

    private function getStickers($product_id) {
    
     $stickers = $this->model_catalog_product->getProductStickerbyProductId($product_id) ;    
        
        if (!$stickers) {
            return;
        }
        
        $data['stickers'] = array();
        
        foreach ($stickers as $sticker) {
            $data['stickers'][] = array(
                'position' => $sticker['position'],
                'image'    => HTTP_SERVER . 'image/' . $sticker['image']
            );        
        }

    

    return $this->load->view('product/stickers', $data);

    
    }

        private function chekCat($name){
        $name = trim($name);
        switch ($name) {
            case 'A':
                return 'data/zag/A.png';
                break;
            case 'B':
                return 'data/zag/B.png';
                break;
            case 'AL':
                return 'no_image.jpg';
                break;
            case 'AR':
                return 'no_image.jpg';
                break;
            case 'LFQ':
                return 'no_image.jpg';
                break;
            case 'LFV':
                return 'no_image.jpg';
                break;
            case 'LFD':
                return 'data/zag/LFD.png';
                break;
            case 'LMQ':
                return 'no_image.jpg';
                break;
            case 'LRD':
                return 'data/zag/LRD.png';
                break;
            case 'LRV':
                return 'no_image.jpg';
                break;
            case 'LRQ':
                return 'data/zag/LRQ.png';
                break;
            case 'L1P':
                return 'no_image.jpg';
                break;
            case 'L2P':
                return 'no_image.jpg';
                break;
            case 'L3P':
                return 'no_image.jpg';
                break;
            case 'RG':
                return 'no_image.jpg';
                break;
            case 'RFQ':
                return 'no_image.jpg';
                break;
            case 'RFV':
                return 'no_image.jpg';
                break;
            case 'RFD':
                return 'data/zag/RFD.png';
                break;
            case 'RMQ':
                return 'no_image.jpg';
                break;
            case 'RRD':
                return 'data/zag/RRD.png';
                break;
            case 'RRV':
                return 'no_image.jpg';
                break;
            case 'RRQ':
                return 'data/zag/RRQ.png';
                break;
            case 'R1P':
                return 'no_image.jpg';
                break;
            case 'R2P':
                return 'no_image.jpg';
                break;
            case 'R3P':
                return 'no_image.jpg';
                break;
            case 'BL':
                return 'no_image.jpg';
                break;
            case 'BR':
                return 'no_image.jpg';
                break;
            default:
                return 'no_image.jpg';
                break;
        }
    }

}
?>

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
28 минут назад, buslikdrev сказал:

В catalog/controller попробуйте так:
 

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

<?php  
class ControllerExtensionModuleGlasses extends Controller {
    protected function index($setting) {

        $this->language->load('extension/module/glasses');
        $this->load->model('tool/image');    

        $data['heading_title'] = $this->language->get('heading_title');

        $data['text_mark'] = $this->language->get('text_mark');
        $data['text_model'] = $this->language->get('text_model');
        $data['text_kuzov'] = $this->language->get('text_kuzov');
        $data['text_year'] = $this->language->get('text_year');
        $data['text_search'] = $this->language->get('text_search');
        $data['text_zap'] = $this->language->get('text_zap');
        $data['text_inst'] = $this->language->get('text_inst');
                
               $data['logged'] = $this->customer->isLogged();

        if (isset($this->request->get['path'])) {
            $parts = explode('_', (string)$this->request->get['path']);
        } else {
            $parts = array();
        }

        if (isset($parts[0])) {
            $data['category_id'] = $parts[0];
        } else {
            $data['category_id'] = 0;
        }

        if (isset($parts[1])) {
            $data['child_id'] = $parts[1];
        } else {
            $data['child_id'] = 0;
        }

        $this->load->model('catalog/category');

        $this->load->model('catalog/product');

        $data['categories'] = array();

        $categories = $this->model_catalog_category->getCategories(0);

        foreach ($categories as $category) {
            //$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category['category_id']));

            $children_data = array();

            $children = $this->model_catalog_category->getCategories($category['category_id']);

            foreach ($children as $child) {
                $data = array(
                    'filter_category_id'  => $child['category_id'],
                    'filter_sub_category' => true
                );

                //$product_total = $this->model_catalog_product->getTotalProducts($data);
            

                $children_data[] = array(
                    'category_id' => $child['category_id'],
                    'name'        => $child['name'],
                    'parent_id' => $category['category_id']
                    //'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])    
                );        
            }

            $data['categories'][] = array(
                'category_id' => $category['category_id'],
                'image'       => $image = $this->model_tool_image->resize($category['image'], 100, 100),
                'name'        => $category['name'],
                'top'          => $category['top'],
                'children'    => $children_data
            );    
        }


    return $this->load->view('extension/module/glasses', $data);
    }

    public function getmodel() {
        $json = array();
        $this->load->model('catalog/category');

        (int)$id_cat = $this->request->post['cat_id'];

        $categories = $this->model_catalog_category->getCategories($id_cat);
        $leng = count($categories);

        foreach ($categories as $category) {
            $json[] = array(
                'category_id' => $category['category_id'],
                'name_'        => $category['name'],
                'length' => $leng
            );    
        }

        //var_dump($json);

        $this->response->setOutput(json_encode($json));
        
    }

    public function last() {
        $this->load->model('catalog/category');
        $this->load->model('catalog/product');
        $data['categories'] = array();

        if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }

        $categories = $this->model_catalog_category->getCategories($category_id);
        
        //$leng = count($categories);


        foreach ($categories as $category) {
            $ou = 0;
            $dat = array(
                'filter_category_id' => $category['category_id']
            );

            $res = $this->model_catalog_product->getProducts($dat);
            if ($res) {
                $ou = 1;
            } 

            $data['categories'][] = array(
                'id' => $category['category_id'],
                'name'        => $category['name'],
                'count_p' => $ou
            );    
        }

        //var_dump($json);


        // Get template


    return $this->load->view('extension/module/last_glass', $data);
    }

    public function get_parts() {

        $this->language->load('module/glasses');
        $this->load->model('sale/customer_group');
        $this->load->model('catalog/product');
        $this->load->model('tool/image');
        $this->load->model('catalog/category');

        $data['text_evro'] = $this->language->get('text_evro');
        $data['text_opis'] = $this->language->get('text_opis');
        $data['text_manuf'] = $this->language->get('text_manuf');
        $data['text_price'] = $this->language->get('text_price');
        $data['text_att'] = $this->language->get('text_att');
        $data['heading_title'] = $this->language->get('heading_title');
        $data['button_cart'] = $this->language->get('button_cart');
        $data['text_car'] = $this->language->get('text_car');

        if (isset($this->request->get['category_id'])) {
            $category_id = (int) $this->request->get['category_id'];
        } else {
            $category_id = 0;
        }


        $data['products'] = array();
        
        $data = array(
                'filter_category_id' => $category_id
        );

                    // Set the last category breadcrumb        
            $url = '';

            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }    

            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }

            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['page'])) {
                $url .= '&page=' . $this->request->get['page'];
            }
            
            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['limit'])) {
                $url .= '&limit=' . $this->request->get['limit'];
            }


                    $url = '';

            if (isset($this->request->get['filter'])) {
                $url .= '&filter=' . $this->request->get['filter'];
            }    

            if (isset($this->request->get['sort'])) {
                $url .= '&sort=' . $this->request->get['sort'];
            }    

            if (isset($this->request->get['order'])) {
                $url .= '&order=' . $this->request->get['order'];
            }

            if (isset($this->request->get['coolfilter'])) {
              $url .= '&coolfilter=' . $this->request->get['coolfilter'];
            }

            if (isset($this->request->get['limit'])) {
                $url .= '&limit=' . $this->request->get['limit'];
            }

        $results = $this->model_catalog_product->getProducts($data);
        $thumb = '';

        if ($this->customer->isLogged()) {
            $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($this->customer->getCustomerGroupId());
        }

        if (isset($customer_group_info['customer_group_sales']) && $customer_group_info['customer_group_sales']) {
            $sales = $customer_group_info['customer_group_sales'];
        }

        foreach ($results as $result) {

            $parcat = $this->model_catalog_product->getProductCategoryPath($result['product_id']);
            $showp = $this->model_catalog_category->getCategory($parcat[0]);

            if ($result['image']) {
                if ($this->customer->isLogged()) {
                    $image = $this->model_tool_image->resize($result['image'], 450, 450);
                }else{
                    $image = $this->model_tool_image->resize($this->chekCat($showp['name']), 150, 150);
                }
            } else {
                $image = false;
            }

            if ($this->customer->getCustomerGroupId() == 2 && $sales) {
                if ($result['jan']) {
                    $result['price'] = $result['jan'] - ($result['jan']*($sales/100));
                } else{
                    $result['price'] = $result['price'] - ($result['price']*($sales/100));
                }
                
            } else{
                if ($result['jan']) {
                    $result['price'] = $result['jan'];
                }
            }

            
                        
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $price = false;
            }
                    
            if ((float)$result['special']) {
                $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
            } else {
                $special = false;
            }
            
            if ($this->config->get('config_review_status')) {
                $rating = $result['rating'];
            } else {
                $rating = false;
            }

            $this->load->model('catalog/manufacturer');

            $stickers = $this->getStickers($result['product_id']) ;
            $ids = (int)$result['manufacturer_id'];

            if ($result['manufacturer_id']) {
                $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($ids);

            } else{
                $manufacturer_info = 0;
                $thumb = '';
            }

            if ($manufacturer_info) {
                if ($manufacturer_info['image']) {
                $thumb = $this->model_tool_image->resize($manufacturer_info['image'], '130', '130');
                } else {
                $thumb = '';
                }
            }
             
            $data['products'][] = array(
                'product_id' => $result['product_id'],
                'model'         => $result['model'],
                'thumb'        => $image,
                'name'         => $result['name'],
                'manufacturer' => $result['manufacturer'],
                'manuf_img' => $thumb,
                'description' =>  $description = trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))),
                'price'        => $price,
                'special'      => $special,
                'rating'     => $rating,
                'sticker'    => $stickers,
                'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                'href'        => $this->url->link('product/product', 'path=' . '&product_id=' . $result['product_id'] . $url)
            );
        }

        $data['logged'] = $this->customer->isLogged();

        // Get template

    return $this->load->view('extension/module/glass_parts', $data);
    }

    private function getStickers($product_id) {
    
     $stickers = $this->model_catalog_product->getProductStickerbyProductId($product_id) ;    
        
        if (!$stickers) {
            return;
        }
        
        $data['stickers'] = array();
        
        foreach ($stickers as $sticker) {
            $data['stickers'][] = array(
                'position' => $sticker['position'],
                'image'    => HTTP_SERVER . 'image/' . $sticker['image']
            );        
        }

    

    return $this->load->view('product/stickers', $data);

    
    }

        private function chekCat($name){
        $name = trim($name);
        switch ($name) {
            case 'A':
                return 'data/zag/A.png';
                break;
            case 'B':
                return 'data/zag/B.png';
                break;
            case 'AL':
                return 'no_image.jpg';
                break;
            case 'AR':
                return 'no_image.jpg';
                break;
            case 'LFQ':
                return 'no_image.jpg';
                break;
            case 'LFV':
                return 'no_image.jpg';
                break;
            case 'LFD':
                return 'data/zag/LFD.png';
                break;
            case 'LMQ':
                return 'no_image.jpg';
                break;
            case 'LRD':
                return 'data/zag/LRD.png';
                break;
            case 'LRV':
                return 'no_image.jpg';
                break;
            case 'LRQ':
                return 'data/zag/LRQ.png';
                break;
            case 'L1P':
                return 'no_image.jpg';
                break;
            case 'L2P':
                return 'no_image.jpg';
                break;
            case 'L3P':
                return 'no_image.jpg';
                break;
            case 'RG':
                return 'no_image.jpg';
                break;
            case 'RFQ':
                return 'no_image.jpg';
                break;
            case 'RFV':
                return 'no_image.jpg';
                break;
            case 'RFD':
                return 'data/zag/RFD.png';
                break;
            case 'RMQ':
                return 'no_image.jpg';
                break;
            case 'RRD':
                return 'data/zag/RRD.png';
                break;
            case 'RRV':
                return 'no_image.jpg';
                break;
            case 'RRQ':
                return 'data/zag/RRQ.png';
                break;
            case 'R1P':
                return 'no_image.jpg';
                break;
            case 'R2P':
                return 'no_image.jpg';
                break;
            case 'R3P':
                return 'no_image.jpg';
                break;
            case 'BL':
                return 'no_image.jpg';
                break;
            case 'BR':
                return 'no_image.jpg';
                break;
            default:
                return 'no_image.jpg';
                break;
        }
    }

}
?>

 

 

ошибка не пропала, да и в логах же пишет про другой файл

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
34 минуты назад, btrotsky сказал:

 

ошибка не пропала, да и в логах же пишет про другой файл

Я вам указал на отличия на стороне сайта, а не админки (естественно ошибка не исчезла в админке) и таких в каждом файле считай. Вам нужно смотреть на стандартные файлы версии 2.3 и менять. Если в опенкарт 1,5 в модуле была функция чисто включить выключить модуль, то сделайте копию модуля категорий, например, только имя поменяйте на своё Glasses вместо category

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
2 часа назад, btrotsky сказал:

Строка это $this->response->setOutput($this->render());

 

в двойке нет $this->render(), потому и ругается

 

если в 15х было типа

        $this->template = 'module/featured.tpl';
        $this->children = array(
            'common/header',
            'common/footer'
        );
                
        $this->response->setOutput($this->render());

в 230х уже так

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

        $this->response->setOutput($this->load->view('extension/module/featured', $data));

 

для наглядности сравните отличия модуля Featured (пример выше как раз из него)

15х - admin\controller\module\featured.php

230х - admin\controller\extension\module\featured.php

с остальными - по аналогии ;)

 

плюс не забудьте про изменение пути extension (и соответственно, в названии классов)

ну и логи смотрите, могут еще отличия всплыть

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты
2 часа назад, AlexDW сказал:

 

в двойке нет $this->render(), потому и ругается

 

если в 15х было типа


        $this->template = 'module/featured.tpl';
        $this->children = array(
            'common/header',
            'common/footer'
        );
                
        $this->response->setOutput($this->render());

в 230х уже так


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

        $this->response->setOutput($this->load->view('extension/module/featured', $data));

 

для наглядности сравните отличия модуля Featured (пример выше как раз из него)

15х - admin\controller\module\featured.php

230х - admin\controller\extension\module\featured.php

с остальными - по аналогии ;)

 

плюс не забудьте про изменение пути extension (и соответственно, в названии классов)

ну и логи смотрите, могут еще отличия всплыть

 

При редактировании модуля уже перестали ошибки быть и я даже смог увидеть настройки модуля, стилей не было совсем, но сумел настроить и сохранить, после чего меня кинуло на страницу где писало что нет прав для доступа, а в логах уже
 

2017/12/06 00:48:32 [warn] 32736#32736: *171957 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000469, client: 194.44.17.94, server: colordom.com, request: "POST /admin/index.php?route=user/user_permission/edit&token=UufRaUpZz0qibLhngPDzSmIy2CaNQlH7&user_group_id=1 HTTP/1.1", host: "colordom.com", referrer: "http://colordom.com/admin/index.php?route=user/user_permission/edit&token=UufRaUpZz0qibLhngPDzSmIy2CaNQlH7&user_group_id=1"

 

Изменено пользователем btrotsky

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×

Важная информация

На нашем сайте используются файлы cookie и происходит обработка некоторых персональных данных пользователей, чтобы улучшить пользовательский интерфейс. Чтобы узнать для чего и какие персональные данные мы обрабатываем перейдите по ссылке. Если Вы нажмете «Я даю согласие», это означает, что Вы понимаете и принимаете все условия, указанные в этом Уведомлении о Конфиденциальности.