load->language('catalog/product'); $this->document->setTitle('Товары'); $this->load->model('wtiman/wtiman'); if (isset($this->request->get['node_id'])) { $node_id = (int)$this->request->get['node_id']; } else { $node_id = 0; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'pd.name'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } $url = ''; if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $data['node_id'] = $node_id; $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . $url, true) ); $data['import_curent'] = $this->url->link('wtiman/wtiman/import', 'user_token=' . $this->session->data['user_token'] . $url, true); $data['tocat'] = $this->url->link('wtiman/wtiman/tocat', 'user_token=' . $this->session->data['user_token'] . $url, true); $data['delete'] = $this->url->link('wtiman/wtiman/delete', 'user_token=' . $this->session->data['user_token'] . $url, true); $data['enabled'] = $this->url->link('wtiman/wtiman/enable', 'user_token=' . $this->session->data['user_token'] . $url, true); $data['disabled'] = $this->url->link('wtiman/wtiman/disable', 'user_token=' . $this->session->data['user_token'] . $url, true); $data['import_base_url'] = $this->url->link('wtiman/wtiman/import', 'user_token=' . $this->session->data['user_token'], true); $data['export_base_url'] = $this->url->link('wtiman/wtiman/export', 'user_token=' . $this->session->data['user_token'], true); $data['print_base_url'] = $this->url->link('wtiman/wtiman/print', 'user_token=' . $this->session->data['user_token'], true); $data['products'] = array(); $filter_data = array( 'sort' => $sort, 'order' => $order, //'start' => ($page - 1) * $this->count_prod_to_page, //'limit' => $this->count_prod_to_page ); $this->load->model('tool/image'); $product_total = $this->model_wtiman_wtiman->getTotalProductsByNodeId($node_id); $results = $this->model_wtiman_wtiman->getProductsByNodeId($node_id, $filter_data); foreach ($results as $result) { if (is_file(DIR_IMAGE . $result['image'])) { $image = $this->model_tool_image->resize($result['image'], 80, 80); } else { $image = $this->model_tool_image->resize('no_image.png', 80, 80); } $special = false; $data['products'][] = array( 'product_id' => $result['product_id'], 'image' => $image, 'name' => $result['name'], 'model' => $result['model'], 'price' => $this->currency->format($result['price'], $this->config->get('config_currency')), 'special' => $special, 'quantity' => $result['quantity'], 'status' => $result['status'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'), 'noindex' => $result['noindex'] ? $this->language->get('text_enabled_short') : $this->language->get('text_disabled_short'), 'href_shop' => HTTP_CATALOG . 'index.php?route=product/product&product_id=' . $result['product_id'], 'edit' => $this->url->link('catalog/product/edit', 'user_token=' . $this->session->data['user_token'] . '&product_id=' . $result['product_id'] . $url, true) ); } $data['user_token'] = $this->session->data['user_token']; if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } if (isset($this->request->post['selected'])) { $data['selected'] = (array)$this->request->post['selected']; } else { $data['selected'] = array(); } $url = ''; if ($order == 'ASC') { $url .= '&order=DESC'; } else { $url .= '&order=ASC'; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $data['sort_name'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=pd.name' . $url, true); $data['sort_model'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.model' . $url, true); $data['sort_price'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.price' . $url, true); $data['sort_quantity'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.quantity' . $url, true); $data['sort_status'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.status' . $url, true); $data['sort_noindex'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.noindex' . $url, true); $data['sort_order'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&sort=p.sort_order' . $url, true); $data['pagination'] = ''; $data['results'] = 'Всего '.$product_total.' товаров'; $data['sort'] = $sort; $data['order'] = $order; $data['nodes'] = $this->getNodesList(); $data['tags'] = $this->getTagsList(); $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('wtiman/product_list', $data)); } public function getNodesList() { $this->load->model('wtiman/wtiman'); $list = array(); $nodes = $this->model_wtiman_wtiman->getNodesList(); foreach ($nodes as $node) { $list[] = array('node_id' => $node['node_id'], 'name' => $node['name'], 'link' => $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $node['node_id'], true)); } return $list; } public function getTagsList() { $this->load->model('wtiman/wtiman'); $list = array(); $tags = $this->model_wtiman_wtiman->getTagsList(); foreach ($tags as $tag) { $list[] = array('tag_id' => $tag['tag_id'], 'name' => $tag['name'], 'link' => $this->url->link('wtiman/wtiman/tag', 'user_token=' . $this->session->data['user_token'] . '&tag_id=' . $tag['tag_id'], true)); } return $list; } public function addnode() { $json = array(); $this->load->model('wtiman/wtiman'); $node_id = $this->model_wtiman_wtiman->addNode($this->request->post['node_name'], $this->request->post['node_parent']); if ($node_id) { $json = array( 'stat' => 'ok', 'node_id' => $node_id, 'parent_id' => $this->request->post['node_parent'], 'name' => $this->request->post['node_name'], 'link' => $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $node_id, true) ); } else{ $json = array( 'stat' => 'error' ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function editnode() { $json = array(); $this->load->model('wtiman/wtiman'); $qres = $this->model_wtiman_wtiman->editNode($this->request->post['node_id'], $this->request->post['node_name']); if ($qres) { $json = array( 'stat' => 'ok', 'node_id' => $this->request->post['node_id'], // 'parent_id' => $this->request->post['node_parent'], 'name' => $this->request->post['node_name'], 'link' => $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $this->request->post['node_id'], true) ); } else{ $json = array( 'stat' => 'error' ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function deletenode() { $json = array(); $this->load->model('wtiman/wtiman'); //TODO: удаление товаров и подразделов $this->model_wtiman_wtiman->deleteNode($this->request->post['node_id']); $json = array( 'stat' => 'ok', 'node_id' => $this->request->post['node_id'] ); $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function addtag() { $json = array(); $this->load->model('wtiman/wtiman'); $tag_id = $this->model_wtiman_wtiman->addTag($this->request->post['tag_name']); if ($tag_id) { $json = array( 'stat' => 'ok', 'tag_id' => $tag_id, 'name' => $this->request->post['tag_name'], 'link' => $this->url->link('wtiman/wtiman/tag', 'user_token=' . $this->session->data['user_token'] . '&tag_id=' . $tag_id, true) ); } else{ $json = array( 'stat' => 'error' ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function edittag() { $json = array(); $this->load->model('wtiman/wtiman'); $qres = $this->model_wtiman_wtiman->editTag($this->request->post['tag_id'], $this->request->post['tag_name']); if ($qres) { $json = array( 'stat' => 'ok', 'tag_id' => $this->request->post['tag_id'], 'name' => $this->request->post['tag_name'], 'link' => $this->url->link('wtiman/wtiman/tag', 'user_token=' . $this->session->data['user_token'] . '&tag_id=' . $this->request->post['tag_id'], true) ); } else{ $json = array( 'stat' => 'error' ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function deletetag() { $json = array(); $this->load->model('wtiman/wtiman'); $this->model_wtiman_wtiman->deleteTag($this->request->post['tag_id']); $json = array( 'stat' => 'ok', 'tag_id' => $this->request->post['tag_id'] ); $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function addattr() { $json = array(); $this->load->model('catalog/attribute'); $attribute_data = array('attribute_group_id' => 7, 'sort_order' => 1, 'attribute_description' => array( 1=>array('name'=>$this->request->post['attr_name']) ) ); $attr_id = $this->model_catalog_attribute->addAttribute($attribute_data); if ($attr_id) { $json = array( 'stat' => 'ok', 'id' => $attr_id, 'name' => $this->request->post['attr_name'] ); } else{ $json = array( 'stat' => 'error' ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function getattrlist() { $json = array(); $this->load->model('catalog/attribute'); $attribute_filter = array(); $results = $this->model_catalog_attribute->getAttributes($attribute_filter); $json = array( 'stat' => 'ok', 'list' => array() ); foreach ($results as $result) { $json['list'][] = array( 'id' => $result['attribute_id'], 'name' => $result['name'] ); } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($json)); } public function import() { $this->load->model('wtiman/wtiman'); $node_id = isset($this->request->get['node_id']) ? $this->request->get['node_id'] : 0; $data['node_id'] = $node_id; $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) ); $data['breadcrumbs'][] = array( 'text' => 'Менеджер импорта', 'href' => $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $node_id, true) ); $data['breadcrumbs'][] = array( 'text' => 'Импорт', 'href' => $this->url->link('wtiman/wtiman/import', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $node_id, true) ); $data['cancel'] = $this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . '&node_id=' . $node_id, true); $data['user_token'] = $this->session->data['user_token']; $data['upload_url_base'] = $this->url->link('wtiman/wtiman/upload', '', true); $data['filepreview_url_base'] = $this->url->link('wtiman/wtiman/filepreview', '', true); $data['importstep_url_base'] = $this->url->link('wtiman/wtiman/importstep', 'user_token=' . $this->session->data['user_token'], true); $data['nodes_list'] = $this->getNodesList(); $this->load->model('design/layout'); $data['layouts'] = $this->model_design_layout->getLayouts(); $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('wtiman/import', $data)); } public function upload() { require_once(DIR_SYSTEM . 'library/wtiman/qqFileUploader.php'); // list of valid extensions, ex. array("jpeg", "xml", "bmp") $allowedExtensions = array("xlsx", "xls"); // max file size in bytes $sizeLimit = 30 * 1024 * 1024; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); // Call handleUpload() with the name of the folder, relative to PHP's getcwd() $result = $uploader->handleUpload(DIR_UPLOAD); $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($result)); } public function filepreview() { require_once(DIR_SYSTEM . 'library/wtiman/PHPExcel.php'); if(isset($this->request->get['fname'])){ $fname = $this->request->get['fname']; try{ $objPHPExcel = PHPExcel_IOFactory::load(DIR_UPLOAD.$fname); $lastRow = $objPHPExcel->getActiveSheet()->getHighestRow('A'); $lastColumn = $objPHPExcel->getActiveSheet()->getHighestDataColumn('1'); $result['count'] = $lastRow; if($lastRow > 3){ $lastRow = 3; } $result['rows'] = $objPHPExcel->getActiveSheet()->rangeToArray('A1'.':'.$lastColumn.$lastRow,null,true,true,true); $result['preview_count'] = $lastRow; $result['preview_col_count'] = count(reset($result['rows'])); $result['preview_col_list'] = array(); foreach (reset($result['rows']) as $key => $value) { $result['preview_col_list'][] = $key; } $result['stat'] = 'ok'; }catch(Exception $e){ $result['stat'] = 'error'; } } else{ $result['stat'] = 'error'; } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($result, JSON_PARTIAL_OUTPUT_ON_ERROR|JSON_INVALID_UTF8_IGNORE)); } public function importstep() { require_once(DIR_SYSTEM . 'library/wtiman/PHPExcel.php'); $this->load->model('wtiman/wtiman'); $this->load->model('catalog/manufacturer'); $data_json = $_POST['data']; $data = json_decode($data_json); try{ $objPHPExcel = PHPExcel_IOFactory::load(DIR_UPLOAD.$data->fname); $objPHPExcel->getActiveSheet()->garbageCollect(); $count = $data->total_count; $current = $data->current; $end = $current+50; if($end > $data->total_count){ $end = $data->total_count; } $lastColumn = $objPHPExcel->getActiveSheet()->getHighestDataColumn('1'); $rows = $objPHPExcel->getActiveSheet()->rangeToArray('A'.$current.':'.$lastColumn.$end,null,true,true,true); foreach ($rows as $row) { $prodIsUpdate = 0; $prod = $this->initEmptyProd(); $prod['node_id'] = $data->node_id; foreach ($data->field_list as $col => $field) { if($field == 'model'){ $prod['model'] = $row[$col]; break; } } if(!isset($prod['model']) || $prod['model'] == ''){ // если модель не указана, то пропускаем товар $current++; continue; } $p = $this->model_wtiman_wtiman->getProductFull($prod['model']); if($p){ $prod = $p; $prodIsUpdate = 1; } foreach ($data->field_list as $col => $field) { $value = $row[$col]; switch ($field) { case 'attribute': $prod['product_attribute'][] = array('attribute_id' => $data->attr_cols->$col, 'text' => $value); break; case 'name': $prod['product_description']['name'] = $value; $prod['product_description']['meta_title'] = $value; $prod['product_description']['meta_h1'] = $value; break; case 'description': $prod['product_description']['description'] = $value; $prod['product_description']['meta_description'] = $value; break; case 'brand': $brands = $this->model_catalog_manufacturer->getManufacturers(array('filter_name'=>$value)); if(is_array($brands)){ $brand = reset($brands); $brand_id = $brand['manufacturer_id']; } else{ $brand_id = $this->model_catalog_manufacturer->addManufacturer( array( 'name'=>$value, 'sort_order' => 0, 'noindex' => 0, 'manufacturer_store' => array(0), 'manufacturer_description' => array('1'=>array( 'description'=>'', 'meta_title'=>$value, 'meta_h1'=>$value, 'meta_description'=>'', 'meta_keyword'=>'' )), ) ); } $prod['manufacturer_id'] = $brand_id; break; case 'img': $prod['image'] = $data->option_img_path.'/'.$value; $prod['image'] = $this->getFullImgName($value, $data->option_img_path); break; case 'img_mask': $prod['product_image'] = array(); $list = $this->getImgListForMask($value, $data->option_img_path); if(count($list)){ $main_img_index = $data->option_img_main-1; if(isset($list[$main_img_index])){ $prod['image'] = $list[$main_img_index]; array_splice($list, $main_img_index, 1); } else{ $prod['image'] = array_shift($list); } foreach ($list as $img) { $prod['product_image'][] = array( 'image' => $img, 'sort_order' => 0 ); } } break; case 'price': $prod['price'] = str_replace(array(",","."," "),array('','',''),$value); break; case 'price_roz': $prod['length'] = str_replace(array(",","."," "),array('','',''),$value); break; case 'opt_count': $prod['weight'] = $value; break; default: # code... break; } } if($prod['product_description']['name'] == ''){ $prod['product_description']['name'] = $prod['model']; $prod['product_description']['meta_title'] = $prod['model']; $prod['product_description']['meta_h1'] = $prod['model']; } if($prodIsUpdate){ $this->model_wtiman_wtiman->updateProduct($prod['product_id'], $prod); } else{ $this->model_wtiman_wtiman->addProduct($prod); } $current++; } $result['stat'] = 'ok'; $result['last_pars'] = $current; $result['debug_inp'] = $data_json; $result['debug_obj'] = $data; }catch(Exception $e){ $result['stat'] = 'error'; $result['last_pars'] = $current; $result['debug_inp'] = $data_json; $result['debug_obj'] = $data; $result['warning'] = 'Ошибка открытия файла'; } $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode($result)); } protected function getImgListForMask($mask, $path) { $list = array(); $re = '/([A-Z]{3})([0-9]{4})-([0-9]{4})/u'; $reUno = '/([A-Z]{3})([0-9]{4})/u'; if( preg_match($re, $mask, $matches) ){ $sn = $matches[2]; $en = $matches[3]; for ($i=$sn; $i <= $en; $i++) { $name = sprintf($matches[1]."_"."%'.04d", $i); $fname = $this->getFullImgName($name, $path); if($fname != ''){ $list[] = $fname; } } } elseif( preg_match($reUno, $mask, $matches) ){ $name = sprintf($matches[1]."_"."%'.04d", $matches[2]); $fname = $this->getFullImgName($name, $path); if($fname != ''){ $list[] = $fname; } } return $list; } protected function getFullImgName($name, $path) { $path = trim ($path, '/'); $path = 'catalog/'.$path.'/'; $ext_list = array('', '.JPG', '.jpg', '.png', '.jpeg', '.PNG', '.JPEG'); foreach ($ext_list as $ext) { $fname = $path . $name . $ext; if(file_exists(DIR_IMAGE.$fname)){ return $fname; } } return ''; } protected function initEmptyProd() { $prod = array('node_id' => 0, 'model' => '', 'sku' => '', 'upc' => '', 'ean' => '', 'jan' => '', 'isbn' => '', 'mpn' => '', 'location' => '', 'quantity' => 1000, 'minimum' => 1, 'subtract' => '', 'stock_status_id' => 7, 'date_available' => '2009-02-04', 'manufacturer_id' => 0, 'shipping' => 1, 'price' => 0, 'points' => 0, 'weight' => 0, 'weight_class_id' => 1, 'length' => 0, 'width' => 0, 'height' => 0, 'length_class_id' => 1, 'status' => 1, 'noindex' => 0, 'tax_class_id' => 9, 'sort_order' => 1, 'image' => false, 'store_id' => 0, 'language_id' => 1, 'product_description' => array('name' => '', 'description' => '', 'tag' => '', 'meta_title' => '', 'meta_h1' => '', 'meta_description' => '', 'meta_keyword' => '' ), 'product_attribute' => array( // array( 'attribute_id' => '', // 'text' => '' // ) ), 'product_discount' => array( // array( 'customer_group_id' => 0, // 'quantity' => 0, // 'priority' => 0, // 'price' => 0, // 'date_start' => 0, // 'date_end' => 0 // ) ), 'product_image' => array( // array( 'image' => '', // 'sort_order' => 0 // ) ), 'product_seo_url' => false, // or string ); return $prod; } public function delete() { $this->load->language('catalog/product'); $this->load->model('catalog/product'); $this->load->model('wtiman/wtiman'); if (isset($this->request->post['selected'])) { foreach ($this->request->post['selected'] as $product_id) { $this->model_wtiman_wtiman->deleteProduct($product_id); } $this->session->data['success'] = $this->language->get('text_success'); } $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } 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['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $this->response->redirect($this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . $url, true)); } public function enable() { $this->load->language('catalog/product'); $this->load->model('catalog/product'); if (isset($this->request->post['selected'])) { foreach ($this->request->post['selected'] as $product_id) { $this->model_catalog_product->editProductStatus($product_id, 1); } $this->session->data['success'] = $this->language->get('text_success'); } $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } 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['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $this->response->redirect($this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . $url, true)); } public function disable() { $this->load->language('catalog/product'); $this->load->model('catalog/product'); if (isset($this->request->post['selected'])) { foreach ($this->request->post['selected'] as $product_id) { $this->model_catalog_product->editProductStatus($product_id, 0); } $this->session->data['success'] = $this->language->get('text_success'); } $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } 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['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $this->response->redirect($this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . $url, true)); } public function tocat() { $this->load->language('catalog/product'); $this->document->setTitle($this->language->get('heading_title')); $this->load->model('wtiman/wtiman'); if (isset($this->request->post['selected'])) { foreach ($this->request->post['selected'] as $product_id) { $this->model_wtiman_wtiman->clearProductCategory($product_id); foreach ($this->request->post['product_category'] as $category_id) { $this->model_wtiman_wtiman->addProductToCategory($product_id, $category_id); } } $this->session->data['success'] = $this->language->get('text_success'); } $url = ''; if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } 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['node_id'])) { $url .= '&node_id=' . $this->request->get['node_id']; } $this->response->redirect($this->url->link('wtiman/wtiman', 'user_token=' . $this->session->data['user_token'] . $url, true)); } public function export() { $this->load->model('wtiman/wtiman'); $node_id = isset($this->request->get['node_id']) ? $this->request->get['node_id'] : 0; } public function print() { $this->load->model('wtiman/wtiman'); $this->load->model('tool/image'); $node_id = isset($this->request->get['node_id']) ? $this->request->get['node_id'] : 0; $node_data = $this->model_wtiman_wtiman->getNode($node_id); $data['node_name'] = $node_data['name']; if ($this->request->server['HTTPS']) { $data['base'] = HTTPS_SERVER; } else { $data['base'] = HTTP_SERVER; } $filter_data = array( 'sort' => 'pd.name', 'order' => 'ASC' ); $products_list = $this->model_wtiman_wtiman->getProductsByNodeId($node_id, $filter_data); foreach ($products_list as $result) { if (is_file(DIR_IMAGE . $result['image'])) { $image = $this->model_tool_image->resize($result['image'], 80, 80); } else { $image = $this->model_tool_image->resize('no_image.png', 80, 80); } $special = false; $color_attr = $this->model_wtiman_wtiman->getProductAttributeById($result['product_id'], 13); $data['products'][] = array( 'product_id' => $result['product_id'], 'image' => $image, 'name' => $result['name'], 'model' => $result['model'], 'price' => $this->currency->format($result['price'], $this->config->get('config_currency')), 'color' => (isset($color_attr['text'])?$color_attr['text']:'') ); } $this->response->setOutput($this->load->view('wtiman/print_product_list', $data)); } }