How to remove first image from the item card?

When we open a category, we see a "Main product image", then go to the item card and there it is, the image is the main/first. Accordingly, it is the main thing in preview.

I need to remove the first image in the item card, how to implement it?

Must be done so that more merchandise could only "Additional images"
March 12th 20 at 08:39
1 answer
March 12th 20 at 08:41
Solution
2 options:
1. To do everything in the template. Just instead of $thumb and $popup print $images[0]['thumb'] and $images[0]['popup']
2. Controller replace product pictures for $data['thumb'] and $data['popup'] on the first of the additional pictures.

In both cases, don't forget to remove the first image additional image to output additional images
The first option is eliminated, since version 3, and templates already twig

The second option is better, but there needs indicated by the first picture.

if ($product_info['image']) {
 $data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height'));
 } else {
 $data['popup'] = ";
}

 if ($product_info['image']) {
 $data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_height'));
 } else {
 $data['thumb'] = ";
}

 $data['images'] = array();

 $results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);

 foreach ($results as $result) {
 $data['images'][] = array(
 'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')),
 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_height'))
);
 }
- Raven.Berge commented on March 12th 20 at 08:44
$results is an array of additional symbols.
$first_image = array_shift($results); - extract the first image from the array - Terrance74 commented on March 12th 20 at 08:47
@Terrance74, Good Day! Same problem. And you can read more please on what to replace this code

if ($product_info['image']) {
 $data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height'));
 } else {
 $data['popup'] = ";
}

 if ($product_info['image']) {
 $data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_height'));
 } else {
 $data['thumb'] = ";
}

 $data['images'] = array();

 $results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);

 foreach ($results as $result) {
 $data['images'][] = array(
 'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height')),
 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_additional_height'))
);
 }


to hide the first or the second photo of the extra. - Thomas9 commented on March 12th 20 at 08:50

Find more questions by tags OpenCart