Jump to content
Sign in to follow this  
andreilunev

Отключить ресайз category thumb

Recommended Posts

Добрый день, коллеги!

Прошу помочь отключить ресайз изображения категории. 

Нашёл в catalog/controller/product/category.php строки:

 

$this->data['categories'][] = array(
'name'  => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $this->model_tool_image->resize(($result['image']=='' ? 'no_image.jpg' : $result['image']), $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'))
);
}
 
$this->data['products'] = array();
 
$data = array(
'filter_category_id' => $category_id,
'filter_filter'      => $filter, 
'sort'               => $sort,
'order'              => $order,
'start'              => ($page - 1) * $limit,
'limit'              => $limit
);
 
$results = $this->model_catalog_product->getProducts($data);
//Вызов метода getFoundProducts должен проводится сразу же после getProducts
//только тогда он выдает правильное значения количества товаров
$product_total = $this->model_catalog_product->getFoundProducts(); 
 
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
} else {
$image = $this->model_tool_image->resize('no_image.jpg', $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
}
 
Что и как нужно изменить, чтобы картинка thumb не ресайзилась?
 

Share this post


Link to post
Share on other sites

'thumb' => $this->model_tool_image->resize(($result['image']=='' ? 'no_image.jpg' : $result['image']), $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'))

 

заменить на

'thumb' => $result['image']

Share this post


Link to post
Share on other sites
'thumb' => $result['image']

 

Не совсем. Должно быть оформлено как ссылка

Share this post


Link to post
Share on other sites

навскидку написал

так-то да, плюс еще учесть http/https

Share this post


Link to post
Share on other sites

Не совсем. Должно быть оформлено как ссылка

Спасибо. А как всё-таки правильно будет? 

Share this post


Link to post
Share on other sites

попробуйте

'thumb' => 'image/' . $result['image']

Share this post


Link to post
Share on other sites

Я бы рекомендовал другой путь для ocStore

 

1. catalog/model/tool/image.php

 

protected function getImageUrl($new_image) {

 

public function getImageUrl($new_image) {

 

И затем

 

2. 'thumb' => $this->model_tool_image-> getImageUrl($result['image'])

 

Для opencart

 

 

'thumb' => $this->config->get('config_url') . 'image/' .$result['image']

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.