Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

sergei5770

Користувачі
  
  • Публікації

    62
  • З нами

  • Відвідування

Повідомлення, опубліковані користувачем sergei5770

  1. Только что, Leingard сказал:

    Сортируйте по цене

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

  2. Только что, spectre сказал:

    p.price=0 перед остальной сортировкой

    Пробовал следующим образом:

    if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
                if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
                    $sql .= " ORDER BY price = 0, price DESC, LCASE(" . $data['sort'] . ")";
                } elseif ($data['sort'] == 'p.price') {
                    $sql .= " ORDER BY price = 0, price DESC, (CASE WHEN special IS NOT NULL THEN special WHEN discount IS NOT NULL THEN discount ELSE p.price END)";
                } else {
                    $sql .= " ORDER BY price = 0, price DESC," . $data['sort'];
                }
            } else {
                $sql .= " ORDER BY price = 0, price DESC, p.sort_order";   
            }

    Не сработало

  3. Всем день добрый. Вопрос такой, если прайсы нескольких поставщиков, которые скидывают их эксель файлом, естественно никаких схожих структур ячеек нету, т.к. разные фабрики.

    Вопрос в следующем, возможна ли выгрузка цен из таких прайсов, или же все таки нужна схожая структура?

  4. Здравствуйте всем! Такая проблема, после переноса сайта на VPS, в файловом менеджере почти все папки стали иметь имя "data", хотя на сервере у папок нормальные имена, в чем может быть проблема и как это лечить? Все права на папки верные стоят, конфиги тоже верные, но эта ерунда с картинками. Пробовал перезаливать через filezilla и WinSCP, ноль результата.

  5. Фильтр по артикулу в админ панели для v1.5.5.1


    Фильтр по артикулу в админ панели для v1.5.5.1


    Позволяет фильтровать список товаров в админ панели по артикулу SKU.

    Проверено на версии 1.5.5.1.1

    Как ставить:

    В архиве приложена подробная инструкция и уже готовые файлы для версии 1.5.5.1.1


    • Автор
    • долучення
      14.10.16
    • Категорія
    • Системные требования
    • Метод активации
    • Ioncube Loader
    • ocStore
    • OpenCart.Pro, ocShop
    • Звернення до сервера розробника

     

  6. Модуль "Фильтр по артикулу в админ панели v1.5.x"

     

    post-714502-0-76843400-1476442997_thumb.png
     

    ВНИМАНИЕ! ЕСЛИ ИСПОЛЬЗУЕТЕ ГОТОВЫЕ ФАЙЛЫ, СДЕЛАЙТЕ БЭКАП ЗАМЕНЯЕМЫХ ФАЙЛОВ!

     

    Проверял на версии 1.5.5.1.1, для остальных версий будет делаться все наподобие.

     

    1) Идем в файл admin/controller/catalog/product.php

     

     

    После (примерно 34 строчка)

    if (isset($this->request->get['filter_model'])) {
    $filter_model = $this->request->get['filter_model'];
    } else {
    $filter_model = null;
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $filter_sku = $this->request->get['filter_sku'];
    } else {
    $filter_sku = null;
    }
    

    После (примерно 100 строчка)

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

    Добавляем

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

    После (примерно 132 строчка)

    'filter_model'	  => $filter_model,
    

    Добавляем

    'filter_sku'	  => $filter_sku,
    

    После(примерно 182 строчка)

    'model'      	=> $result['model'],
    

    Добавляем

    'sku'      	    => $result['sku'],
    

    После (примерно 232 строчка)

    if (isset($this->request->get['filter_model'])) {
    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $url .= '&filter_sku=' . urlencode(html_entity_decode($this->request->get['filter_sku'], ENT_QUOTES, 'UTF-8'));
    }	
    

    После (примерно 296 строчка)

    if (isset($this->request->get['filter_model'])) {
    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $url .= '&filter_sku=' . urlencode(html_entity_decode($this->request->get['filter_sku'], ENT_QUOTES, 'UTF-8'));
    }
    

    После (примерно 362 строчка)

    if (isset($this->request->get['filter_model'])) {
    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $url .= '&filter_sku=' . urlencode(html_entity_decode($this->request->get['filter_sku'], ENT_QUOTES, 'UTF-8'));
    }
    

    После (примерно 428 строчка)

    if (isset($this->request->get['filter_model'])) {
    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $url .= '&filter_sku=' . urlencode(html_entity_decode($this->request->get['filter_sku'], ENT_QUOTES, 'UTF-8'));
    }
    

    После (примерно 483 строчка)

    if (isset($this->request->get['filter_model'])) {
    $filter_model = $this->request->get['filter_model'];
    } else {
    $filter_model = null;
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $filter_sku = $this->request->get['filter_sku'];
    } else {
    $filter_sku = null;
    }	
    

    После (примерно 549 строчка)

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

    Добавляем

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

    После (примерно 605 строчка)

    'filter_model'	  => $filter_model,
    

    Добавляем

    'filter_sku'	  => $filter_sku,
    

    После (примерно 653 строчка)

    'model'      => $result['model'],
    

    Добавляем

    'sku'        => $result['sku'], 

    После (примерно 677 строчка)

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

    Добавляем

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

    После (примерно 719 строчка)

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

    Добавляем

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

    После (примерно 750 строка)

    $this->data['sort_model'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.model' . $url, 'SSL');
    

    Добавляем

    $this->data['sort_sku'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&sort=p.sku' . $url, 'SSL');
    

    После (примерно 771 строка)

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

    Добавляем

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

    После (примерно 811 строка)

    $this->data['filter_model'] = $filter_model;
    

    Добавляем

    $this->data['filter_sku'] = $filter_sku;
    

    После (примерно 986 строка)

    if (isset($this->request->get['filter_model'])) {
    $url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
    }
    

    Добавляем

    if (isset($this->request->get['filter_sku'])) {
    $url .= '&filter_sku=' . urlencode(html_entity_decode($this->request->get['filter_sku'], ENT_QUOTES, 'UTF-8'));
    }

    2) Идем в файл admin/model/catalog/product.php

     

    После (примерно 365 строчка)

    if (!empty($data['filter_model'])) {
    $sql .= " AND LCASE(p.model) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_model'])) . "%'";
    }
    

    Добавляем

    if (!empty($data['filter_sku'])) {
    $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_sku'])) . "%'";
    }
    

    После (примерно 413 строчка)

    'p.model',
    

    Добавляем

    'p.sku',
    

    После (примерно 677 строчка)

    if (!empty($data['filter_model'])) {
    $sql .= " AND LCASE(p.model) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_model'])) . "%'";
    }
    

    Добавляем

    if (!empty($data['filter_sku'])) {
    $sql .= " AND LCASE(p.sku) LIKE '%" . $this->db->escape(utf8_strtolower($data['filter_sku'])) . "%'";
    }
    

    3) Идем в файл admin/view/template/catalog/product_list.tpl

     

    После (примерно 40 строчка)

    <td class="left"><?php if ($sort == 'p.model') { ?>
    <a href="<?php echo $sort_model; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_model; ?></a>
    <?php } else { ?>
    <a href="<?php echo $sort_model; ?>"><?php echo $column_model; ?></a>
    <?php } ?></td>
    

    Добавляем

    <td class="left"><?php if ($sort == 'p.sku') { ?>
    <a href="<?php echo $sort_sku; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_sku; ?></a>
    <?php } else { ?>
    <a href="<?php echo $sort_sku; ?>">Артикул</a>
    <?php } ?></td> 
    

    После (примерно 90 строчка)

    <td><input type="text" name="filter_model" value="<?php echo $filter_model; ?>" /></td>
    

    Добавляем

    <td><input type="text" name="filter_sku" value="<?php echo $filter_sku; ?>" /></td>
    

    После (примерно 122 строчка)

    <td class="left"><?php echo $product['model']; ?></td>
    

    Добавляем

    <td class="left"><?php echo $product['sku']; ?></td>
    

    После (примерно 164 строка)

    <td class="left">${model}</td>
    

    Добавляем

    <td class="left">${sku}</td>
    

    После (примерно 212 строчка)

    var filter_model = $('input[name=\'filter_model\']').attr('value');
    	
    if (filter_model) {
    url += '&filter_model=' + encodeURIComponent(filter_model);
    }
    

    Добавляем

    var filter_sku = $('input[name=\'filter_sku\']').attr('value');
    	
    if (filter_sku) {
    url += '&filter_sku=' + encodeURIComponent(filter_sku);
    }	
    

    В самом конце файла перед 

    //--></script> 
    <?php echo $footer; ?>
    

    Добавляем

    $('input[name=\'filter_sku\']').autocomplete({
    	delay: 0,
    	source: function(request, response) {
    		$.ajax({
    			url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_sku=' +  encodeURIComponent(request.term),
    			dataType: 'json',
    			success: function(json) {		
    				response($.map(json, function(item) {
    					return {
    						label: item.sku,
    						value: item.product_id
    					}
    				}));
    			}
    		});
    	}, 
    	select: function(event, ui) {
    		$('input[name=\'filter_sku\']').val(ui.item.label);
    						
    		return false;
    	}
    });
    

    На этом все, фильтр по артикулу готов и работает, будьте внимательны при редактировании файлов и все получится!

     

    Для ленивых выкладываю уже отредактированные файлы версии движка 1.5.5.1.1(при копировании заменятся родные файлы движка, делайте бекапы!) модуль sku.zip

    post-714502-0-76843400-1476442997_thumb.png

  7. текущая директория видимо задается строкой

     

    $directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/');
    

    т..е. вместо DIR_IMAGE используем $directory

    Все, заработало, спасибо большое за помощь!

  8. ...опять надо догадываться

    переменная $directory инициализируется ниже чем используется

     

     

    	public function upload() {
    		$this->language->load('common/filemanager');
    		
    		$json = array();
    		
    		
    		if (isset($this->request->post['directory'])) {
    			
    			if (isset($this->request->files['image']) && $this->request->files['image']['tmp_name']) {		
    		
    				$filename = html_entity_decode($this->request->files['image']['name'], ENT_QUOTES, 'UTF-8');
    			
    				$file = $filename;
    				$cnt = 1;
    				$fileextention = substr(strrchr($file, '.'), 0);
    				$filename = substr($file, 0, strrpos($file, '.'));
    				if(file_exists($directory . $file))
    				{
    				while(file_exists($directory . $filename . $cnt . $fileextention))
    				$cnt ++;
    				$file = $filename . $cnt . $fileextention;
    				}
    				$filename = $file;
    				
    				if ((strlen($filename) < 3) || (strlen($filename) > 255)) {
    					$json['error'] = $this->language->get('error_filename');
    				}
    				
    				$directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/');
    							
    				if (!is_dir($directory)) {
    					$json['error'] = $this->language->get('error_directory');
    				}
    				
    				
    				if ($this->request->files['image']['size'] > 300000) {
    					$json['error'] = $this->language->get('error_file_size');
    				}
    				
    				$allowed = array(
    					'image/jpeg',
    					'image/pjpeg',
    					'image/png',
    					'image/x-png',
    					'image/gif',
    					'application/x-shockwave-flash'
    				);
    						
    				if (!in_array($this->request->files['image']['type'], $allowed)) {
    					$json['error'] = $this->language->get('error_file_type');
    				}
    				
    				$allowed = array(
    					'.jpg',
    					'.jpeg',
    					'.gif',
    					'.png',
    					'.flv'
    				);
    						
    				if (!in_array(strtolower(strrchr($filename, '.')), $allowed)) {
    					$json['error'] = $this->language->get('error_file_type');
    				}
    				
    				if ($this->request->files['image']['error'] != UPLOAD_ERR_OK) {
    					$json['error'] = 'error_upload_' . $this->request->files['image']['error'];
    				}			
    			} else {
    				$json['error'] = $this->language->get('error_file');
    			}
    		} else {
    			$json['error'] = $this->language->get('error_directory');
    		}
    		
    		if (!$this->user->hasPermission('modify', 'common/filemanager')) {
          		$json['error'] = $this->language->get('error_permission');  
        	}
    		
    		if (!isset($json['error'])) {	
    			if (@move_uploaded_file($this->request->files['image']['tmp_name'], $directory . '/' . $filename)) {		
    				$json['success'] = $this->language->get('text_uploaded');
    			} else {
    				$json['error'] = $this->language->get('error_uploaded');
    			}
    		}
    		
    		$this->response->setOutput(json_encode($json));
    	}
    

    Так выглядит весь upload

  9. код в студию

    $file = $filename;
    				$cnt = 1;
    				$fileextention = substr(strrchr($file, '.'), 0);
    				$filename = substr($file, 0, strrpos($file, '.'));
    				if(file_exists($directory . $file))
    				{
    				while(file_exists($directory . $filename . $cnt . $fileextention))
    				$cnt ++;
    				$file = $filename . $cnt . $fileextention;
    				}
    				$filename = $file;
    
  10. текущая директория видимо задается строкой

     

    $directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/');
    

    т..е. вместо DIR_IMAGE используем $directory

    перестает заливать картинки, просто зависает в загрузке

  11. Все, разобрался, спасибо пользователю shalan, кароч пишу решение для версии 1.5.5.1(на счет остальных версий не знаю)

     

    В файле admin/controller/common/filemanager.php, пишем:

     

    В функции public function upload()

    После

    $filename = html_entity_decode($this->request->files['image']['name'], ENT_QUOTES, 'UTF-8');
    

    Добавляем

    $directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/');
    
    $file = $filename;
    $cnt = 1;
    $fileextention = substr(strrchr($file, '.'), 0);
    $filename = substr($file, 0, strrpos($file, '.'));
    if(file_exists(DIR_IMAGE . 'data/' . $file))
    {
    while(file_exists($directory . '/' . $filename . $cnt . $fileextention))
    $cnt ++;
    $file = $filename . $cnt . $fileextention;
    }
    $filename = $file;
    

    После

    if ((strlen($filename) < 3) || (strlen($filename) > 255)) {
    $json['error'] = $this->language->get('error_filename');
    } 

    Удаляем

    $directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/'); 

    Все, теперь к повторяющимся названиям будут прибавляться цифры 1,2,3 и т.д.

    • +1 1
  12.  

    после

    {
        while(file_exists('image/' . $filename . $cnt . $fileextention))
        $cnt ++;
        $file = $filename . $cnt . $fileextention;
    }
    

    добавить

    $filename = $file;
    

    Файл стал загружаться, но он по прежнему перезаписывается, как будто игнорит проверку

  13. Видимо что-то не так поправили... Надо смотреть код.

     

    Я так понимаю эта функция отвечает за загрузку картинки, и сделал примерно так:

    public function upload() {
    		$this->language->load('common/filemanager');
    		
    		$json = array();
    		
    		
    		if (isset($this->request->post['directory'])) {
    			
    			if (isset($this->request->files['image']) && $this->request->files['image']['tmp_name']) {		
    		
    				$filename = basename(html_entity_decode($this->request->files['image']['name'], ENT_QUOTES, 'UTF-8'));
    				
    				$file = $filename;
    				$cnt = 1;
    				$fileextention = substr(strrchr($file, '.'), 0);
    				$filename = substr($file, 0, strrpos($file, '.'));
    				if(file_exists('image/' . $file))
    				{
    				while(file_exists('image/' . $filename . $cnt . $fileextention))
    				$cnt ++;
    				$file = $filename . $cnt . $fileextention;
    				}
    
    				if ((strlen($filename) < 3) || (strlen($filename) > 255)) {
    					$json['error'] = $this->language->get('error_filename');
    				}
    				
    				$directory = rtrim(DIR_IMAGE . 'data/' . str_replace('../', '', $this->request->post['directory']), '/');
    				
    				if (!is_dir($directory)) {
    					$json['error'] = $this->language->get('error_directory');
    				}
    				
    				if ($this->request->files['image']['size'] > 300000) {
    					$json['error'] = $this->language->get('error_file_size');
    				}
    				
    				$allowed = array(
    					'image/jpeg',
    					'image/pjpeg',
    					'image/png',
    					'image/x-png',
    					'image/gif',
    					'application/x-shockwave-flash'
    				);
    						
    				if (!in_array($this->request->files['image']['type'], $allowed)) {
    					$json['error'] = $this->language->get('error_file_type');
    				}
    				
    				$allowed = array(
    					'.jpg',
    					'.jpeg',
    					'.gif',
    					'.png',
    					'.flv'
    				);
    						
    				if (!in_array(strtolower(strrchr($filename, '.')), $allowed)) {
    					$json['error'] = $this->language->get('error_file_type');
    				}
    				
    				if ($this->request->files['image']['error'] != UPLOAD_ERR_OK) {
    					$json['error'] = 'error_upload_' . $this->request->files['image']['error'];
    				}			
    			} else {
    				$json['error'] = $this->language->get('error_file');
    			}
    		} else {
    			$json['error'] = $this->language->get('error_directory');
    		}
    		
    		if (!$this->user->hasPermission('modify', 'common/filemanager')) {
          		$json['error'] = $this->language->get('error_permission');  
        	}
    		
    		if (!isset($json['error'])) {	
    			if (@move_uploaded_file($this->request->files['image']['tmp_name'], $directory . '/' . $filename)) {		
    				$json['success'] = $this->language->get('text_uploaded');
    			} else {
    				$json['error'] = $this->language->get('error_uploaded');
    			}
    		}
    		
    		$this->response->setOutput(json_encode($json));
    	}
    
  14. Это пример, Вставлять в том месте, где формируется имя файла. DIR_FREEDOWNLOAD заменить на каталог изображений

    нашел это место

    теперь правда при загрузке пишет "некорректный тип файла", не подскажете в чем может быть косяк?

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.