HEX
Server: LiteSpeed
System: Linux php-prod-3.spaceapp.ru 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: sarli3128 (1010)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/retile.ru/public_html/catalog/controller/extension/module/uni_category_wall_v2.php
<?php
class ControllerExtensionModuleUniCategoryWallv2 extends Controller {
	public function index($setting) {
		static $module = 0;
		
		$this->load->language('extension/module/uni_category_wall_v2');
		
		$this->load->model('extension/module/uni_category_wall_v2');
		$this->load->model('catalog/category');
		$this->load->model('tool/image');
		
		$this->document->addStyle('catalog/view/theme/unishop2/stylesheet/category_wall.css');
		
		$store_id = (int)$this->config->get('config_store_id');
		$lang_id = (int)$this->config->get('config_language_id');
		
		$data['heading_title'] = $setting['title'][$lang_id];
		$data['type'] = isset($setting['type']) ? $setting['type'] : 1;
		$data['type_view'] = isset($setting['view_type']) ? 'carousel' : 'grid';
		$data['columns'] = isset($setting['columns']) ? $setting['columns'] : [6, 4, 3, 3, 2];
		
		$image_width = isset($setting['image_width']) ? $setting['image_width'] : 228;
		$image_height = isset($setting['image_height']) ? $setting['image_height'] : 174;
		
		$data['img_width'] = $image_width;
		$data['img_height'] = $image_height;
		
		$results = isset($setting['categories']) ? $setting['categories'] : [];
		
		$cache_name = 'category.unishop.catwall_v2.'.substr(md5(json_encode($results)), 0, 8).'.'.$lang_id.'.'.$store_id;
		
		$data['categories'] = $this->cache->get($cache_name);
		
		if(!$data['categories']) {
			foreach($results as $key => $result) {
			
				$category = $this->model_extension_module_uni_category_wall_v2->getCategoryInfo((int)$key);
				
				if($category) {
			
					$childs_data = [];
			
					if(isset($result['child'])) {
				
						$childs = $this->model_extension_module_uni_category_wall_v2->getChildCategories($result['child']);
				
						foreach($childs as $child) {
							$childs_data[] = [
								'category_id'	=> $child['category_id'],
								'name' 			=> $child['name'],
								'href' 			=> $this->url->link('product/category', 'path='.$category['category_id'].'_'.$child['category_id'])
							];
						}
					}
				
					if ($category['image']) {
						$image = $this->model_tool_image->resize($category['image'], $image_width, $image_height);
					} else {
						$image = $this->model_tool_image->resize('placeholder.png', $image_width, $image_height);
					}
					
					$data['categories'][] = [
						'category_id' 	=> $category['category_id'],
						'name' 			=> $category['name'],
						'image' 		=> $image,
						'href'        	=> $this->url->link('product/category', 'path='.$category['category_id']),
						'sort_order'	=> $result['sort_order'] ? $result['sort_order'] : 1,
						'childs'		=> $childs_data
					];
			
					if(count($data['categories']) > 1) {
						array_multisort(array_column($data['categories'], 'sort_order'), SORT_ASC, $data['categories']);
					}
			
					if($data['categories']){
						$this->cache->set($cache_name, $data['categories']);
					}
				}
			}
		}	

		$data['module'] = $module++;

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