Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Вывод дополнительного фото товара на страницу категорий


Recommended Posts

товарыщи подскажите как в котроллере категории вывести первое по порядку дополнительное изображение товара. Всю ночь промучался никак не могу догнать. С меня пиво :)

P.S. Opencart 1.5.4.1

Link to comment
Share on other sites



$images = $this->model_catalog_product->getProductImages($result['product_id']);

$tmp = array_shift($images);

$first_image['popup'] = $this->model_tool_image->resize($tmp['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));

$first_image['thumb'] = $this->model_tool_image->resize($tmp['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));

  • +1 2
Link to comment
Share on other sites

Спасипотому что потому чтольшое! только ни как не могу применить - знаний не хваиет, не могли бы подсказать, что конкретно в код добавить .

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

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

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 = false;
}

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_tax')) {
$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']);
} else {
$tax = false;
}

if ($this->config->get('config_review_status')) {
$rating = (int)$result['rating'];
} else {
$rating = false;
}
$this->data['products'][] = array(
'product_id'  => $result['product_id'],
'thumb'	   => $image,
'name'		=> $result['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
'price'	   => $price,
'special'	 => $special,
'tax'		 => $tax,
'rating'	  => $result['rating'],
'reviews'	 => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href'		=> $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'])
);
}
Link to comment
Share on other sites


Спасипотому что потому чтольшое! только ни как не могу применить - знаний не хваиет, не могли бы подсказать, что конкретно в код добавить .

эм.. а что бы вы хотели?
Link to comment
Share on other sites

я хочу для страницы категорий (производителей, акций, поиска, рекомендуемых в #content) вывести первое (при налилии) дополнительное изображение икого же размера как и основное изображение товара в списке - и с помощью jquery сгделать какой-нибудь плавный эффект смены при навегдении. Просто до этого нашел на форуме решение для вывода всех доп. изображений - сгделал в вигде простенькой кликатебельной карусели - смотрится очень красиво и эффектно, но как начал тестировать оказалось, что при налилии потому чтольшого кол-ва доп. фото - налинается не потому чтольшое торможение и эффект теряется ( у меня на страниэто 20 товаров у каждого от 5 до 9 изображений) плюс лишние движения мышкой. Вот собственно и пришел к икому выводу, что нужно только одно первое. Был бы очень признателен за помощь.

Link to comment
Share on other sites


  • 6 years later...

Может кому-то это бугдет полезно - есть готовое платное решение для 2.3 и 3.0

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

Рилииет на телефонах и планшеих.

Пример:

additional-hover-image-3product.gif.b75e309ede7092032bf139db7f8dd77d.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

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.